byebug 9.0.5 → 11.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +399 -264
  3. data/CONTRIBUTING.md +12 -19
  4. data/GUIDE.md +40 -26
  5. data/LICENSE +18 -18
  6. data/README.md +103 -74
  7. data/exe/byebug +6 -0
  8. data/ext/byebug/breakpoint.c +2 -2
  9. data/ext/byebug/byebug.c +26 -31
  10. data/ext/byebug/byebug.h +44 -28
  11. data/ext/byebug/context.c +45 -32
  12. data/ext/byebug/extconf.rb +7 -5
  13. data/ext/byebug/locker.c +4 -4
  14. data/ext/byebug/threads.c +12 -12
  15. data/lib/byebug/attacher.rb +18 -4
  16. data/lib/byebug/breakpoint.rb +26 -6
  17. data/lib/byebug/command.rb +20 -14
  18. data/lib/byebug/command_list.rb +3 -1
  19. data/lib/byebug/commands/break.rb +36 -22
  20. data/lib/byebug/commands/catch.rb +16 -18
  21. data/lib/byebug/commands/condition.rb +11 -11
  22. data/lib/byebug/commands/continue.rb +32 -12
  23. data/lib/byebug/commands/debug.rb +7 -5
  24. data/lib/byebug/commands/delete.rb +13 -11
  25. data/lib/byebug/commands/disable/breakpoints.rb +7 -5
  26. data/lib/byebug/commands/disable/display.rb +7 -5
  27. data/lib/byebug/commands/disable.rb +8 -6
  28. data/lib/byebug/commands/display.rb +11 -9
  29. data/lib/byebug/commands/down.rb +10 -8
  30. data/lib/byebug/commands/edit.rb +11 -8
  31. data/lib/byebug/commands/enable/breakpoints.rb +7 -5
  32. data/lib/byebug/commands/enable/display.rb +7 -5
  33. data/lib/byebug/commands/enable.rb +8 -6
  34. data/lib/byebug/commands/finish.rb +9 -7
  35. data/lib/byebug/commands/frame.rb +11 -9
  36. data/lib/byebug/commands/help.rb +7 -5
  37. data/lib/byebug/commands/history.rb +7 -5
  38. data/lib/byebug/commands/info/breakpoints.rb +18 -14
  39. data/lib/byebug/commands/info/display.rb +16 -9
  40. data/lib/byebug/commands/info/file.rb +13 -14
  41. data/lib/byebug/commands/info/line.rb +5 -3
  42. data/lib/byebug/commands/info/program.rb +8 -6
  43. data/lib/byebug/commands/info.rb +11 -9
  44. data/lib/byebug/commands/interrupt.rb +8 -4
  45. data/lib/byebug/commands/irb.rb +13 -12
  46. data/lib/byebug/commands/kill.rb +11 -11
  47. data/lib/byebug/commands/list.rb +41 -46
  48. data/lib/byebug/commands/method.rb +10 -8
  49. data/lib/byebug/commands/next.rb +8 -6
  50. data/lib/byebug/commands/pry.rb +10 -10
  51. data/lib/byebug/commands/quit.rb +10 -8
  52. data/lib/byebug/commands/restart.rb +30 -11
  53. data/lib/byebug/commands/save.rb +10 -8
  54. data/lib/byebug/commands/set.rb +13 -11
  55. data/lib/byebug/commands/show.rb +7 -5
  56. data/lib/byebug/commands/skip.rb +85 -0
  57. data/lib/byebug/commands/source.rb +7 -7
  58. data/lib/byebug/commands/step.rb +8 -6
  59. data/lib/byebug/commands/thread/current.rb +6 -4
  60. data/lib/byebug/commands/thread/list.rb +7 -5
  61. data/lib/byebug/commands/thread/resume.rb +7 -7
  62. data/lib/byebug/commands/thread/stop.rb +6 -4
  63. data/lib/byebug/commands/thread/switch.rb +6 -4
  64. data/lib/byebug/commands/thread.rb +11 -9
  65. data/lib/byebug/commands/tracevar.rb +10 -11
  66. data/lib/byebug/commands/undisplay.rb +12 -11
  67. data/lib/byebug/commands/untracevar.rb +8 -6
  68. data/lib/byebug/commands/up.rb +10 -8
  69. data/lib/byebug/commands/var/all.rb +7 -5
  70. data/lib/byebug/commands/var/args.rb +6 -4
  71. data/lib/byebug/commands/var/const.rb +9 -9
  72. data/lib/byebug/commands/var/global.rb +5 -3
  73. data/lib/byebug/commands/var/instance.rb +6 -4
  74. data/lib/byebug/commands/var/local.rb +6 -4
  75. data/lib/byebug/commands/var.rb +12 -10
  76. data/lib/byebug/commands/where.rb +9 -7
  77. data/lib/byebug/commands.rb +40 -37
  78. data/lib/byebug/context.rb +7 -5
  79. data/lib/byebug/core.rb +26 -25
  80. data/lib/byebug/errors.rb +4 -2
  81. data/lib/byebug/frame.rb +19 -22
  82. data/lib/byebug/helpers/bin.rb +47 -0
  83. data/lib/byebug/helpers/eval.rb +15 -13
  84. data/lib/byebug/helpers/file.rb +6 -4
  85. data/lib/byebug/helpers/frame.rb +7 -5
  86. data/lib/byebug/helpers/parse.rb +5 -5
  87. data/lib/byebug/helpers/path.rb +9 -11
  88. data/lib/byebug/helpers/reflection.rb +2 -0
  89. data/lib/byebug/helpers/string.rb +11 -2
  90. data/lib/byebug/helpers/thread.rb +10 -8
  91. data/lib/byebug/helpers/toggle.rb +28 -27
  92. data/lib/byebug/helpers/var.rb +9 -7
  93. data/lib/byebug/history.rb +20 -11
  94. data/lib/byebug/interface.rb +13 -11
  95. data/lib/byebug/interfaces/local_interface.rb +25 -7
  96. data/lib/byebug/interfaces/remote_interface.rb +21 -9
  97. data/lib/byebug/interfaces/script_interface.rb +4 -1
  98. data/lib/byebug/interfaces/test_interface.rb +5 -3
  99. data/lib/byebug/option_setter.rb +14 -12
  100. data/lib/byebug/printers/base.rb +10 -10
  101. data/lib/byebug/printers/plain.rb +9 -8
  102. data/lib/byebug/printers/texts/base.yml +7 -3
  103. data/lib/byebug/printers/texts/plain.yml +1 -1
  104. data/lib/byebug/processors/command_processor.rb +11 -12
  105. data/lib/byebug/processors/control_processor.rb +4 -6
  106. data/lib/byebug/processors/post_mortem_processor.rb +4 -2
  107. data/lib/byebug/processors/script_processor.rb +7 -3
  108. data/lib/byebug/remote/client.rb +57 -0
  109. data/lib/byebug/remote/server.rb +47 -0
  110. data/lib/byebug/remote.rb +46 -66
  111. data/lib/byebug/runner.rb +43 -49
  112. data/lib/byebug/setting.rb +11 -5
  113. data/lib/byebug/settings/autoirb.rb +7 -5
  114. data/lib/byebug/settings/autolist.rb +7 -5
  115. data/lib/byebug/settings/autopry.rb +7 -5
  116. data/lib/byebug/settings/autosave.rb +4 -2
  117. data/lib/byebug/settings/basename.rb +4 -2
  118. data/lib/byebug/settings/callstyle.rb +4 -3
  119. data/lib/byebug/settings/fullpath.rb +4 -2
  120. data/lib/byebug/settings/histfile.rb +5 -3
  121. data/lib/byebug/settings/histsize.rb +4 -2
  122. data/lib/byebug/settings/linetrace.rb +6 -4
  123. data/lib/byebug/settings/listsize.rb +4 -2
  124. data/lib/byebug/settings/post_mortem.rb +6 -4
  125. data/lib/byebug/settings/savefile.rb +4 -2
  126. data/lib/byebug/settings/stack_on_error.rb +4 -2
  127. data/lib/byebug/settings/width.rb +3 -1
  128. data/lib/byebug/source_file_formatter.rb +71 -0
  129. data/lib/byebug/subcommands.rb +6 -4
  130. data/lib/byebug/version.rb +2 -1
  131. data/lib/byebug.rb +3 -1
  132. metadata +22 -20
  133. data/bin/byebug +0 -7
