byebug 8.2.5 → 9.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +77 -0
- data/CONTRIBUTING.md +6 -6
- data/GUIDE.md +26 -26
- data/README.md +18 -7
- data/bin/byebug +3 -1
- data/ext/byebug/breakpoint.c +3 -3
- data/ext/byebug/byebug.c +7 -4
- data/ext/byebug/byebug.h +0 -4
- data/ext/byebug/locker.c +1 -1
- data/ext/byebug/threads.c +2 -2
- data/lib/byebug/breakpoint.rb +2 -4
- data/lib/byebug/commands/catch.rb +1 -1
- data/lib/byebug/commands/delete.rb +4 -2
- data/lib/byebug/commands/edit.rb +1 -1
- data/lib/byebug/commands/enable/breakpoints.rb +1 -1
- data/lib/byebug/commands/finish.rb +1 -1
- data/lib/byebug/commands/info/breakpoints.rb +1 -1
- data/lib/byebug/commands/info/file.rb +2 -3
- data/lib/byebug/commands/irb.rb +8 -6
- data/lib/byebug/commands/kill.rb +1 -1
- data/lib/byebug/commands/pry.rb +3 -3
- data/lib/byebug/commands/restart.rb +22 -5
- data/lib/byebug/commands/save.rb +1 -1
- data/lib/byebug/core.rb +11 -4
- data/lib/byebug/frame.rb +6 -6
- data/lib/byebug/helpers/bin.rb +26 -0
- data/lib/byebug/helpers/file.rb +3 -3
- data/lib/byebug/helpers/parse.rb +1 -1
- data/lib/byebug/helpers/path.rb +7 -11
- data/lib/byebug/helpers/string.rb +11 -1
- data/lib/byebug/helpers/thread.rb +7 -5
- data/lib/byebug/helpers/toggle.rb +25 -24
- data/lib/byebug/helpers/var.rb +1 -1
- data/lib/byebug/history.rb +9 -2
- data/lib/byebug/interface.rb +3 -0
- data/lib/byebug/interfaces/local_interface.rb +5 -6
- data/lib/byebug/interfaces/script_interface.rb +4 -3
- data/lib/byebug/printers/base.rb +2 -1
- data/lib/byebug/printers/plain.rb +1 -2
- data/lib/byebug/printers/texts/base.yml +4 -0
- data/lib/byebug/printers/texts/plain.yml +1 -1
- data/lib/byebug/processors/command_processor.rb +15 -15
- data/lib/byebug/processors/script_processor.rb +6 -12
- data/lib/byebug/remote.rb +19 -19
- data/lib/byebug/runner.rb +65 -56
- data/lib/byebug/setting.rb +1 -1
- data/lib/byebug/settings/callstyle.rb +1 -0
- data/lib/byebug/version.rb +2 -1
- metadata +12 -13
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d998c99367586ad5a7f29f3bd5e22b2836f1d7c8
|
|
4
|
+
data.tar.gz: 32cf7615ad42d875e78c103e48c9a40dcde502be
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2f5f3f1aec38feaa4a83fd97b9b09313a97ea5dd25daee3e9319d602e7268ca8fa6ade3995c8d8ccd4d68d5369e2f6511a3d8710562bc3204866bbc5ab20452b
|
|
7
|
+
data.tar.gz: 570436e9f4263fdc9191c666337e5a726854427932fa995fa4819417414a6160830d27ffa3d0a3acf9c1e23fa4d387ee8d6f0d4e50e4b6b583626443e31b2bd9
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,83 @@
|
|
|
2
2
|
|
|
3
3
|
## Master (Unreleased)
|
|
4
4
|
|
|
5
|
+
## 9.1.0 - 2016-08-22
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
* Better UI messages for breakpoint management.
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
* `where` command failing on instance_exec block stack frames.
|
|
14
|
+
* `restart` command crashing in certain cases because of a missing `require 'English'` (#321, @akaneko3).
|
|
15
|
+
* `restart` command crashing when debugged script is not executable or has no shebang (#321, @akaneko3).
|
|
16
|
+
|
|
17
|
+
### Removed
|
|
18
|
+
|
|
19
|
+
* Ruby 2.0 and Ruby 2.1 official & unofficial support. Byebug no longer installs
|
|
20
|
+
on these platforms.
|
|
21
|
+
|
|
22
|
+
## 9.0.6 - 2016-09-29
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
|
|
26
|
+
* Error when using `byebug` with a ruby compiled against libedit (#241).
|
|
27
|
+
* Allow `Byebug.start_server` to yield the block passed to it when the actual
|
|
28
|
+
port is already known (#277, thanks @cben).
|
|
29
|
+
* Use a standard license name so it can be more reliably used by tools (#275).
|
|
30
|
+
|
|
31
|
+
## 9.0.5 - 2016-05-28
|
|
32
|
+
|
|
33
|
+
### Fixed
|
|
34
|
+
|
|
35
|
+
* Error loading rc file when `ENV['HOME']` is unset.
|
|
36
|
+
|
|
37
|
+
## 9.0.4 - 2016-05-19
|
|
38
|
+
|
|
39
|
+
### Fixed
|
|
40
|
+
|
|
41
|
+
* Errors in rc file not being displayed to the user.
|
|
42
|
+
|
|
43
|
+
## 9.0.3 - 2016-05-16
|
|
44
|
+
|
|
45
|
+
### Fixed
|
|
46
|
+
|
|
47
|
+
* Unfriendly output in byebug's executable when no script specified (#256).
|
|
48
|
+
* Unfriendly output in byebug's executable when script doesn't exist.
|
|
49
|
+
* Unfriendly output in byebug's executable when script has invalid code.
|
|
50
|
+
|
|
51
|
+
## 9.0.2 - 2016-05-15
|
|
52
|
+
|
|
53
|
+
### Fixed
|
|
54
|
+
|
|
55
|
+
* Skip to get a line in eval context (#263, thanks @k0kubun).
|
|
56
|
+
* Debugger getting disabled after `continue` even when linetrace is enabled
|
|
57
|
+
(#264, thanks @k0kubun).
|
|
58
|
+
|
|
59
|
+
## 9.0.1 - 2016-05-14
|
|
60
|
+
|
|
61
|
+
### Fixed
|
|
62
|
+
|
|
63
|
+
* `quit` never exiting when remote debugging (#201).
|
|
64
|
+
|
|
65
|
+
## 9.0.0 - 2016-05-11
|
|
66
|
+
|
|
67
|
+
### Fixed
|
|
68
|
+
|
|
69
|
+
* `irb` command unintentionally changing $PROGRAM_NAME.
|
|
70
|
+
* `pry` command failing.
|
|
71
|
+
* Unrelated error message when using `pry` command and Pry not installed.
|
|
72
|
+
* Interrupting program execution from remote control interface (#239, thanks
|
|
73
|
+
@izaera).
|
|
74
|
+
|
|
75
|
+
### Removed
|
|
76
|
+
|
|
77
|
+
* Official Ruby 2.0.0 support. `var local` no longer works in Ruby 2.0. The
|
|
78
|
+
rest of the commands should still work as before, but `byebug` is no longer
|
|
79
|
+
tested against this version so they might start breaking in the
|
|
80
|
+
future.
|
|
81
|
+
|
|
5
82
|
## 8.2.5 - 2016-04-27
|
|
6
83
|
|
|
7
84
|
### Fixed
|
data/CONTRIBUTING.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
# CONTRIBUTING
|
|
2
2
|
|
|
3
3
|
Please note that this project is released with a [Contributor Code of
|
|
4
4
|
Conduct](code_of_conduct.md). By participating in this project you agree to
|
|
5
5
|
abide by its terms.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## Bug Reports
|
|
8
8
|
|
|
9
9
|
* Try to reproduce the issue against the latest revision. There might be
|
|
10
10
|
unrealeased work that fixes your problem!
|
|
@@ -14,7 +14,7 @@ abide by its terms.
|
|
|
14
14
|
* Include the behavior you observed along with the behavior you expected,
|
|
15
15
|
and why you expected it.
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
## Development dependencies
|
|
18
18
|
|
|
19
19
|
* `Byebug` depends on Ruby's TracePoint API provided by `ruby-core`. This is a
|
|
20
20
|
young API and a lot of bugs have been recently corrected, so make sure you
|
|
@@ -24,7 +24,7 @@ abide by its terms.
|
|
|
24
24
|
* Running `bundle install` inside a local clone of `byebug` will get development
|
|
25
25
|
dependencies installed.
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
## Running the test suite
|
|
28
28
|
|
|
29
29
|
* Make sure you compile the C-extension using `bundle exec rake compile`.
|
|
30
30
|
Otherwise you won't be able to use `byebug`.
|
|
@@ -45,7 +45,7 @@ abide by its terms.
|
|
|
45
45
|
example: `script/minitest_runner.rb Byebug::BreakAtLinesTestCase
|
|
46
46
|
test_catch_removes_specific_catchpoint`
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
## Code style
|
|
49
49
|
|
|
50
50
|
* Byebug uses [overcommit][] to enforce code style. Install the git hooks using
|
|
51
51
|
`bundle exec overcommit --install`. They will review your changes before they
|
|
@@ -53,7 +53,7 @@ abide by its terms.
|
|
|
53
53
|
|
|
54
54
|
[overcommit]: https://github.com/brigade/overcommit/
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
## Byebug as a C-extension
|
|
57
57
|
|
|
58
58
|
Byebug is a gem developed as a C-extension. The debugger internal's
|
|
59
59
|
functionality is implemented in C (the interaction with the TracePoint API).
|
data/GUIDE.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
# GUIDE
|
|
2
|
+
|
|
3
|
+
## Introduction
|
|
4
|
+
|
|
1
5
|
### First Steps
|
|
2
6
|
|
|
3
7
|
A handful of commands are enough to get started using `byebug`. The following
|
|
@@ -182,7 +186,21 @@ end
|
|
|
182
186
|
|
|
183
187
|
n_args = $ARGV.length
|
|
184
188
|
|
|
185
|
-
|
|
189
|
+
raise('*** Need number of disks or no parameter') if n_args > 1
|
|
190
|
+
|
|
191
|
+
n = 3
|
|
192
|
+
|
|
193
|
+
if n_args > 0
|
|
194
|
+
begin
|
|
195
|
+
n = $ARGV[0].to_i
|
|
196
|
+
rescue ValueError
|
|
197
|
+
raise("*** Expecting an integer, got: #{$ARGV[0]}")
|
|
198
|
+
end
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
raise('*** Number of disks should be between 1 and 100') if n < 1 || n > 100
|
|
202
|
+
|
|
203
|
+
hanoi(n, :a, :b, :c)
|
|
186
204
|
```
|
|
187
205
|
|
|
188
206
|
Recall in the first section it was stated that before the `def` is run, the
|
|
@@ -312,7 +330,7 @@ Now let's see what happens after stepping:
|
|
|
312
330
|
11:
|
|
313
331
|
=> 12: n_args = $ARGV.length
|
|
314
332
|
13:
|
|
315
|
-
14:
|
|
333
|
+
14: raise('*** Need number of disks or no parameter') if n_args > 1
|
|
316
334
|
(byebug) private_methods.member?(:hanoi)
|
|
317
335
|
true
|
|
318
336
|
(byebug)
|
|
@@ -438,15 +456,15 @@ NameError Exception: undefined local variable or method `n_args' for main:Object
|
|
|
438
456
|
19: begin
|
|
439
457
|
20: n = $ARGV[0].to_i
|
|
440
458
|
21: rescue ValueError
|
|
441
|
-
22: raise("
|
|
459
|
+
22: raise("*** Expecting an integer, got: #{$ARGV[0]}")
|
|
442
460
|
23: end
|
|
443
461
|
24: end
|
|
444
462
|
25:
|
|
445
|
-
26:
|
|
463
|
+
26: raise('*** Number of disks should be between 1 and 100') if n < 1 || n > 100
|
|
446
464
|
27:
|
|
447
465
|
=> 28: hanoi(n, :a, :b, :c)
|
|
448
466
|
(byebug) n_args
|
|
449
|
-
|
|
467
|
+
1
|
|
450
468
|
(byebug) eval n
|
|
451
469
|
3
|
|
452
470
|
(byebug) down 2
|
|
@@ -610,10 +628,6 @@ already been done when you compile the program (or in Perl when it scans in the
|
|
|
610
628
|
program). In this section we'll consider some other things that might throw off
|
|
611
629
|
new users to Ruby who are familiar with other languages and debugging in them.
|
|
612
630
|
|
|
613
|
-
* Bouncing Around in Blocks (iterators)
|
|
614
|
-
* No Parameter Values in a Call Stack
|
|
615
|
-
* Lines You Can Stop At
|
|
616
|
-
|
|
617
631
|
#### Bouncing Around in Blocks (iterators)
|
|
618
632
|
|
|
619
633
|
When debugging languages with coroutines like Python and Ruby, a method call may
|
|
@@ -1600,7 +1614,7 @@ not be printed but they won't be forgotten either, so you can toggle them again
|
|
|
1600
1614
|
later. To do that, use `disable display` or `enable display` followed by the
|
|
1601
1615
|
expression number.
|
|
1602
1616
|
|
|
1603
|
-
### Evaluation of expressions:
|
|
1617
|
+
### Evaluation of expressions: irb, pry
|
|
1604
1618
|
|
|
1605
1619
|
To examine and change data in your script you can just evaluate any Ruby code
|
|
1606
1620
|
from `byebug`'s prompt. Any input that is not recognized as a command will be
|
|
@@ -1631,23 +1645,9 @@ $ byebug triangle.rb
|
|
|
1631
1645
|
9:
|
|
1632
1646
|
10: if __FILE__ == $0
|
|
1633
1647
|
(byebug) irb
|
|
1634
|
-
|
|
1648
|
+
irb(main):001:0> (0..6).inject { |sum, i| sum += i }
|
|
1635
1649
|
=> 21
|
|
1636
|
-
|
|
1637
|
-
/home/davidr/Proyectos/byebug/old_doc/triangle.rb @ 2
|
|
1638
|
-
def triangle(n)
|
|
1639
|
-
(byebug) list # same line range as before going into irb
|
|
1640
|
-
[1, 10] in /path/to/triangle.rb
|
|
1641
|
-
1: # Compute the n'th triangle number, the hard way: triangle(n) == (n*(n+1))/2
|
|
1642
|
-
=> 2: def triangle(n)
|
|
1643
|
-
3: tri = 0
|
|
1644
|
-
4: 0.upto(n) do |i|
|
|
1645
|
-
5: tri += i
|
|
1646
|
-
6: end
|
|
1647
|
-
7: tri
|
|
1648
|
-
8: end
|
|
1649
|
-
9:
|
|
1650
|
-
10: if __FILE__ == $0
|
|
1650
|
+
irb(main):002:0> exit
|
|
1651
1651
|
(byebug)
|
|
1652
1652
|
```
|
|
1653
1653
|
|
data/README.md
CHANGED
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
[tip_url]: https://gratipay.com/byebug
|
|
19
19
|
[irc_url]: https://gitter.im/deivid-rodriguez/byebug
|
|
20
20
|
|
|
21
|
-
Byebug is a simple to use, feature rich debugger for Ruby
|
|
22
|
-
TracePoint API for execution control and the
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
Byebug is a simple to use, feature rich debugger for Ruby. It uses the
|
|
22
|
+
TracePoint API for execution control and the Debug Inspector API for call stack
|
|
23
|
+
navigation, so it doesn't depend on internal core sources. It's developed as a C
|
|
24
|
+
extension, so it's fast. And it has a full test suite so it's reliable.
|
|
25
25
|
|
|
26
26
|
It allows you to see what is going on _inside_ a Ruby program while it executes
|
|
27
27
|
and offers many of the traditional debugging features such as:
|
|
@@ -48,12 +48,10 @@ Windows [![Vey][vey]][vey_url]
|
|
|
48
48
|
|
|
49
49
|
## Requirements
|
|
50
50
|
|
|
51
|
-
* Required: MRI 2.0.0 or higher. For debugging ruby 1.9.3 or older, use
|
|
52
|
-
[debugger].
|
|
53
51
|
* Recommended:
|
|
54
|
-
* MRI 2.1.8 or higher.
|
|
55
52
|
* MRI 2.2.4 or higher.
|
|
56
53
|
* MRI 2.3.0 or higher.
|
|
54
|
+
* MRI 2.4.0 or higher.
|
|
57
55
|
|
|
58
56
|
## Install
|
|
59
57
|
|
|
@@ -63,6 +61,8 @@ gem install byebug
|
|
|
63
61
|
|
|
64
62
|
## Usage
|
|
65
63
|
|
|
64
|
+
### From within the Ruby code
|
|
65
|
+
|
|
66
66
|
Simply drop
|
|
67
67
|
|
|
68
68
|
byebug
|
|
@@ -74,6 +74,7 @@ If you were debugging Rails, for example, you would add `byebug` to your code.
|
|
|
74
74
|
def index
|
|
75
75
|
byebug
|
|
76
76
|
@articles = Article.find_recent
|
|
77
|
+
end
|
|
77
78
|
```
|
|
78
79
|
|
|
79
80
|
And then start a Rails server.
|
|
@@ -84,6 +85,14 @@ bin/rails s
|
|
|
84
85
|
|
|
85
86
|
Once the execution gets to your `byebug` command you will get a debugging prompt.
|
|
86
87
|
|
|
88
|
+
### From the command line
|
|
89
|
+
|
|
90
|
+
If you want to debug a Ruby script without editing it, you can invoke byebug from the command line.
|
|
91
|
+
|
|
92
|
+
```shell
|
|
93
|
+
byebug myscript.rb
|
|
94
|
+
```
|
|
95
|
+
|
|
87
96
|
## Byebug's commands
|
|
88
97
|
|
|
89
98
|
Command | Aliases | Subcommands
|
|
@@ -145,6 +154,7 @@ started. Proper documentation will be eventually written.
|
|
|
145
154
|
connected.
|
|
146
155
|
* [minitest-byebug] starts a byebug session on minitest failures.
|
|
147
156
|
* [sublime_debugger] provides a plugin for ruby debugging on Sublime Text.
|
|
157
|
+
* [atom-byebug] provides integration with the Atom editor [EXPERIMENTAL].
|
|
148
158
|
|
|
149
159
|
## Contribute
|
|
150
160
|
|
|
@@ -168,3 +178,4 @@ software, especially:
|
|
|
168
178
|
[ruby-debug-passenger]: https://github.com/davejamesmiller/ruby-debug-passenger
|
|
169
179
|
[minitest-byebug]: https://github.com/kaspth/minitest-byebug
|
|
170
180
|
[sublime_debugger]: https://github.com/shuky19/sublime_debugger
|
|
181
|
+
[atom-byebug]: https://github.com/izaera/atom-byebug
|
data/bin/byebug
CHANGED
data/ext/byebug/breakpoint.c
CHANGED
|
@@ -277,7 +277,7 @@ brkpt_initialize(VALUE self, VALUE source, VALUE pos, VALUE expr)
|
|
|
277
277
|
return Qnil;
|
|
278
278
|
}
|
|
279
279
|
|
|
280
|
-
int
|
|
280
|
+
static int
|
|
281
281
|
filename_cmp_impl(VALUE source, char *file)
|
|
282
282
|
{
|
|
283
283
|
char *source_ptr, *file_ptr;
|
|
@@ -309,7 +309,7 @@ filename_cmp_impl(VALUE source, char *file)
|
|
|
309
309
|
return 1;
|
|
310
310
|
}
|
|
311
311
|
|
|
312
|
-
int
|
|
312
|
+
static int
|
|
313
313
|
filename_cmp(VALUE source, char *file)
|
|
314
314
|
{
|
|
315
315
|
#ifdef _WIN32
|
|
@@ -332,7 +332,7 @@ filename_cmp(VALUE source, char *file)
|
|
|
332
332
|
#endif
|
|
333
333
|
}
|
|
334
334
|
|
|
335
|
-
int
|
|
335
|
+
static int
|
|
336
336
|
classname_cmp(VALUE name, VALUE klass)
|
|
337
337
|
{
|
|
338
338
|
VALUE mod_name;
|
data/ext/byebug/byebug.c
CHANGED
|
@@ -37,9 +37,9 @@ Breakpoints(VALUE self)
|
|
|
37
37
|
|
|
38
38
|
/*
|
|
39
39
|
* call-seq:
|
|
40
|
-
* Byebug.catchpoints ->
|
|
40
|
+
* Byebug.catchpoints -> hash
|
|
41
41
|
*
|
|
42
|
-
* Returns
|
|
42
|
+
* Returns the catchpoints hash.
|
|
43
43
|
*/
|
|
44
44
|
static VALUE
|
|
45
45
|
Catchpoints(VALUE self)
|
|
@@ -352,7 +352,7 @@ return_event(VALUE trace_point, void *data)
|
|
|
352
352
|
{
|
|
353
353
|
file = rb_tracearg_path(trace_arg);
|
|
354
354
|
/*
|
|
355
|
-
*
|
|
355
|
+
* @todo Sometimes the TracePoint API gives some return events without
|
|
356
356
|
* file:line information, so we need to guard for nil until we know what's
|
|
357
357
|
* going on. This happens, for example, with active_support core extensions:
|
|
358
358
|
*
|
|
@@ -676,6 +676,9 @@ Stoppable(VALUE self)
|
|
|
676
676
|
if (post_mortem == Qtrue)
|
|
677
677
|
return Qfalse;
|
|
678
678
|
|
|
679
|
+
if (RTEST(tracing))
|
|
680
|
+
return Qfalse;
|
|
681
|
+
|
|
679
682
|
context = Current_context(self);
|
|
680
683
|
if (!NIL_P(context))
|
|
681
684
|
{
|
|
@@ -841,7 +844,7 @@ Set_post_mortem(VALUE self, VALUE value)
|
|
|
841
844
|
* call-seq:
|
|
842
845
|
* Byebug.add_catchpoint(exception) -> exception
|
|
843
846
|
*
|
|
844
|
-
* Adds a new exception to the catchpoints
|
|
847
|
+
* Adds a new exception to the catchpoints hash.
|
|
845
848
|
*/
|
|
846
849
|
static VALUE
|
|
847
850
|
Add_catchpoint(VALUE self, VALUE value)
|
data/ext/byebug/byebug.h
CHANGED
|
@@ -93,7 +93,6 @@ typedef struct
|
|
|
93
93
|
} breakpoint_t;
|
|
94
94
|
|
|
95
95
|
/* functions from locker.c */
|
|
96
|
-
extern int is_in_locked(VALUE thread_id);
|
|
97
96
|
extern void add_to_locked(VALUE thread);
|
|
98
97
|
extern VALUE pop_from_locked();
|
|
99
98
|
extern void remove_from_locked(VALUE thread);
|
|
@@ -121,9 +120,6 @@ extern VALUE context_backtrace_set(const rb_debug_inspector_t * inspector,
|
|
|
121
120
|
|
|
122
121
|
/* functions from breakpoint.c */
|
|
123
122
|
extern void Init_breakpoint(VALUE mByebug);
|
|
124
|
-
extern VALUE catchpoint_hit_count(VALUE catchpoints, VALUE exception,
|
|
125
|
-
VALUE * exception_name);
|
|
126
|
-
|
|
127
123
|
extern VALUE find_breakpoint_by_pos(VALUE breakpoints, VALUE source, VALUE pos,
|
|
128
124
|
VALUE bind);
|
|
129
125
|
|
data/ext/byebug/locker.c
CHANGED
data/ext/byebug/threads.c
CHANGED
|
@@ -7,7 +7,7 @@ static VALUE cThreadsTable;
|
|
|
7
7
|
VALUE next_thread = Qnil;
|
|
8
8
|
|
|
9
9
|
/* To allow thread syncronization, we must stop threads when debugging */
|
|
10
|
-
VALUE locker = Qnil;
|
|
10
|
+
static VALUE locker = Qnil;
|
|
11
11
|
|
|
12
12
|
static int
|
|
13
13
|
t_tbl_mark_keyvalue(st_data_t key, st_data_t value, st_data_t tbl)
|
|
@@ -97,7 +97,7 @@ is_living_thread(VALUE thread)
|
|
|
97
97
|
/*
|
|
98
98
|
* Checks threads table for dead/finished threads.
|
|
99
99
|
*/
|
|
100
|
-
void
|
|
100
|
+
static void
|
|
101
101
|
cleanup_dead_threads(void)
|
|
102
102
|
{
|
|
103
103
|
threads_table_t *t_tbl;
|
data/lib/byebug/breakpoint.rb
CHANGED
|
@@ -81,10 +81,8 @@ module Byebug
|
|
|
81
81
|
# Prints all information associated to the breakpoint
|
|
82
82
|
#
|
|
83
83
|
def inspect
|
|
84
|
-
meths = %w
|
|
85
|
-
values = meths.map
|
|
86
|
-
"#{field}: #{send(field)}"
|
|
87
|
-
end.join(', ')
|
|
84
|
+
meths = %w[id pos source expr hit_condition hit_count hit_value enabled?]
|
|
85
|
+
values = meths.map { |field| "#{field}: #{send(field)}" }.join(', ')
|
|
88
86
|
"#<Byebug::Breakpoint #{values}>"
|
|
89
87
|
end
|
|
90
88
|
end
|
|
@@ -36,7 +36,7 @@ module Byebug
|
|
|
36
36
|
def execute
|
|
37
37
|
return info unless @match[1]
|
|
38
38
|
|
|
39
|
-
return
|
|
39
|
+
return @match[1] == 'off' ? clear : add(@match[1]) unless @match[2]
|
|
40
40
|
|
|
41
41
|
return errmsg pr('catch.errors.off', off: cmd) unless @match[2] == 'off'
|
|
42
42
|
|
|
@@ -44,8 +44,10 @@ module Byebug
|
|
|
44
44
|
|
|
45
45
|
return errmsg(err) unless pos
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
if Breakpoint.remove(pos)
|
|
48
|
+
puts(pr('break.messages.breakpoint_deleted', pos: pos))
|
|
49
|
+
else
|
|
50
|
+
errmsg(pr('break.errors.no_breakpoint_delete', pos: pos))
|
|
49
51
|
end
|
|
50
52
|
end
|
|
51
53
|
end
|
data/lib/byebug/commands/edit.rb
CHANGED
|
@@ -10,6 +10,7 @@ module Byebug
|
|
|
10
10
|
#
|
|
11
11
|
class FileCommand < Command
|
|
12
12
|
include Helpers::FileHelper
|
|
13
|
+
include Helpers::StringHelper
|
|
13
14
|
|
|
14
15
|
self.allow_in_post_mortem = true
|
|
15
16
|
|
|
@@ -38,8 +39,7 @@ module Byebug
|
|
|
38
39
|
return errmsg(pr('info.errors.undefined_file', file: file))
|
|
39
40
|
end
|
|
40
41
|
|
|
41
|
-
puts <<-EOC
|
|
42
|
-
|
|
42
|
+
puts prettify <<-EOC
|
|
43
43
|
File #{info_file_basic(file)}
|
|
44
44
|
|
|
45
45
|
Breakpoint line numbers: #{info_file_breakpoints(file)}
|
|
@@ -47,7 +47,6 @@ module Byebug
|
|
|
47
47
|
Modification time: #{info_file_mtime(file)}
|
|
48
48
|
|
|
49
49
|
Sha1 Signature: #{info_file_sha1(file)}
|
|
50
|
-
|
|
51
50
|
EOC
|
|
52
51
|
end
|
|
53
52
|
|
data/lib/byebug/commands/irb.rb
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
require 'byebug/command'
|
|
2
2
|
require 'irb'
|
|
3
|
+
require 'English'
|
|
3
4
|
|
|
4
5
|
module Byebug
|
|
5
6
|
#
|
|
@@ -25,23 +26,24 @@ module Byebug
|
|
|
25
26
|
end
|
|
26
27
|
|
|
27
28
|
def execute
|
|
28
|
-
unless processor.interface.
|
|
29
|
+
unless processor.interface.instance_of?(LocalInterface)
|
|
29
30
|
return errmsg(pr('base.errors.only_local'))
|
|
30
31
|
end
|
|
31
32
|
|
|
32
|
-
# IRB tries to parse ARGV so we must clear it.
|
|
33
|
-
|
|
33
|
+
# @todo IRB tries to parse $ARGV so we must clear it (see #197). Add a
|
|
34
|
+
# test case for it so we can remove this comment.
|
|
35
|
+
with_clean_argv { IRB.start }
|
|
34
36
|
end
|
|
35
37
|
|
|
36
38
|
private
|
|
37
39
|
|
|
38
40
|
def with_clean_argv
|
|
39
|
-
saved_argv = ARGV.dup
|
|
40
|
-
ARGV.clear
|
|
41
|
+
saved_argv = $ARGV.dup
|
|
42
|
+
$ARGV.clear
|
|
41
43
|
begin
|
|
42
44
|
yield
|
|
43
45
|
ensure
|
|
44
|
-
ARGV.concat(saved_argv)
|
|
46
|
+
$ARGV.concat(saved_argv)
|
|
45
47
|
end
|
|
46
48
|
end
|
|
47
49
|
end
|
data/lib/byebug/commands/kill.rb
CHANGED
data/lib/byebug/commands/pry.rb
CHANGED
|
@@ -25,17 +25,17 @@ module Byebug
|
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
def execute
|
|
28
|
-
unless processor.interface.
|
|
28
|
+
unless processor.interface.instance_of?(LocalInterface)
|
|
29
29
|
return errmsg(pr('base.errors.only_local'))
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
begin
|
|
33
33
|
require 'pry'
|
|
34
34
|
rescue LoadError
|
|
35
|
-
errmsg(pr('pry.errors.not_installed'))
|
|
35
|
+
return errmsg(pr('pry.errors.not_installed'))
|
|
36
36
|
end
|
|
37
37
|
|
|
38
|
-
context.
|
|
38
|
+
Pry.start(context.frame._binding)
|
|
39
39
|
end
|
|
40
40
|
end
|
|
41
41
|
end
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
require 'byebug/command'
|
|
2
|
+
require 'byebug/helpers/bin'
|
|
2
3
|
require 'byebug/helpers/path'
|
|
3
4
|
require 'shellwords'
|
|
5
|
+
require 'English'
|
|
6
|
+
require 'rbconfig'
|
|
4
7
|
|
|
5
8
|
module Byebug
|
|
6
9
|
#
|
|
7
10
|
# Restart debugged program from within byebug.
|
|
8
11
|
#
|
|
9
12
|
class RestartCommand < Command
|
|
13
|
+
include Helpers::BinHelper
|
|
10
14
|
include Helpers::PathHelper
|
|
11
15
|
|
|
12
16
|
self.allow_in_control = true
|
|
@@ -32,14 +36,27 @@ module Byebug
|
|
|
32
36
|
end
|
|
33
37
|
|
|
34
38
|
def execute
|
|
35
|
-
|
|
39
|
+
cmd = [$PROGRAM_NAME]
|
|
36
40
|
|
|
37
|
-
|
|
41
|
+
cmd = prepend_byebug_bin(cmd)
|
|
42
|
+
cmd = prepend_ruby_bin(cmd)
|
|
38
43
|
|
|
39
|
-
|
|
44
|
+
cmd += (@match[:args] ? @match[:args].shellsplit : $ARGV)
|
|
40
45
|
|
|
41
|
-
puts pr('restart.success', cmd:
|
|
42
|
-
exec(*
|
|
46
|
+
puts pr('restart.success', cmd: cmd.shelljoin)
|
|
47
|
+
Kernel.exec(*cmd)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
private
|
|
51
|
+
|
|
52
|
+
def prepend_byebug_bin(cmd)
|
|
53
|
+
cmd.unshift(bin_file) if Byebug.mode == :standalone
|
|
54
|
+
cmd
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def prepend_ruby_bin(cmd)
|
|
58
|
+
cmd.unshift(RbConfig.ruby) if which('ruby') != which(cmd.first)
|
|
59
|
+
cmd
|
|
43
60
|
end
|
|
44
61
|
end
|
|
45
62
|
end
|
data/lib/byebug/commands/save.rb
CHANGED