byebug 11.1.3 → 12.0.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 +25 -0
- data/GUIDE.md +37 -37
- data/README.md +1 -3
- data/ext/byebug/breakpoint.c +10 -6
- data/ext/byebug/byebug.c +27 -21
- data/ext/byebug/context.c +1 -0
- data/ext/byebug/threads.c +11 -0
- data/lib/byebug/breakpoint.rb +1 -18
- data/lib/byebug/commands/break.rb +7 -5
- data/lib/byebug/commands/enable/breakpoints.rb +1 -1
- data/lib/byebug/commands/finish.rb +1 -1
- data/lib/byebug/commands/help.rb +1 -1
- data/lib/byebug/commands/info.rb +1 -1
- data/lib/byebug/commands/set.rb +1 -1
- data/lib/byebug/commands/step.rb +1 -1
- data/lib/byebug/commands/thread/current.rb +1 -1
- data/lib/byebug/commands/thread/list.rb +1 -1
- data/lib/byebug/commands/thread/resume.rb +1 -1
- data/lib/byebug/commands/thread/stop.rb +1 -1
- data/lib/byebug/commands/tracevar.rb +1 -1
- data/lib/byebug/commands/untracevar.rb +2 -2
- data/lib/byebug/commands/var/args.rb +1 -1
- data/lib/byebug/commands/where.rb +14 -3
- data/lib/byebug/helpers/eval.rb +4 -6
- data/lib/byebug/helpers/file.rb +5 -1
- data/lib/byebug/helpers/parse.rb +7 -2
- data/lib/byebug/helpers/reflection.rb +1 -1
- data/lib/byebug/helpers/var.rb +17 -1
- data/lib/byebug/history.rb +6 -6
- data/lib/byebug/interface.rb +1 -1
- data/lib/byebug/option_setter.rb +1 -1
- data/lib/byebug/settings/savefile.rb +2 -2
- data/lib/byebug/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 44cf64e7bdc187e8302b39d4b1dbf6c00fd27f4c19e01f6331414ee4eed05ab1
|
4
|
+
data.tar.gz: 9ddbee412b023e83f7468749cd945ef93d2dddaf7152d477218d1b326db52b20
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d6540614504a2b8703ae3309cfb01293d442e22166db4d3164452e3e17a2c1202fae273acd5d386c46350c036164e66fe31631652c29aa44db3f02bdff3e709
|
7
|
+
data.tar.gz: ae3fdff0ece10e3de0819cce3321de2dcab9c12ec09f2725caa4ccaf69b26970aec0e0e44854f293e9c6a724ffa8bc25aabd4800e5888eba76f21c3717dc208f
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,28 @@
|
|
2
2
|
|
3
3
|
## [Unreleased]
|
4
4
|
|
5
|
+
## [12.0.0] - 2025-03-25
|
6
|
+
|
7
|
+
### Changed
|
8
|
+
|
9
|
+
* [#690](https://github.com/deivid-rodriguez/byebug/pull/690): `break` without any arguments now sets a breakpoint on the current line, just like `gdb` ([@sergioro9].
|
10
|
+
|
11
|
+
### Fixed
|
12
|
+
|
13
|
+
* [#741](https://github.com/deivid-rodriguez/byebug/pull/741): Small consistency issues in help messages.
|
14
|
+
* [#743](https://github.com/deivid-rodriguez/byebug/pull/743): `untracevar` command crashing when giving a non existent global variable.
|
15
|
+
* [#744](https://github.com/deivid-rodriguez/byebug/pull/744): Another punctuation tweak in `enable breakpoints` help message.
|
16
|
+
* [#736](https://github.com/deivid-rodriguez/byebug/pull/736): Skip warning about `$SAFE` global variable on ruby 2.7 when listing global variables.
|
17
|
+
|
18
|
+
### Added
|
19
|
+
|
20
|
+
* [#847](https://github.com/deivid-rodriguez/byebug/pull/847) and [#850](https://github.com/deivid-rodriguez/byebug/pull/850): Support for MRI 3.1, 3.2, and 3.3 ([@marshall-lee]).
|
21
|
+
* [#688](https://github.com/deivid-rodriguez/byebug/pull/688): `where` command now receives an optional numeric argument `<n>` to print the nth first frames ([@sergioro9].
|
22
|
+
|
23
|
+
### Removed
|
24
|
+
|
25
|
+
* Support for MRI 2.4, 2.5, 2.6, 2.7, and 3.0. Byebug no longer installs on this platform.
|
26
|
+
|
5
27
|
## [11.1.3] - 2020-04-23
|
6
28
|
|
7
29
|
### Fixed
|
@@ -821,6 +843,7 @@
|
|
821
843
|
* Initial release.
|
822
844
|
|
823
845
|
[Unreleased]: https://github.com/deivid-rodriguez/byebug/compare/v11.1.3...HEAD
|
846
|
+
[12.0.0]: https://github.com/deivid-rodriguez/byebug/compare/v11.1.3...v12.0.0
|
824
847
|
[11.1.3]: https://github.com/deivid-rodriguez/byebug/compare/v11.1.2...v11.1.3
|
825
848
|
[11.1.2]: https://github.com/deivid-rodriguez/byebug/compare/v11.1.1...v11.1.2
|
826
849
|
[11.1.1]: https://github.com/deivid-rodriguez/byebug/compare/v11.1.0...v11.1.1
|
@@ -919,10 +942,12 @@
|
|
919
942
|
[@k0kubun]: https://github.com/k0kubun
|
920
943
|
[@ko1]: https://github.com/ko1
|
921
944
|
[@luislavena]: https://github.com/luislavena
|
945
|
+
[@marshall-lee]: https://github.com/marshall-lee
|
922
946
|
[@mrkn]: https://github.com/mrkn
|
923
947
|
[@nobu]: https://github.com/nobu
|
924
948
|
[@Olgagr]: https://github.com/Olgagr
|
925
949
|
[@sethk]: https://github.com/sethk
|
950
|
+
[@sergioro9]: https://github.com/sergioro9
|
926
951
|
[@shuky19]: https://github.com/shuky19
|
927
952
|
[@tacnoman]: https://github.com/tacnoman
|
928
953
|
[@terceiro]: https://github.com/terceiro
|
data/GUIDE.md
CHANGED
@@ -26,7 +26,7 @@ puts t
|
|
26
26
|
|
27
27
|
Let's debug it.
|
28
28
|
|
29
|
-
```
|
29
|
+
```console
|
30
30
|
$ byebug /path/to/triangle.rb
|
31
31
|
|
32
32
|
[1, 10] in /path/to/triangle.rb
|
@@ -62,7 +62,7 @@ accordingly so that only actual real lines of code are displayed.
|
|
62
62
|
|
63
63
|
Now let us step through the program.
|
64
64
|
|
65
|
-
```
|
65
|
+
```console
|
66
66
|
(byebug) step
|
67
67
|
|
68
68
|
[5, 14] in /path/to/triangle.rb
|
@@ -118,7 +118,7 @@ previously. However after issuing another `step` command we see that the value
|
|
118
118
|
is 0 as expected. If every time we stop we want to see the value of `tri` to see
|
119
119
|
how things are going, there is a better way by setting a display expression:
|
120
120
|
|
121
|
-
```
|
121
|
+
```console
|
122
122
|
(byebug) display tri
|
123
123
|
1: tri = 0
|
124
124
|
```
|
@@ -127,7 +127,7 @@ Now let us run the program until right before we return from the function. We'll
|
|
127
127
|
want to see which lines get run, so we turn on _line tracing_. If we don't want
|
128
128
|
whole paths to be displayed when tracing, we can turn on _basename_.
|
129
129
|
|
130
|
-
```
|
130
|
+
```console
|
131
131
|
(byebug) set linetrace
|
132
132
|
linetrace is on
|
133
133
|
(byebug) set basename
|
@@ -207,7 +207,7 @@ Recall in the first section it was stated that before the `def` is run, the
|
|
207
207
|
method it names is undefined. Let's check that out. First let's see what
|
208
208
|
private methods we can call before running `def hanoi`.
|
209
209
|
|
210
|
-
```
|
210
|
+
```console
|
211
211
|
$ byebug path/to/hanoi.rb
|
212
212
|
|
213
213
|
1: #
|
@@ -317,7 +317,7 @@ is stopped.
|
|
317
317
|
|
318
318
|
Now let's see what happens after stepping:
|
319
319
|
|
320
|
-
```
|
320
|
+
```console
|
321
321
|
(byebug) step
|
322
322
|
|
323
323
|
[5, 14] in /path/to/hanoi.rb
|
@@ -338,7 +338,7 @@ true
|
|
338
338
|
|
339
339
|
Okay, lets go on and talk about program arguments.
|
340
340
|
|
341
|
-
```
|
341
|
+
```console
|
342
342
|
(byebug) $ARGV
|
343
343
|
[]
|
344
344
|
```
|
@@ -346,7 +346,7 @@ Okay, lets go on and talk about program arguments.
|
|
346
346
|
Oops. We forgot to specify any parameters to this program. Let's try again. We
|
347
347
|
can use the `restart` command here.
|
348
348
|
|
349
|
-
```
|
349
|
+
```console
|
350
350
|
(byebug) restart 3
|
351
351
|
Re exec'ing:
|
352
352
|
/path/to/exe/byebug /path/to/hanoi.rb 3
|
@@ -445,7 +445,7 @@ trace (see [callstyle]()).
|
|
445
445
|
|
446
446
|
Now let's move around the callstack.
|
447
447
|
|
448
|
-
```
|
448
|
+
```console
|
449
449
|
(byebug) undisplay
|
450
450
|
Clear all expressions? (y/n) y
|
451
451
|
(byebug) n_args
|
@@ -554,7 +554,7 @@ def test_basic
|
|
554
554
|
|
555
555
|
Now we run the program, requiring `byebug`
|
556
556
|
|
557
|
-
```
|
557
|
+
```console
|
558
558
|
$ ruby -rbyebug test_triangle.rb
|
559
559
|
Run options: --seed 31679
|
560
560
|
|
@@ -579,7 +579,7 @@ list `solutions`.
|
|
579
579
|
|
580
580
|
Now let's see where we are...
|
581
581
|
|
582
|
-
```
|
582
|
+
```console
|
583
583
|
(byebug) set nofullpath
|
584
584
|
Displaying frame's full file names is off.
|
585
585
|
(byebug) bt
|
@@ -671,7 +671,7 @@ SievePrime.new.next_prime do |prime|
|
|
671
671
|
end
|
672
672
|
```
|
673
673
|
|
674
|
-
```
|
674
|
+
```console
|
675
675
|
$ byebug primes.rb
|
676
676
|
[1, 10] in /path/to/primes.rb
|
677
677
|
1: #
|
@@ -874,7 +874,7 @@ We instantiate a new company with an initial task and after running that
|
|
874
874
|
company we expect the result to be printed in the screen, but it is not. Lets
|
875
875
|
debug our sample program:
|
876
876
|
|
877
|
-
```
|
877
|
+
```console
|
878
878
|
[1, 10] in /path/to/company.rb
|
879
879
|
=> 1: class Company
|
880
880
|
2: def initialize(task)
|
@@ -926,7 +926,7 @@ can then check that the threads are there using the `thread list` command. Now
|
|
926
926
|
we want to debug both of this threads to check what's happening and look for the
|
927
927
|
bug.
|
928
928
|
|
929
|
-
```
|
929
|
+
```console
|
930
930
|
(byebug) th switch 3
|
931
931
|
|
932
932
|
[5, 14] in /path/to/company.rb
|
@@ -961,7 +961,7 @@ and don't want the program to finish while we are debugging. Notice that stopped
|
|
961
961
|
threads are marked with the "$" symbol whereas the current thread is marked with
|
962
962
|
the "+" symbol.
|
963
963
|
|
964
|
-
```
|
964
|
+
```console
|
965
965
|
(byebug) s
|
966
966
|
|
967
967
|
[17, 26] in /path/to/company.rb
|
@@ -1061,7 +1061,7 @@ Everything seems fine in this thread. The first iteration the employee will do
|
|
1061
1061
|
his job, and after that it will just check for new tasks and sleep. Let's debug
|
1062
1062
|
the manager task now:
|
1063
1063
|
|
1064
|
-
```
|
1064
|
+
```console
|
1065
1065
|
(byebug) th resume 2
|
1066
1066
|
2 #<Thread:0x000000019892d8@/path/to/company.rb:12 run> /path/to/company.rb:12
|
1067
1067
|
(byebug) th switch 2
|
@@ -1088,7 +1088,7 @@ run a sleeping thread.
|
|
1088
1088
|
|
1089
1089
|
Now we can investigate the problem in the employer's side:
|
1090
1090
|
|
1091
|
-
```
|
1091
|
+
```console
|
1092
1092
|
(byebug) s
|
1093
1093
|
[30, 39] in /path/to/company.rb
|
1094
1094
|
30:
|
@@ -1173,7 +1173,7 @@ If you don't need to pass dash options to your program, which might be confused
|
|
1173
1173
|
with byebug options, then you don't need to add the `--`. To get a brief list of
|
1174
1174
|
options and descriptions, use the `--help` option.
|
1175
1175
|
|
1176
|
-
```
|
1176
|
+
```console
|
1177
1177
|
$ byebug --help
|
1178
1178
|
|
1179
1179
|
byebug 3.5.1
|
@@ -1181,7 +1181,7 @@ $ byebug --help
|
|
1181
1181
|
Usage: byebug [options] <script.rb> -- <script.rb parameters>
|
1182
1182
|
|
1183
1183
|
-d, --debug Set $DEBUG=true
|
1184
|
-
-I, --include list Add
|
1184
|
+
-I, --include list Add paths to $LOAD_PATH
|
1185
1185
|
-m, --[no-]post-mortem Use post-mortem mode
|
1186
1186
|
-q, --[no-]quit Quit when script finishes
|
1187
1187
|
-x, --[no-]rc Run byebug initialization file
|
@@ -1241,7 +1241,7 @@ Turns on line tracing. Running `byebug --trace <rubyscript>.rb` is pretty much
|
|
1241
1241
|
like running `ruby -rtracer <rubyscript>.rb`. If all you want to do however is
|
1242
1242
|
get a line trace, `tracer` is most likely faster than `byebug`.
|
1243
1243
|
|
1244
|
-
```
|
1244
|
+
```console
|
1245
1245
|
$ time byebug --trace --no-stop hanoi.rb > /dev/null
|
1246
1246
|
|
1247
1247
|
real 0m0.743s
|
@@ -1354,9 +1354,9 @@ program that you want to debug (In Rails, the
|
|
1354
1354
|
`config/environments/development.rb` could be a good candidate).
|
1355
1355
|
|
1356
1356
|
```ruby
|
1357
|
-
|
1358
|
-
|
1359
|
-
|
1357
|
+
require "byebug/core"
|
1358
|
+
Byebug.wait_connection = true
|
1359
|
+
Byebug.start_server("localhost", <port>)
|
1360
1360
|
```
|
1361
1361
|
|
1362
1362
|
Once this piece gets executed, you can connect to the remote debugger from your
|
@@ -1366,9 +1366,9 @@ Next, at a place of program execution which gets run just before the code you
|
|
1366
1366
|
want to debug, add a call to `byebug` as was done without remote execution:
|
1367
1367
|
|
1368
1368
|
```ruby
|
1369
|
-
|
1370
|
-
|
1371
|
-
|
1369
|
+
# work, work, work...
|
1370
|
+
byebug
|
1371
|
+
some ruby code # byebug will stop before this line is run
|
1372
1372
|
```
|
1373
1373
|
|
1374
1374
|
## Byebug Command Reference
|
@@ -1388,7 +1388,7 @@ with a backslash.
|
|
1388
1388
|
For example, you might want to enter the following code to compute the 5th
|
1389
1389
|
Fibonacci number.
|
1390
1390
|
|
1391
|
-
```
|
1391
|
+
```console
|
1392
1392
|
(byebug) fib1=0; fib2=1; 5.times {|temp| temp=fib1; fib1=fib2; fib2 += temp }
|
1393
1393
|
0
|
1394
1394
|
1
|
@@ -1438,7 +1438,7 @@ Once inside `byebug` you can always ask it for information on its commands using
|
|
1438
1438
|
the `help` command. You can use `help` (abbreviated `h`) with no arguments to
|
1439
1439
|
display a short list of named classes of commands
|
1440
1440
|
|
1441
|
-
```
|
1441
|
+
```console
|
1442
1442
|
(byebug) help
|
1443
1443
|
|
1444
1444
|
break -- Sets breakpoints in the source code
|
@@ -1483,7 +1483,7 @@ display a short list of named classes of commands
|
|
1483
1483
|
|
1484
1484
|
With a command name, `help` displays information on how to use the command.
|
1485
1485
|
|
1486
|
-
```
|
1486
|
+
```console
|
1487
1487
|
(byebug) help list
|
1488
1488
|
|
1489
1489
|
l[ist][[-=]][ nn-mm]
|
@@ -1511,7 +1511,7 @@ as `help info breakpoints`.
|
|
1511
1511
|
|
1512
1512
|
Some examples follow.
|
1513
1513
|
|
1514
|
-
```
|
1514
|
+
```console
|
1515
1515
|
(byebug) help info
|
1516
1516
|
info[ subcommand]
|
1517
1517
|
|
@@ -1530,14 +1530,14 @@ info line -- Line number and filename of current position in source file
|
|
1530
1530
|
info program -- Execution status of the program
|
1531
1531
|
```
|
1532
1532
|
|
1533
|
-
```
|
1533
|
+
```console
|
1534
1534
|
(byebug) help info breakpoints
|
1535
1535
|
Status of user-settable breakpoints.
|
1536
1536
|
Without argument, list info about all breakpoints.
|
1537
1537
|
With an integer argument, list info on that breakpoint.
|
1538
1538
|
```
|
1539
1539
|
|
1540
|
-
```
|
1540
|
+
```console
|
1541
1541
|
(byebug) help info b
|
1542
1542
|
Status of user-settable breakpoints.
|
1543
1543
|
Without argument, list info about all breakpoints.
|
@@ -1582,7 +1582,7 @@ printed if line tracing is enabled. Each expression added to the list is given a
|
|
1582
1582
|
number to identify it; to remove an expression from the list, you specify that
|
1583
1583
|
number. The automatic display looks like this:
|
1584
1584
|
|
1585
|
-
```
|
1585
|
+
```console
|
1586
1586
|
(byebug) display n
|
1587
1587
|
1: n = 3
|
1588
1588
|
```
|
@@ -1591,7 +1591,7 @@ This display shows item numbers, expressions and their current values. If the
|
|
1591
1591
|
expression is undefined or illegal the expression will be printed but no value
|
1592
1592
|
will appear.
|
1593
1593
|
|
1594
|
-
```
|
1594
|
+
```console
|
1595
1595
|
(byebug) display undefined_variable
|
1596
1596
|
2: undefined_variable =
|
1597
1597
|
(byebug) display 1/0
|
@@ -1631,7 +1631,7 @@ program. If you issue a `list` without location information, the default
|
|
1631
1631
|
location used is the current line rather than the current position that may have
|
1632
1632
|
got updated via a prior `list` command.
|
1633
1633
|
|
1634
|
-
```
|
1634
|
+
```console
|
1635
1635
|
$ byebug triangle.rb
|
1636
1636
|
[1, 10] in /path/to/triangle.rb
|
1637
1637
|
1: # Compute the n'th triangle number, the hard way: triangle(n) == (n*(n+1))/2
|
@@ -1712,7 +1712,7 @@ You can customize `byebug` to use any editor you want by using the `EDITOR`
|
|
1712
1712
|
environment variable. The only restriction is that your editor (say `ex`) recognizes
|
1713
1713
|
the following command-line syntax:
|
1714
1714
|
|
1715
|
-
```
|
1715
|
+
```bash
|
1716
1716
|
ex +nnn file
|
1717
1717
|
```
|
1718
1718
|
|
@@ -1784,7 +1784,7 @@ One such method is `each`. They are marked differently in the call stack to
|
|
1784
1784
|
indicate that we cannot switch to those frames. This is because they have no
|
1785
1785
|
source code in Ruby, so we can not debug them using Byebug.
|
1786
1786
|
|
1787
|
-
```
|
1787
|
+
```console
|
1788
1788
|
(byebug) where
|
1789
1789
|
--> #0 Object.gcd(a#Fixnum, b#Fixnum) at line gcd.rb:6
|
1790
1790
|
#1 at line gcd.rb:19
|
data/README.md
CHANGED
@@ -41,9 +41,7 @@ more][Tidelift for enterprise].
|
|
41
41
|
|
42
42
|
## Requirements
|
43
43
|
|
44
|
-
* _Required_: MRI
|
45
|
-
* _Recommended_: MRI 2.6.4 or higher (MRI 2.6.0 to 2.6.3 contain a regression
|
46
|
-
causing unbalanced call/return events in some cases, breaking the `next` command).
|
44
|
+
* _Required_: MRI 3.1.0 or higher.
|
47
45
|
|
48
46
|
## Install
|
49
47
|
|
data/ext/byebug/breakpoint.c
CHANGED
@@ -128,6 +128,13 @@ brkpt_set_hit_condition(VALUE self, VALUE value)
|
|
128
128
|
ID id_value;
|
129
129
|
|
130
130
|
Data_Get_Struct(self, breakpoint_t, breakpoint);
|
131
|
+
|
132
|
+
if (NIL_P(value))
|
133
|
+
{
|
134
|
+
breakpoint->hit_condition = HIT_COND_NONE;
|
135
|
+
return value;
|
136
|
+
}
|
137
|
+
|
131
138
|
id_value = rb_to_id(value);
|
132
139
|
|
133
140
|
if (rb_intern("greater_or_equal") == id_value || rb_intern("ge") == id_value)
|
@@ -363,20 +370,17 @@ check_breakpoint_by_hit_condition(VALUE rb_breakpoint)
|
|
363
370
|
{
|
364
371
|
case HIT_COND_NONE:
|
365
372
|
return 1;
|
366
|
-
case HIT_COND_GE:
|
367
|
-
{
|
373
|
+
case HIT_COND_GE: {
|
368
374
|
if (breakpoint->hit_count >= breakpoint->hit_value)
|
369
375
|
return 1;
|
370
376
|
break;
|
371
377
|
}
|
372
|
-
case HIT_COND_EQ:
|
373
|
-
{
|
378
|
+
case HIT_COND_EQ: {
|
374
379
|
if (breakpoint->hit_count == breakpoint->hit_value)
|
375
380
|
return 1;
|
376
381
|
break;
|
377
382
|
}
|
378
|
-
case HIT_COND_MOD:
|
379
|
-
{
|
383
|
+
case HIT_COND_MOD: {
|
380
384
|
if (breakpoint->hit_count % breakpoint->hit_value == 0)
|
381
385
|
return 1;
|
382
386
|
break;
|
data/ext/byebug/byebug.c
CHANGED
@@ -136,26 +136,32 @@ cleanup(debug_context_t *dc)
|
|
136
136
|
|
137
137
|
#define EVENT_TEARDOWN cleanup(dc);
|
138
138
|
|
139
|
-
#define EVENT_SETUP
|
140
|
-
debug_context_t *dc;
|
141
|
-
VALUE context;
|
142
|
-
rb_trace_arg_t *trace_arg;
|
143
|
-
|
144
|
-
UNUSED(data);
|
145
|
-
|
146
|
-
if (!is_living_thread(rb_thread_current()))
|
147
|
-
return;
|
148
|
-
|
149
|
-
thread_context_lookup(rb_thread_current(), &context);
|
150
|
-
Data_Get_Struct(context, debug_context_t, dc);
|
151
|
-
|
152
|
-
trace_arg = rb_tracearg_from_tracepoint(trace_point);
|
153
|
-
if (verbose == Qtrue)
|
154
|
-
trace_print(trace_arg, dc, 0, 0);
|
155
|
-
|
156
|
-
if (CTX_FL_TEST(dc, CTX_FL_IGNORE))
|
157
|
-
return;
|
158
|
-
|
139
|
+
#define EVENT_SETUP \
|
140
|
+
debug_context_t *dc; \
|
141
|
+
VALUE context; \
|
142
|
+
rb_trace_arg_t *trace_arg; \
|
143
|
+
\
|
144
|
+
UNUSED(data); \
|
145
|
+
\
|
146
|
+
if (!is_living_thread(rb_thread_current())) \
|
147
|
+
return; \
|
148
|
+
\
|
149
|
+
thread_context_lookup(rb_thread_current(), &context); \
|
150
|
+
Data_Get_Struct(context, debug_context_t, dc); \
|
151
|
+
\
|
152
|
+
trace_arg = rb_tracearg_from_tracepoint(trace_point); \
|
153
|
+
if (verbose == Qtrue) \
|
154
|
+
trace_print(trace_arg, dc, 0, 0); \
|
155
|
+
\
|
156
|
+
if (CTX_FL_TEST(dc, CTX_FL_IGNORE)) \
|
157
|
+
return; \
|
158
|
+
\
|
159
|
+
VALUE rb_path = rb_tracearg_path(trace_arg); \
|
160
|
+
const char *path = NIL_P(rb_path) ? "" : RSTRING_PTR(rb_path); \
|
161
|
+
\
|
162
|
+
if (!strncmp(path, "<internal:", strlen("<internal:"))) \
|
163
|
+
return; \
|
164
|
+
\
|
159
165
|
acquire_lock(dc);
|
160
166
|
|
161
167
|
|
@@ -854,7 +860,7 @@ Add_catchpoint(VALUE self, VALUE value)
|
|
854
860
|
}
|
855
861
|
|
856
862
|
/*
|
857
|
-
* Document-
|
863
|
+
* Document-module: Byebug
|
858
864
|
*
|
859
865
|
* == Summary
|
860
866
|
*
|
data/ext/byebug/context.c
CHANGED
@@ -658,6 +658,7 @@ void
|
|
658
658
|
Init_byebug_context(VALUE mByebug)
|
659
659
|
{
|
660
660
|
cContext = rb_define_class_under(mByebug, "Context", rb_cObject);
|
661
|
+
rb_undef_alloc_func(cContext);
|
661
662
|
|
662
663
|
rb_define_method(cContext, "backtrace", Context_backtrace, 0);
|
663
664
|
rb_define_method(cContext, "dead?", Context_dead, 0);
|
data/ext/byebug/threads.c
CHANGED
@@ -180,8 +180,16 @@ release_lock(void)
|
|
180
180
|
static VALUE
|
181
181
|
Unlock(VALUE self)
|
182
182
|
{
|
183
|
+
debug_context_t *dc;
|
184
|
+
VALUE context;
|
185
|
+
|
183
186
|
UNUSED(self);
|
184
187
|
|
188
|
+
thread_context_lookup(rb_thread_current(), &context);
|
189
|
+
Data_Get_Struct(context, debug_context_t, dc);
|
190
|
+
|
191
|
+
CTX_FL_SET(dc, CTX_FL_IGNORE);
|
192
|
+
|
185
193
|
release_lock();
|
186
194
|
|
187
195
|
return locker;
|
@@ -209,6 +217,8 @@ Lock(VALUE self)
|
|
209
217
|
|
210
218
|
acquire_lock(dc);
|
211
219
|
|
220
|
+
CTX_FL_UNSET(dc, CTX_FL_IGNORE);
|
221
|
+
|
212
222
|
return locker;
|
213
223
|
}
|
214
224
|
|
@@ -224,6 +234,7 @@ void
|
|
224
234
|
Init_threads_table(VALUE mByebug)
|
225
235
|
{
|
226
236
|
cThreadsTable = rb_define_class_under(mByebug, "ThreadsTable", rb_cObject);
|
237
|
+
rb_undef_alloc_func(cThreadsTable);
|
227
238
|
|
228
239
|
rb_define_module_function(mByebug, "unlock", Unlock, 0);
|
229
240
|
rb_define_module_function(mByebug, "lock", Lock, 0);
|
data/lib/byebug/breakpoint.rb
CHANGED
@@ -53,11 +53,7 @@ module Byebug
|
|
53
53
|
name = "#{Time.new.to_i}_#{rand(2**31)}"
|
54
54
|
iseq = RubyVM::InstructionSequence.compile(File.read(filename), name)
|
55
55
|
|
56
|
-
|
57
|
-
potential_lines_with_trace_points(iseq, {})
|
58
|
-
else
|
59
|
-
potential_lines_without_trace_points(iseq, {})
|
60
|
-
end
|
56
|
+
potential_lines_with_trace_points(iseq, {})
|
61
57
|
end
|
62
58
|
|
63
59
|
def self.potential_lines_with_trace_points(iseq, lines)
|
@@ -71,19 +67,6 @@ module Byebug
|
|
71
67
|
|
72
68
|
private_class_method :potential_lines_with_trace_points
|
73
69
|
|
74
|
-
def self.potential_lines_without_trace_points(iseq, lines)
|
75
|
-
iseq.disasm.each_line do |line|
|
76
|
-
res = /^\d+ (?<insn>\w+)\s+.+\(\s*(?<lineno>\d+)\)$/.match(line)
|
77
|
-
next unless res && res[:insn] == "trace"
|
78
|
-
|
79
|
-
lines[res[:lineno].to_i] = true
|
80
|
-
end
|
81
|
-
|
82
|
-
lines.keys
|
83
|
-
end
|
84
|
-
|
85
|
-
private_class_method :potential_lines_without_trace_points
|
86
|
-
|
87
70
|
#
|
88
71
|
# Returns true if a breakpoint could be set in line number +lineno+ in file
|
89
72
|
# name +filename.
|
@@ -23,13 +23,15 @@ module Byebug
|
|
23
23
|
|
24
24
|
def self.description
|
25
25
|
<<-DESCRIPTION
|
26
|
-
b[reak] [<file>:]<line> [if <expr>]
|
26
|
+
b[reak] [[<file>:]<line> [if <expr>]]
|
27
27
|
b[reak] [<module>::...]<class>(.|#)<method> [if <expr>]
|
28
28
|
|
29
|
+
#{short_description}
|
30
|
+
|
29
31
|
They can be specified by line or method and an expression can be added
|
30
32
|
for conditionally enabled breakpoints.
|
31
|
-
|
32
|
-
|
33
|
+
for conditionally enabled breakpoints. Without arguments create a
|
34
|
+
a breakpoint in the current line.
|
33
35
|
DESCRIPTION
|
34
36
|
end
|
35
37
|
|
@@ -38,9 +40,9 @@ module Byebug
|
|
38
40
|
end
|
39
41
|
|
40
42
|
def execute
|
41
|
-
|
43
|
+
b = line_breakpoint(frame.line.to_s) unless @match[1]
|
42
44
|
|
43
|
-
b
|
45
|
+
b ||= line_breakpoint(@match[1]) || method_breakpoint(@match[1])
|
44
46
|
return errmsg(pr("break.errors.location")) unless b
|
45
47
|
|
46
48
|
return puts(pr("break.created", id: b.id, file: b.source, line: b.pos)) if syntax_valid?(@match[2])
|
data/lib/byebug/commands/help.rb
CHANGED
data/lib/byebug/commands/info.rb
CHANGED
data/lib/byebug/commands/set.rb
CHANGED
data/lib/byebug/commands/step.rb
CHANGED
@@ -7,7 +7,7 @@ module Byebug
|
|
7
7
|
#
|
8
8
|
# Implements the step functionality.
|
9
9
|
#
|
10
|
-
# Allows the user the continue execution until the next instruction,
|
10
|
+
# Allows the user the continue execution until the next instruction, possibly
|
11
11
|
# in a different frame. Use step to step into method calls or blocks.
|
12
12
|
#
|
13
13
|
class StepCommand < Command
|
@@ -20,7 +20,7 @@ module Byebug
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def self.short_description
|
23
|
-
"Stops tracing a global variable"
|
23
|
+
"Stops tracing a global variable."
|
24
24
|
end
|
25
25
|
|
26
26
|
def execute
|
@@ -29,7 +29,7 @@ module Byebug
|
|
29
29
|
untrace_var(:"#{var}")
|
30
30
|
puts pr("trace.messages.undo", var: var)
|
31
31
|
else
|
32
|
-
errmsg pr("trace.errors.
|
32
|
+
errmsg pr("trace.errors.var_is_not_global", name: var)
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
@@ -14,12 +14,12 @@ module Byebug
|
|
14
14
|
self.allow_in_post_mortem = true
|
15
15
|
|
16
16
|
def self.regexp
|
17
|
-
/^\s* (?:w(?:here)?|bt|backtrace) \s*$/x
|
17
|
+
/^\s* (?:w(?:here)?|bt|backtrace) (?:\s+(\S+))? \s*$/x
|
18
18
|
end
|
19
19
|
|
20
20
|
def self.description
|
21
21
|
<<-DESCRIPTION
|
22
|
-
w[here]|bt|backtrace
|
22
|
+
w[here]|bt|backtrace[ maximum-frame]
|
23
23
|
|
24
24
|
#{short_description}
|
25
25
|
|
@@ -29,6 +29,10 @@ module Byebug
|
|
29
29
|
The position of the current frame is marked with -->. C-frames hang
|
30
30
|
from their most immediate Ruby frame to indicate that they are not
|
31
31
|
navigable.
|
32
|
+
|
33
|
+
Without an argument, the command prints all the frames. With an argument,
|
34
|
+
the command prints the nth first frames, where n is the largest between
|
35
|
+
the argument or the maximum stack frame.
|
32
36
|
DESCRIPTION
|
33
37
|
end
|
34
38
|
|
@@ -43,7 +47,14 @@ module Byebug
|
|
43
47
|
private
|
44
48
|
|
45
49
|
def print_backtrace
|
46
|
-
|
50
|
+
max_frame =
|
51
|
+
if @match[1] && @match[1].to_i <= context.stack_size
|
52
|
+
@match[1].to_i
|
53
|
+
else
|
54
|
+
context.stack_size
|
55
|
+
end
|
56
|
+
|
57
|
+
bt = prc("frame.line", (0...max_frame)) do |_, index|
|
47
58
|
Frame.new(context, index).to_hash
|
48
59
|
end
|
49
60
|
|
data/lib/byebug/helpers/eval.rb
CHANGED
@@ -33,7 +33,7 @@ module Byebug
|
|
33
33
|
|
34
34
|
#
|
35
35
|
# Evaluates a string containing Ruby code in a specific binding,
|
36
|
-
# returning nil
|
36
|
+
# returning nil if an error happens.
|
37
37
|
#
|
38
38
|
def silent_eval(str, binding = frame._binding)
|
39
39
|
safe_eval(str, binding) { |_e| nil }
|
@@ -88,14 +88,12 @@ module Byebug
|
|
88
88
|
# creating new threads won't be properly evaluated because new threads
|
89
89
|
# will get blocked by byebug's main thread.
|
90
90
|
#
|
91
|
-
def allowing_other_threads
|
91
|
+
def allowing_other_threads(&block)
|
92
92
|
Byebug.unlock
|
93
93
|
|
94
|
-
|
95
|
-
|
94
|
+
TracePoint.allow_reentry(&block)
|
95
|
+
ensure
|
96
96
|
Byebug.lock
|
97
|
-
|
98
|
-
res
|
99
97
|
end
|
100
98
|
|
101
99
|
#
|
data/lib/byebug/helpers/file.rb
CHANGED
@@ -56,7 +56,11 @@ module Byebug
|
|
56
56
|
# True for special files like -e, false otherwise
|
57
57
|
#
|
58
58
|
def virtual_file?(name)
|
59
|
-
|
59
|
+
if Gem.ruby_version >= Gem::Version.new("3.3.a")
|
60
|
+
["(irb)", "-e", "(byebug)"].include?(name) || name.start_with?("(eval ")
|
61
|
+
else
|
62
|
+
["(irb)", "-e", "(byebug)", "(eval)"].include?(name)
|
63
|
+
end
|
60
64
|
end
|
61
65
|
end
|
62
66
|
end
|
data/lib/byebug/helpers/parse.rb
CHANGED
@@ -35,13 +35,18 @@ module Byebug
|
|
35
35
|
def syntax_valid?(code)
|
36
36
|
return true unless code
|
37
37
|
|
38
|
-
|
39
|
-
|
38
|
+
if defined?(RubyVM::InstructionSequence.compile)
|
39
|
+
without_stderr do
|
40
40
|
RubyVM::InstructionSequence.compile(code)
|
41
41
|
true
|
42
42
|
rescue SyntaxError
|
43
43
|
false
|
44
44
|
end
|
45
|
+
else
|
46
|
+
require "ripper" unless defined?(Ripper)
|
47
|
+
without_stderr do
|
48
|
+
!Ripper.sexp(code).nil?
|
49
|
+
end
|
45
50
|
end
|
46
51
|
end
|
47
52
|
|
data/lib/byebug/helpers/var.rb
CHANGED
@@ -12,7 +12,23 @@ module Byebug
|
|
12
12
|
|
13
13
|
def var_list(ary, binding = context.frame._binding)
|
14
14
|
vars = ary.sort.map do |name|
|
15
|
-
|
15
|
+
code = name.to_s
|
16
|
+
|
17
|
+
if code == "$SAFE"
|
18
|
+
code = <<~RUBY
|
19
|
+
original_stderr = $stderr
|
20
|
+
|
21
|
+
begin
|
22
|
+
$stderr = StringIO.new
|
23
|
+
|
24
|
+
#{code}
|
25
|
+
ensure
|
26
|
+
$stderr = original_stderr
|
27
|
+
end
|
28
|
+
RUBY
|
29
|
+
end
|
30
|
+
|
31
|
+
[name, safe_inspect(silent_eval(code, binding))]
|
16
32
|
end
|
17
33
|
|
18
34
|
puts prv(vars, "instance")
|
data/lib/byebug/history.rb
CHANGED
@@ -17,10 +17,10 @@ module Byebug
|
|
17
17
|
# Handles byebug's history of commands.
|
18
18
|
#
|
19
19
|
class History
|
20
|
-
|
20
|
+
attr_reader :size
|
21
21
|
|
22
22
|
def initialize
|
23
|
-
|
23
|
+
@size = 0
|
24
24
|
end
|
25
25
|
|
26
26
|
#
|
@@ -65,7 +65,7 @@ module Byebug
|
|
65
65
|
def push(cmd)
|
66
66
|
return if ignore?(cmd)
|
67
67
|
|
68
|
-
|
68
|
+
@size += 1
|
69
69
|
Readline::HISTORY.push(cmd)
|
70
70
|
end
|
71
71
|
|
@@ -73,7 +73,7 @@ module Byebug
|
|
73
73
|
# Removes a command from Readline's history.
|
74
74
|
#
|
75
75
|
def pop
|
76
|
-
|
76
|
+
@size -= 1
|
77
77
|
Readline::HISTORY.pop
|
78
78
|
end
|
79
79
|
|
@@ -103,7 +103,7 @@ module Byebug
|
|
103
103
|
# Never more than Setting[:histsize].
|
104
104
|
#
|
105
105
|
def default_max_size
|
106
|
-
[Setting[:histsize],
|
106
|
+
[Setting[:histsize], size].min
|
107
107
|
end
|
108
108
|
|
109
109
|
#
|
@@ -112,7 +112,7 @@ module Byebug
|
|
112
112
|
# The only bound here is not showing more items than available.
|
113
113
|
#
|
114
114
|
def specific_max_size(number)
|
115
|
-
[
|
115
|
+
[size, number].min
|
116
116
|
end
|
117
117
|
|
118
118
|
#
|
data/lib/byebug/interface.rb
CHANGED
data/lib/byebug/option_setter.rb
CHANGED
@@ -4,7 +4,7 @@ require_relative "../setting"
|
|
4
4
|
|
5
5
|
module Byebug
|
6
6
|
#
|
7
|
-
# Setting to customize the file where byebug's
|
7
|
+
# Setting to customize the file where byebug's settings are saved.
|
8
8
|
#
|
9
9
|
class SavefileSetting < Setting
|
10
10
|
DEFAULT = File.expand_path("#{ENV['HOME'] || '.'}/.byebug_save")
|
@@ -14,7 +14,7 @@ module Byebug
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def to_s
|
17
|
-
"The
|
17
|
+
"The settings file is #{value}\n"
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
data/lib/byebug/version.rb
CHANGED
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: byebug
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 12.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Rodriguez
|
8
8
|
- Kent Sibilev
|
9
9
|
- Mark Moseley
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2025-03-25 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|
@@ -177,7 +177,7 @@ homepage: https://github.com/deivid-rodriguez/byebug
|
|
177
177
|
licenses:
|
178
178
|
- BSD-2-Clause
|
179
179
|
metadata: {}
|
180
|
-
post_install_message:
|
180
|
+
post_install_message:
|
181
181
|
rdoc_options: []
|
182
182
|
require_paths:
|
183
183
|
- lib
|
@@ -185,15 +185,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
185
185
|
requirements:
|
186
186
|
- - ">="
|
187
187
|
- !ruby/object:Gem::Version
|
188
|
-
version:
|
188
|
+
version: 3.1.0
|
189
189
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
190
190
|
requirements:
|
191
191
|
- - ">="
|
192
192
|
- !ruby/object:Gem::Version
|
193
193
|
version: '0'
|
194
194
|
requirements: []
|
195
|
-
rubygems_version: 3.
|
196
|
-
signing_key:
|
195
|
+
rubygems_version: 3.5.22
|
196
|
+
signing_key:
|
197
197
|
specification_version: 4
|
198
198
|
summary: Ruby fast debugger - base + CLI
|
199
199
|
test_files: []
|