data/CONTRIBUTING.md CHANGED
@@ -26,32 +26,25 @@ abide by its terms.
26
26
 
27
27
  ## Running the test suite
28
28
 
29
- * Make sure you compile the C-extension using `bundle exec rake compile`.
29
+ * Make sure you compile the C-extension using `bin/rake compile`.
30
30
  Otherwise you won't be able to use `byebug`.
31
- * Run the test suite using the default rake task (`bundle exec rake`). This
32
- task is composed of 2 subtasks: `bundle exec rake compile` &&
33
- `bundle exec rake test`.
31
+ * Run the test suite using the default rake task (`bin/rake`). This task is
32
+ composed of 3 subtasks: `bin/rake compile`, `bin/rake test` & `bin/rake lint`.
34
33
  * If you want to run specific tests, use the provided test runner, like so:
35
- * Specific test files. For example,
36
- `script/minitest_runner.rb test/commands/break_test.rb`
37
- * Specific test classes. For example,
38
- `script/minitest_runner.rb Byebug::BreakAtLinesTestCase`
34
+ * Specific test files. For example, `bin/minitest test/commands/break_test.rb`
35
+ * Specific test classes. For example, `bin/minitest BreakAtLinesTest`
39
36
  * Specific tests. For example,
40
- `script/minitest_runner.rb test_catch_removes_specific_catchpoint`
37
+ `bin/minitest test_catch_removes_specific_catchpoint`
41
38
  * Specific fully qualified tests. For example,
42
- `script/minitest_runner.rb
43
- BreakAtLinesTest#test_setting_breakpoint_sets_correct_fields`
39
+ `bin/minitest BreakAtLinesTest#test_setting_breakpoint_sets_correct_fields`
44
40
  * You can combine any of them and you will get the union of all filters. For
45
- example: `script/minitest_runner.rb Byebug::BreakAtLinesTestCase
41
+ example: `bin/minitest BreakAtLinesTest
46
42
  test_catch_removes_specific_catchpoint`
47
43
 
48
44
  ## Code style
49
45
 
50
- * Byebug uses [overcommit][] to enforce code style. Install the git hooks using
51
- `bundle exec overcommit --install`. They will review your changes before they
52
- are committed, checking they are consistent with the project's code style.
53
-
54
- [overcommit]: https://github.com/brigade/overcommit/
46
+ * Byebug uses several style checks to check code style consistent. You can run
47
+ those using `bin/rake lint`.
55
48
 
56
49
  ## Byebug as a C-extension
57
50
 
@@ -60,6 +53,6 @@ functionality is implemented in C (the interaction with the TracePoint API).
60
53
  The rest of the gem is implemented in Ruby. Normally you won't need to touch
61
54
  the C-extension, but it will obviously depended on the bug you're trying to fix
62
55
  or the feature you are willing to add. You can learn more about C-extensions
63
- [here](http://tenderlovemaking.com/2009/12/18/writing-ruby-c-extensions-part-1.html)
56
+ [here](https://tenderlovemaking.com/2009/12/18/writing-ruby-c-extensions-part-1.html)
64
57
  or
65
- [here](http://tenderlovemaking.com/2010/12/11/writing-ruby-c-extensions-part-2.html).
58
+ [here](https://tenderlovemaking.com/2010/12/11/writing-ruby-c-extensions-part-2.html).
data/GUIDE.md CHANGED
@@ -69,12 +69,12 @@ Now let us step through the program.
69
69
  5: tri = 0
70
70
  6:
71
71
  7: 0.upto(n) { |i| tri += i }
72
- 9: end
73
- 10:
74
- 11: tri
75
- 12: end
76
- 13:
77
- => 14: triangle(3)
72
+ 8:
73
+ 9: tri
74
+ 10: end
75
+ 11:
76
+ => 12: t = triangle(3)
77
+ 13: puts t
78
78
  (byebug) <RET> # hit enter
79
79
 
80
80
  [1, 10] in /path/to/triangle.rb
@@ -186,7 +186,21 @@ end
186
186
 
187
187
  n_args = $ARGV.length
188
188
 
189
- fail('*** Need number of disks or no parameter') if n_args > 1
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)
190
204
  ```
191
205
 
192
206
  Recall in the first section it was stated that before the `def` is run, the
@@ -316,7 +330,7 @@ Now let's see what happens after stepping:
316
330
  11:
317
331
  => 12: n_args = $ARGV.length
318
332
  13:
319
- 14: fail('*** Need number of disks or no parameter') if n_args > 1
333
+ 14: raise("*** Need number of disks or no parameter") if n_args > 1
320
334
  (byebug) private_methods.member?(:hanoi)
321
335
  true
322
336
  (byebug)
@@ -335,7 +349,7 @@ can use the `restart` command here.
335
349
  ```bash
336
350
  (byebug) restart 3
337
351
  Re exec'ing:
338
- /path/to/bin/byebug /path/to/hanoi.rb 3
352
+ /path/to/exe/byebug /path/to/hanoi.rb 3
339
353
 
340
354
  [1, 10] in /path/to/hanoi.rb
341
355
  1: #
@@ -442,15 +456,15 @@ NameError Exception: undefined local variable or method `n_args' for main:Object
442
456
  19: begin
443
457
  20: n = $ARGV[0].to_i
444
458
  21: rescue ValueError
445
- 22: raise("** Expecting an integer, got: #{$ARGV[0]}")
459
+ 22: raise("*** Expecting an integer, got: #{$ARGV[0]}")
446
460
  23: end
447
461
  24: end
448
462
  25:
449
- 26: fail('*** Number of disks should be between 1 and 100') if n < 1 || n > 100
463
+ 26: raise("*** Number of disks should be between 1 and 100") if n < 1 || n > 100
450
464
  27:
451
465
  => 28: hanoi(n, :a, :b, :c)
452
466
  (byebug) n_args
453
- 0
467
+ 1
454
468
  (byebug) eval n
455
469
  3
456
470
  (byebug) down 2
@@ -513,8 +527,8 @@ framework for that. Here's the test code, it should be placed in the same
513
527
  directory as `triangle.rb`.
514
528
 
515
529
  ```ruby
516
- require 'minitest/autorun'
517
- require_relative 'triangle.rb'
530
+ require "minitest/autorun"
531
+ require_relative "triangle.rb"
518
532
 
519
533
  class TestTriangle < Minitest::Test
520
534
  def test_basic
@@ -522,7 +536,7 @@ class TestTriangle < Minitest::Test
522
536
 
523
537
  0.upto(5) { |i| solutions << triangle(i) }
524
538
 
525
- assert_equal([0, 1, 3, 6, 10, 15], solutions, 'First 5 triangle numbers')
539
+ assert_equal([0, 1, 3, 6, 10, 15], solutions, "First 5 triangle numbers")
526
540
  end
527
541
  end
528
542
  ```
@@ -547,7 +561,7 @@ Run options: --seed 31679
547
561
  # Running:
548
562
 
549
563
  [2, 11] in test_triangle.rb
550
- 2: require_relative 'triangle.rb'
564
+ 2: require_relative "triangle.rb"
551
565
  3:
552
566
  4: class TestTriangle < Minitest::Test
553
567
  5: def test_basic
@@ -556,7 +570,7 @@ Run options: --seed 31679
556
570
  8:
557
571
  9: 0.upto(5) { |i| solutions << triangle(i) }
558
572
  10:
559
- 11: assert_equal([0, 1, 3, 6, 10, 15], solutions, 'First 5 triangle numbers')
573
+ 11: assert_equal([0, 1, 3, 6, 10, 15], solutions, "First 5 triangle numbers")
560
574
  (byebug)
561
575
  ```
562
576
 
@@ -599,7 +613,7 @@ We get the same result as if we had run byebug from the outset.
599
613
  ### Debugging Oddities: How debugging Ruby may be different from other languages
600
614
 
601
615
  If you are used to debugging in other languages like C, C++, Perl, Java or even
602
- Bash (see [bashdb](http://bashdb.sf.net)), there may be a number of things that
616
+ Bash (see [bashdb](http://bashdb.sourceforge.net)), there may be a number of things that
603
617
  seem or feel a little bit different and may confuse you. A number of these
604
618
  things aren't oddities of the debugger per se but differences in how Ruby works
605
619
  compared to those other languages. Because Ruby works a little differently from
@@ -726,7 +740,7 @@ _current_ class of the object.
726
740
  Consider the following little Ruby program.
727
741
 
728
742
  ```ruby
729
- 'Yes it does' =~ /
743
+ "Yes it does" =~ /
730
744
  (Yes) \s+
731
745
  it \s+
732
746
  does
@@ -939,8 +953,7 @@ We have started by debugging the `employee` thread. To do that, we switch to
939
953
  that thread using the `thread switch 3` command. The thread number is the one
940
954
  specified by `thread list`, we know this is our worker thread because `thread
941
955
  list` specifies where the thread is defined in the file (and its current
942
- position if the thread is currently running, although this is only available
943
- since Ruby 2.2.1).
956
+ position if the thread is currently running).
944
957
 
945
958
  After that we stopped the main thread and the worker thread, using the command
946
959
  `thread stop`. We do this because we want to focus on the employee thread first
@@ -1285,7 +1298,7 @@ Running a program from byebug adds a bit of overhead and slows it down a little.
1285
1298
  Furthermore, by necessity, debuggers change the operation of the program they
1286
1299
  are debugging. And this can lead to unexpected and unwanted differences. It has
1287
1300
  happened so often that the term
1288
- [Heisenbugs](http://en.wikipedia.org/wiki/Heisenbug) was coined to describe the
1301
+ [Heisenbugs](https://en.wikipedia.org/wiki/Heisenbug) was coined to describe the
1289
1302
  situation where using a debugger (among other possibilities) changes the
1290
1303
  behavior of the program so that the bug doesn't manifest itself anymore.
1291
1304
 
@@ -1298,7 +1311,7 @@ at the same speed as if there were no byebug.
1298
1311
  To enter byebug this way, just drop `byebug` in whichever line you want to start
1299
1312
  debugging at. You also have to require byebug somehow. If using bundler, it will
1300
1313
  take care of that for you, otherwise you can use the ruby `-r` flag or add
1301
- `require 'byebug'` in the line previous to the `byebug` call.
1314
+ `require "byebug"` in the line previous to the `byebug` call.
1302
1315
 
1303
1316
  If speed is crucial, you may want to start and stop this around certain sections
1304
1317
  of code, using `Byebug.start` and `Byebug.stop`. Alternatively, instead of
@@ -1314,7 +1327,7 @@ problem you want to investigate. And since `byebug` is just a method call it's
1314
1327
  possible to enclose it in a conditional expression, for example
1315
1328
 
1316
1329
  ```ruby
1317
- byebug if 'bar' == foo and 20 == iter_count
1330
+ byebug if "bar" == foo and 20 == iter_count
1318
1331
  ```
1319
1332
 
1320
1333
  ### Restarting Byebug
@@ -1341,9 +1354,9 @@ program that you want to debug (In Rails, the
1341
1354
  `config/environments/development.rb` could be a good candidate).
1342
1355
 
1343
1356
  ```ruby
1344
- require 'byebug/core'
1357
+ require "byebug/core"
1345
1358
  Byebug.wait_connection = true
1346
- Byebug.start_server('localhost', <port>)
1359
+ Byebug.start_server("localhost", <port>)
1347
1360
  ```
1348
1361
 
1349
1362
  Once this piece gets executed, you can connect to the remote debugger from your
@@ -1455,6 +1468,7 @@ display a short list of named classes of commands
1455
1468
  save -- Saves current byebug session to a file
1456
1469
  set -- Modifies byebug settings
1457
1470
  show -- Shows byebug settings
1471
+ skip -- Runs until the next breakpoint as long as it is different from the current one
1458
1472
  source -- Restores a previously saved byebug session
1459
1473
  step -- Steps into blocks or methods one or more times
1460
1474
  thread -- Commands to manipulate threads
data/LICENSE CHANGED
@@ -1,23 +1,23 @@
1
- Copyright (c) David Rodríguez <deivid.rodriguez@gmail.com>
1
+ Copyright (c) 2018 David Rodríguez <deivid.rodriguez@riseup.net>
2
2
  All rights reserved.
3
3
 
4
4
  Redistribution and use in source and binary forms, with or without
5
- modification, are permitted provided that the following conditions
6
- are met:
7
- 1. Redistributions of source code must retain the above copyright
8
- notice, this list of conditions and the following disclaimer.
9
- 2. Redistributions in binary form must reproduce the above copyright
10
- notice, this list of conditions and the following disclaimer in the
11
- documentation and/or other materials provided with the distribution.
5
+ modification, are permitted provided that the following conditions are met:
12
6
 
13
- THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
14
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16
- ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
7
+ * Redistributions of source code must retain the above copyright notice, this
8
+ list of conditions and the following disclaimer.
9
+
10
+ * Redistributions in binary form must reproduce the above copyright notice,
11
+ this list of conditions and the following disclaimer in the documentation
12
+ and/or other materials provided with the distribution.
13
+
14
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
17
18
  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19
- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20
- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21
- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22
- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23
- SUCH DAMAGE.
19
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
20
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
21
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/README.md CHANGED
@@ -1,30 +1,25 @@
1
1
  # Byebug
2
2
 
3
3
  [![Version][gem]][gem_url]
4
- [![Quality][gpa]][gpa_url]
5
- [![Coverage][cov]][cov_url]
6
- [![Gratipay][tip]][tip_url]
4
+ [![Tidelift][tid]][tid_url]
7
5
  [![Gitter][irc]][irc_url]
8
6
 
9
7
  [gem]: https://img.shields.io/gem/v/byebug.svg
10
- [gpa]: https://img.shields.io/codeclimate/github/deivid-rodriguez/byebug.svg
11
- [cov]: https://img.shields.io/codeclimate/coverage/github/deivid-rodriguez/byebug.svg
12
- [tip]: https://img.shields.io/gittip/byebug.svg
8
+ [tid]: https://tidelift.com/badges/package/rubygems/byebug
13
9
  [irc]: https://img.shields.io/badge/IRC%20(gitter)-devs%20%26%20users-brightgreen.svg
14
10
 
15
11
  [gem_url]: https://rubygems.org/gems/byebug
16
- [gpa_url]: https://codeclimate.com/github/deivid-rodriguez/byebug
17
- [cov_url]: https://codeclimate.com/github/deivid-rodriguez/byebug
18
- [tip_url]: https://gratipay.com/byebug
12
+ [tid_url]: https://tidelift.com/subscription/pkg/rubygems-byebug?utm_source=rubygems-byebug&utm_medium=readme_badge
19
13
  [irc_url]: https://gitter.im/deivid-rodriguez/byebug
20
14
 
21
- Byebug is a simple to use, feature rich debugger for Ruby 2. It uses the new
22
- TracePoint API for execution control and the new Debug Inspector API for call
23
- stack navigation, so it doesn't depend on internal core sources. It's developed
24
- as a C extension, so it's fast. And it has a full test suite so it's reliable.
15
+ Byebug is a simple to use and feature rich debugger for Ruby. It uses the
16
+ TracePoint API for execution control and the Debug Inspector API for call stack
17
+ navigation. Therefore, Byebug doesn't depend on internal core sources. Byebug is also
18
+ fast because it is developed as a C extension and reliable because it is supported
19
+ by a full test suite.
25
20
 
26
- It allows you to see what is going on _inside_ a Ruby program while it executes
27
- and offers many of the traditional debugging features such as:
21
+ The debugger permits the ability to understand what is going on _inside_ a Ruby program
22
+ while it executes and offers many of the traditional debugging features such as:
28
23
 
29
24
  * Stepping: Running your program one line at a time.
30
25
  * Breaking: Pausing the program at some event or specified instruction, to
@@ -34,26 +29,21 @@ and offers many of the traditional debugging features such as:
34
29
  * Tracking: Keeping track of the different values of your variables or the
35
30
  different lines executed by your program.
36
31
 
37
- ## Build Status
38
-
39
- Linux [![Tra][tra]][tra_url]
32
+ ## For enterprise
40
33
 
41
- Windows [![Vey][vey]][vey_url]
34
+ Byebug for enterprise is available via the Tidelift Subscription. [Learn
35
+ more][Tidelift for enterprise].
42
36
 
43
- [tra]: https://img.shields.io/travis/deivid-rodriguez/byebug.svg?branch=master
44
- [vey]: https://ci.appveyor.com/api/projects/status/github/deivid-rodriguez/byebug?svg=true
37
+ ## Build Status
45
38
 
46
- [tra_url]: https://travis-ci.org/deivid-rodriguez/byebug
47
- [vey_url]: https://ci.appveyor.com/project/deivid-rodriguez/byebug
39
+ ![ubuntu](https://github.com/deivid-rodriguez/byebug/workflows/ubuntu/badge.svg)
40
+ ![windows](https://github.com/deivid-rodriguez/byebug/workflows/windows/badge.svg)
48
41
 
49
42
  ## Requirements
50
43
 
51
- * Required: MRI 2.0.0 or higher. For debugging ruby 1.9.3 or older, use
52
- [debugger].
53
- * Recommended:
54
- * MRI 2.1.8 or higher.
55
- * MRI 2.2.4 or higher.
56
- * MRI 2.3.0 or higher.
44
+ * _Required_: MRI 2.4.0 or higher.
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).
57
47
 
58
48
  ## Install
59
49
 
@@ -61,72 +51,91 @@ Windows [![Vey][vey]][vey_url]
61
51
  gem install byebug
62
52
  ```
63
53
 
64
- ## Usage
54
+ Alternatively, if you use `bundler`:
65
55
 
66
- Simply drop
56
+ ```shell
57
+ bundle add byebug --group "development, test"
58
+ ```
59
+
60
+ ## Usage
67
61
 
68
- byebug
62
+ ### From within the Ruby code
69
63
 
70
- wherever you want to start debugging and the execution will stop there.
71
- If you were debugging Rails, for example, you would add `byebug` to your code.
64
+ Simply include `byebug` wherever you want to start debugging and the execution will
65
+ stop there. For example, if you were debugging Rails, you would add `byebug` to
66
+ your code:
72
67
 
73
68
  ```ruby
74
69
  def index
75
70
  byebug
76
71
  @articles = Article.find_recent
72
+ end
77
73
  ```
78
74
 
79
- And then start a Rails server.
75
+ And then start a Rails server:
80
76
 
81
77
  ```shell
82
78
  bin/rails s
83
79
  ```
84
80
 
85
- Once the execution gets to your `byebug` command you will get a debugging prompt.
81
+ Once the execution gets to your `byebug` command, you will receive a debugging prompt.
82
+
83
+ ### From the command line
84
+
85
+ If you want to debug a Ruby script without editing it, you can invoke byebug from the command line.
86
+
87
+ ```shell
88
+ byebug myscript.rb
89
+ ```
86
90
 
87
91
  ## Byebug's commands
88
92
 
89
- Command | Aliases | Subcommands
90
- ----------- |:------------ |:-----------
91
- `backtrace` | `bt` `where` |
92
- `break` | |
93
- `catch` | |
94
- `condition` | |
95
- `continue` | |
96
- `delete` | |
97
- `debug` | |
98
- `disable` | | `breakpoints` `display`
99
- `display` | |
100
- `down` | |
101
- `edit` | |
102
- `enable` | | `breakpoints` `display`
103
- `finish` | |
104
- `frame` | |
105
- `help` | |
106
- `history` | |
107
- `info` | | `args` `breakpoints` `catch` `display` `file` `line` `program`
108
- `irb` | |
109
- `kill` | |
110
- `list` | |
111
- `method` | | `instance`
112
- `next` | |
113
- `pry` | |
114
- `quit` | |
115
- `restart` | |
116
- `save` | |
117
- `set` | | `autoirb` `autolist` `autopry` `autosave` `basename` `callstyle` `fullpath` `histfile` `histsize` `linetrace` `listsize` `post_mortem` `savefile` `stack_on_error` `width`
118
- `show` | | `autoirb` `autolist` `autopry` `autosave` `basename` `callstyle` `fullpath` `histfile` `histsize` `linetrace` `listsize` `post_mortem` `savefile` `stack_on_error` `width`
119
- `source` | |
120
- `step` | |
121
- `thread` | | `current` `list` `resume` `stop` `switch`
122
- `tracevar` | |
123
- `undisplay` | |
124
- `up` | |
125
- `var` | | `all` `constant` `global` `instance` `local`
93
+ Command | Aliases | Subcommands
94
+ ------- | ------- | -----------
95
+ `backtrace` | `bt` `w` `where`|
96
+ `break` | `b` |
97
+ `catch` | `cat` |
98
+ `condition` | `cond` |
99
+ `continue` | `c` `cont` |
100
+ `continue!` | `c!` `cont!` |
101
+ `debug` | |
102
+ `delete` | `del` |
103
+ `disable` | `dis` | `breakpoints` `display`
104
+ `display` | `disp` |
105
+ `down` | |
106
+ `edit` | `ed` |
107
+ `enable` | `en` | `breakpoints` `display`
108
+ `finish` | `fin` |
109
+ `frame` | `f` |
110
+ `help` | `h` |
111
+ `history` | `hist` |
112
+ `info` | `i` | `args` `breakpoints` `catch` `display` `file` `line` `program`
113
+ `interrupt` | `int` |
114
+ `irb` | |
115
+ `kill` | |
116
+ `list` | `l` |
117
+ `method` | `m` | `instance`
118
+ `next` | `n` |
119
+ `pry` | |
120
+ `quit` | `q` |
121
+ `quit!` | `q!` |
122
+ `restart` | |
123
+ `save` | `sa` |
124
+ `set` | | `autoirb` `autolist` `autopry` `autosave` `basename` `callstyle` `fullpath` `histfile` `histsize` `linetrace` `listsize` `post_mortem` `savefile` `stack_on_error` `width`
125
+ `show` | | `autoirb` `autolist` `autopry` `autosave` `basename` `callstyle` `fullpath` `histfile` `histsize` `linetrace` `listsize` `post_mortem` `savefile` `stack_on_error` `width`
126
+ `skip` | `sk` |
127
+ `source` | `so` |
128
+ `step` | `s` |
129
+ `thread` | `th` | `current` `list` `resume` `stop` `switch`
130
+ `tracevar` | `tr` |
131
+ `undisplay` | `undisp` |
132
+ `untracevar`| `untr` |
133
+ `up` | |
134
+ `var` | `v` | `all` `constant` `global` `instance` `local`
126
135
 
127
136
  ## Semantic Versioning
128
137
 
129
- Byebug tries to follow [semantic versioning](http://semver.org) and tries to
138
+ Byebug attempts to follow [semantic versioning](https://semver.org) and
130
139
  bump major version only when backwards incompatible changes are released.
131
140
  Backwards compatibility is targeted to [pry-byebug] and any other plugins
132
141
  relying on `byebug`.
@@ -145,11 +154,25 @@ 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
 
151
161
  See [Getting Started with Development](CONTRIBUTING.md).
152
162
 
163
+ ## Funding
164
+
165
+ Subscribe to [Tidelift][Tidelift support] to ensure byebug stays actively
166
+ maintained, and at the same time get licensing assurances and timely security
167
+ notifications for your open source dependencies.
168
+
169
+ You can also help `byebug` by leaving a small (or big) tip through [Liberapay].
170
+
171
+ ## Security contact information
172
+
173
+ Please use the Tidelift security contact to [report a security vulnerability].
174
+ Tidelift will coordinate the fix and disclosure.
175
+
153
176
  ## Credits
154
177
 
155
178
  Everybody who has ever contributed to this forked and reforked piece of
@@ -168,3 +191,9 @@ software, especially:
168
191
  [ruby-debug-passenger]: https://github.com/davejamesmiller/ruby-debug-passenger
169
192
  [minitest-byebug]: https://github.com/kaspth/minitest-byebug
170
193
  [sublime_debugger]: https://github.com/shuky19/sublime_debugger
194
+ [atom-byebug]: https://github.com/izaera/atom-byebug
195
+ [Liberapay]: https://liberapay.com/byebug/donate
196
+ [Tidelift]: https://tidelift.com/subscription/pkg/rubygems-byebug?utm_source=rubygems-byebug&utm_medium=readme_text
197
+ [Tidelift for enterprise]: https://tidelift.com/subscription/pkg/rubygems-byebug?utm_source=rubygems-byebug&utm_medium=referral&utm_campaign=github&utm_content=enterprise
198
+ [Tidelift support]: https://tidelift.com/subscription/pkg/rubygems-byebug?utm_source=rubygems-byebug&utm_medium=referral&utm_campaign=github&utm_content=support
199
+ [report a security vulnerability]: https://tidelift.com/security
data/exe/byebug ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "byebug/runner"
5
+
6
+ Byebug::Runner.new.run
@@ -239,7 +239,7 @@ brkpt_source(VALUE self)
239
239
  }
240
240
 
241
241
  static void
242
- mark_breakpoint(breakpoint_t * breakpoint)
242
+ mark_breakpoint(breakpoint_t *breakpoint)
243
243
  {
244
244
  rb_gc_mark(breakpoint->source);
245
245
  rb_gc_mark(breakpoint->expr);
@@ -491,7 +491,7 @@ find_breakpoint_by_method(VALUE breakpoints, VALUE klass, ID mid, VALUE bind,
491
491
  }
492
492
 
493
493
  void
494
- Init_breakpoint(VALUE mByebug)
494
+ Init_byebug_breakpoint(VALUE mByebug)
495
495
  {
496
496
  breakpoint_max = 0;
497
497