debug 1.7.1 → 1.9.1

Sign up to get free protection for your applications and to get access to all the features.
data/misc/README.md.erb CHANGED
@@ -2,9 +2,9 @@
2
2
 
3
3
  # debug.rb
4
4
 
5
- This library provides debugging functionality to Ruby (MRI) 2.6 and later.
5
+ This library provides debugging functionality to Ruby (MRI) 2.7 and later.
6
6
 
7
- This debug.rb is replacement of traditional lib/debug.rb standard library which is implemented by `set_trace_func`.
7
+ This debug.rb is the replacement of traditional lib/debug.rb standard library, which is implemented by `set_trace_func`.
8
8
  New debug.rb has several advantages:
9
9
 
10
10
  * Fast: No performance penalty on non-stepping mode and non-breakpoints.
@@ -18,7 +18,7 @@ New debug.rb has several advantages:
18
18
  Connection | UDS, TCP/IP | UDS, TCP/IP | TCP/IP |
19
19
  Requirement | No | [vscode-rdbg](https://marketplace.visualstudio.com/items?itemName=KoichiSasada.vscode-rdbg) | Chrome |
20
20
 
21
- * Extensible: application can introduce debugging support with several ways:
21
+ * Extensible: application can introduce debugging support in several ways:
22
22
  * By `rdbg` command
23
23
  * By loading libraries with `-r` command line option
24
24
  * By calling Ruby's method explicitly
@@ -26,7 +26,7 @@ New debug.rb has several advantages:
26
26
  * Support threads (almost done) and ractors (TODO).
27
27
  * Support suspending and entering to the console debugging with `Ctrl-C` at most of timing.
28
28
  * Show parameters on backtrace command.
29
- * Support recording & reply debugging.
29
+ * Support recording & replay debugging.
30
30
 
31
31
  # Installation
32
32
 
@@ -55,7 +55,7 @@ To use a debugger, roughly you will do the following steps:
55
55
  4. Use debug commands.
56
56
  * [Evaluate Ruby expressions](#evaluate) (e.g. `p lvar` to see the local variable `lvar`).
57
57
  * [Query the program status](#information) (e.g. `info` to see information about the current frame).
58
- * [Control program flow](#control-flow) (e.g. move to the another line with `step`, to the next line with `next`).
58
+ * [Control program flow](#control-flow) (e.g. move to another line with `step`, to the next line with `next`).
59
59
  * [Set another breakpoint](#breakpoint) (e.g. `catch Exception` to set a breakpoint that'll be triggered when `Exception` is raised).
60
60
  * [Activate tracing in your program](#trace) (e.g. `trace call` to trace method calls).
61
61
  * [Change the configuration](#configuration-1) (e.g. `config set no_color true` to disable coloring).
@@ -180,7 +180,7 @@ DEBUGGER: Session start (pid: 7656)
180
180
  #1 BP - Line /mnt/c/ko1/src/rb/ruby-debug/target.rb:5 (line)
181
181
  ```
182
182
 
183
- You can see that two breakpoints are registered. Let's continue the program by `continue` command.
183
+ You can see that two breakpoints are registered. Let's continue the program by using the `continue` command.
184
184
 
185
185
  ```shell
186
186
  (rdbg) continue
@@ -200,8 +200,8 @@ Stop by #0 BP - Line /mnt/c/ko1/src/rb/ruby-debug/target.rb:3 (line)
200
200
  ```
201
201
 
202
202
  You can see that we can stop at line 3.
203
- Let's see the local variables with `info` command, and continue.
204
- You can also confirm that the program will suspend at line 5 and you can use `info` command again.
203
+ Let's see the local variables with the `info` command, and continue.
204
+ You can also confirm that the program will suspend at line 5 and you can use the `info` command again.
205
205
 
206
206
  ```shell
207
207
  (rdbg) info
@@ -238,14 +238,14 @@ d => 4
238
238
  ```
239
239
 
240
240
  By the way, using `rdbg` command you can suspend your application with `C-c` (SIGINT) and enter the debug console.
241
- It will help that if you want to know what the program is doing.
241
+ It will help if you want to know what the program is doing.
242
242
 
243
243
  ### Use `rdbg` with commands written in Ruby
244
244
 
245
- If you want to run a command written in Ruby like like `rake`, `rails`, `bundle`, `rspec` and so on, you can use `rdbg -c` option.
245
+ If you want to run a command written in Ruby like `rake`, `rails`, `bundle`, `rspec`, and so on, you can use `rdbg -c` option.
246
246
 
247
247
  * Without `-c` option, `rdbg <name>` means that `<name>` is Ruby script and invoke it like `ruby <name>` with the debugger.
248
- * With `-c` option, `rdbg -c <name>` means that `<name>` is command in `PATH` and simply invoke it with the debugger.
248
+ * With `-c` option, `rdbg -c <name>` means that `<name>` is a command in `PATH` and simply invokes it with the debugger.
249
249
 
250
250
  Examples:
251
251
  * `rdbg -c -- rails server`
@@ -263,27 +263,27 @@ Like other languages, you can use this debugger on the VSCode.
263
263
 
264
264
  1. Install [VSCode rdbg Ruby Debugger - Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=KoichiSasada.vscode-rdbg)
265
265
  2. Open `.rb` file (e.g. `target.rb`)
266
- 3. Register breakpoints with "Toggle breakpoint" in Run menu (or type F9 key)
266
+ 3. Register breakpoints with "Toggle breakpoint" in the Run menu (or type F9 key)
267
267
  4. Choose "Start debugging" in "Run" menu (or type F5 key)
268
- 5. You will see a dialog "Debug command line" and you can choose your favorite command line your want to run.
269
- 6. Chosen command line is invoked with `rdbg -c` and VSCode shows the details at breakpoints.
268
+ 5. You will see a dialog "Debug command line" and you can choose your favorite command line you want to run.
269
+ 6. Chosen command line is invoked with `rdbg -c`, and VSCode shows the details at breakpoints.
270
270
 
271
- Please refer [Debugging in Visual Studio Code](https://code.visualstudio.com/docs/editor/debugging) for operations on VSCode.
271
+ Please refer to [Debugging in Visual Studio Code](https://code.visualstudio.com/docs/editor/debugging) for operations on VSCode.
272
272
 
273
273
  You can configure the extension in `.vscode/launch.json`.
274
274
  Please see the extension page for more details.
275
275
 
276
276
  ## Remote debugging
277
277
 
278
- You can use this debugger as a remote debugger. For example, it will help the following situations:
278
+ You can use this debugger as a remote debugger. For example, it will help in the following situations:
279
279
 
280
- * Your application does not run on TTY and it is hard to use `binding.pry` or `binding.irb`.
281
- * Your application is running on Docker container and there is no TTY.
280
+ * Your application does not run on TTY, and it is hard to use `binding.pry` or `binding.irb`.
281
+ * Your application is running on a Docker container, and there is no TTY.
282
282
  * Your application is running as a daemon.
283
283
  * Your application uses pipe for STDIN or STDOUT.
284
284
  * Your application is running as a daemon and you want to query the running status (checking a backtrace and so on).
285
285
 
286
- You can run your application as a remote debuggee and the remote debugger console can attach to the debuggee anytime.
286
+ You can run your application as a remote debuggee, and the remote debugger console can attach to the debuggee anytime.
287
287
 
288
288
  ### Invoke as a remote debuggee
289
289
 
@@ -305,7 +305,7 @@ DEBUGGER: Debugger can attach via UNIX domain socket (/home/ko1/.ruby-debug-sock
305
305
  DEBUGGER: wait for debugger connection...
306
306
  ```
307
307
 
308
- By default, `rdbg --open` uses UNIX domain socket and generates path name automatically (`/home/ko1/.ruby-debug-sock/ruby-debug-ko1-7773` in this case).
308
+ By default, `rdbg --open` uses UNIX domain socket and generates the path name automatically (`/home/ko1/.ruby-debug-sock/ruby-debug-ko1-7773` in this case).
309
309
 
310
310
  You can connect to the debuggee with `rdbg --attach` command (`rdbg -A` for short).
311
311
 
@@ -324,11 +324,11 @@ $ rdbg -A
324
324
  (rdbg:remote)
325
325
  ```
326
326
 
327
- If there is no other opening ports on the default directory, `rdbg --attach` command chooses the only one opening UNIX domain socket and connect to it. If there are more files, you need to specify the file.
327
+ If there are no other opening ports on the default directory, `rdbg --attach` command chooses the only one opening UNIX domain socket and connects to it. If there are more files, you need to specify the file.
328
328
 
329
- When `rdbg --attach` connects to the debuggee, you can use any debug commands (set breakpoints, continue the program and so on) like local debug console. When an debuggee program exits, the remote console will also terminate.
329
+ When `rdbg --attach` connects to the debuggee, you can use any debug commands (set breakpoints, continue the program, and so on) like the local debug console. When a debuggee program exits, the remote console will also terminate.
330
330
 
331
- NOTE: If you use `quit` command, only remote console exits and the debuggee program continues to run (and you can connect it again). If you want to exit the debuggee program, use `kill` command.
331
+ NOTE: If you use the `quit` command, only the remote console exits and the debuggee program continues to run (and you can connect it again). If you want to exit the debuggee program, use `kill` command.
332
332
 
333
333
  If you want to use TCP/IP for the remote debugging, you need to specify the port and host with `--port` like `rdbg --open --port 12345` and it binds to `localhost:12345`.
334
334
 
@@ -343,11 +343,11 @@ Note that all messages communicated between the debugger and the debuggee are *N
343
343
 
344
344
  #### `require 'debug/open'` in a program
345
345
 
346
- If you can modify the program, you can open debugging port by adding `require 'debug/open'` line in the program.
346
+ If you can modify the program, you can open the debugging port by adding `require 'debug/open'` line in the program.
347
347
 
348
348
  If you don't want to stop the program at the beginning, you can also use `require 'debug/open_nonstop'`.
349
349
  Using `debug/open_nonstop` is useful if you want to open a backdoor to the application.
350
- However, it is also danger because it can become another vulnerability.
350
+ However, it is also dangerous because it can become another vulnerability.
351
351
  Please use it carefully.
352
352
 
353
353
  By default, UNIX domain socket is used for the debugging port. To use TCP/IP, you can set the `RUBY_DEBUG_PORT` environment variable.
@@ -372,7 +372,7 @@ Also `open` command allows opening the debug port.
372
372
 
373
373
  ([vscode-rdbg v0.0.9](https://marketplace.visualstudio.com/items?itemName=KoichiSasada.vscode-rdbg) or later is required)
374
374
 
375
- If you don't run a debuggee Ruby process on VSCode, you can attach with VSCode later with the following steps.
375
+ If you don't run a debuggee Ruby process on VSCode, you can attach it to VSCode later with the following steps.
376
376
 
377
377
  `rdbg --open=vscode` opens the debug port and tries to invoke the VSCode (`code` command).
378
378
 
@@ -425,7 +425,7 @@ If your application is running on a SSH remote host, please try:
425
425
 
426
426
  ```
427
427
 
428
- and try to use proposed commands.
428
+ and try to use the proposed commands.
429
429
 
430
430
  Note that you can attach with `rdbg --attach` and continue REPL debugging.
431
431
 
@@ -443,7 +443,7 @@ DEBUGGER: With Chrome browser, type the following URL in the address-bar:
443
443
  DEBUGGER: wait for debugger connection...
444
444
  ```
445
445
 
446
- Type `devtools://devtools/bundled/inspector.html?v8only=true&panel=sources&ws=127.0.0.1:57231/b32a55cd-2eb5-4c5c-87d8-b3dfc59d80ef` in the address-bar on Chrome browser, and you can continue the debugging with chrome browser.
446
+ Type `devtools://devtools/bundled/inspector.html?v8only=true&panel=sources&ws=127.0.0.1:57231/b32a55cd-2eb5-4c5c-87d8-b3dfc59d80ef` in the address bar on Chrome browser, and you can continue the debugging with chrome browser.
447
447
 
448
448
  Also `open chrome` command works like `open vscode`.
449
449
 
@@ -456,7 +456,7 @@ When the debug session is started, initial scripts are loaded so you can put you
456
456
 
457
457
  ### Configuration list
458
458
 
459
- You can configure debugger's behavior with environment variables and `config` command. Each configuration has environment variable and the name which can be specified by `config` command.
459
+ You can configure the debugger's behavior with environment variables and `config` command. Each configuration has an environment variable and a name which can be specified by `config` command.
460
460
 
461
461
  ```
462
462
  # configuration example
@@ -473,7 +473,7 @@ There are other environment variables:
473
473
 
474
474
  * `NO_COLOR`: If the value is set, set `RUBY_DEBUG_NO_COLOR` ([NO_COLOR: disabling ANSI color output in various Unix commands](https://no-color.org/)).
475
475
  * `RUBY_DEBUG_ENABLE`: If the value is `0`, do not enable debug.gem feature.
476
- * `RUBY_DEBUG_ADDED_RUBYOPT`: Remove this value from `RUBYOPT` at first. This feature helps loading debug.gem with `RUBYOPT='-r debug/...'` and you don't want to derive it to child processes. In this case you can set `RUBY_DEBUG_ADDED_RUBYOPT='-r debug/...'` (same value) and this string will be deleted from `RUBYOPT` at first.
476
+ * `RUBY_DEBUG_ADDED_RUBYOPT`: Remove this value from `RUBYOPT` at first. This feature helps loading debug.gem with `RUBYOPT='-r debug/...'`, and you don't want to derive it to child processes. In this case, you can set `RUBY_DEBUG_ADDED_RUBYOPT='-r debug/...'` (same value), and this string will be deleted from `RUBYOPT` at first.
477
477
  * `RUBY_DEBUG_EDITOR` or `EDITOR`: An editor used by `edit` debug command.
478
478
  * `RUBY_DEBUG_BB`: Define `Kernel#bb` method which is alias of `Kernel#debugger`.
479
479
 
@@ -485,7 +485,7 @@ If there is `~/.rdbgrc`, the file is loaded as an initial script (which contains
485
485
  * You can specify the initial script with `rdbg -x initial_script` (like gdb's `-x` option).
486
486
 
487
487
  Initial scripts are useful to write your favorite configurations.
488
- For example, you can set break points with `break file:123` in `~/.rdbgrc`.
488
+ For example, you can set breakpoints with `break file:123` in `~/.rdbgrc`.
489
489
 
490
490
  If there are `~/.rdbgrc.rb` is available, it is also loaded as a ruby script at same timing.
491
491
 
@@ -495,16 +495,16 @@ On the debug console, you can use the following debug commands.
495
495
 
496
496
  There are additional features:
497
497
 
498
- * `<expr>` without debug command is almost same as `pp <expr>`.
499
- * If the input line `<expr>` does *NOT* start with any debug command, the line `<expr>` will be evaluated as a Ruby expression and the result will be printed with `pp` method. So that the input `foo.bar` is same as `pp foo.bar`.
500
- * If `<expr>` is recognized as a debug command, of course it is not evaluated as a Ruby expression, but is executed as debug command. For example, you can not evaluate such single letter local variables `i`, `b`, `n`, `c` because they are single letter debug commands. Use `p i` instead.
501
- * So the author (Koichi Sasada) recommends to use `p`, `pp` or `eval` command to evaluate the Ruby expression everytime.
498
+ * `<expr>` without debug command is almost the same as `pp <expr>`.
499
+ * If the input line `<expr>` does *NOT* start with any debug command, the line `<expr>` will be evaluated as a Ruby expression, and the result will be printed with `pp` method. So that the input `foo.bar` is the same as `pp foo.bar`.
500
+ * If `<expr>` is recognized as a debug command, of course, it is not evaluated as a Ruby expression but is executed as debug command. For example, you can not evaluate such single-letter local variables `i`, `b`, `n`, `c` because they are single-letter debug commands. Use `p i` instead.
501
+ * So the author (Koichi Sasada) recommends using `p`, `pp` or `eval` command to evaluate the Ruby expression every time.
502
502
  * `Enter` without any input repeats the last command (useful when repeating `step`s) for some commands.
503
503
  * `Ctrl-D` is equal to `quit` command.
504
504
  * [debug command compare sheet - Google Sheets](https://docs.google.com/spreadsheets/d/1TlmmUDsvwK4sSIyoMv-io52BUUz__R5wpu-ComXlsw0/edit?usp=sharing)
505
505
 
506
506
  You can use the following debug commands. Each command should be written in 1 line.
507
- The `[...]` notation means this part can be eliminate. For example, `s[tep]` means `s` or `step` are valid command. `ste` is not valid.
507
+ The `[...]` notation means this part can be eliminated. For example, `s[tep]` means `s` or `step` is a valid command. `ste` is not valid.
508
508
  The `<...>` notation means the argument.
509
509
 
510
510
  <%= DEBUGGER__.help %>
@@ -541,7 +541,7 @@ Emacs support available.
541
541
 
542
542
  #### Start by method
543
543
 
544
- After loading `debug/session`, you can start debug session with the following methods. They are convenient if you want to specify debug configurations in your program.
544
+ After loading `debug/session`, you can start a debug session with the following methods. They are convenient if you want to specify debug configurations in your program.
545
545
 
546
546
  * `DEBUGGER__.start(**kw)`: start debug session with local console.
547
547
  * `DEBUGGER__.open(**kw)`: open debug port with configuration (without configurations open with UNIX domain socket)
@@ -560,9 +560,9 @@ DEBUGGER__.start(no_color: true, # disable colorize
560
560
 
561
561
  ### `binding.break` method
562
562
 
563
- `binding.break` (or `binding.b`) set breakpoints at written line. It also has several keywords.
563
+ `binding.break` (or `binding.b`) set breakpoints at the written line. It also has several keywords.
564
564
 
565
- If `do: 'command'` is specified, the debugger suspends the program and run the `command` as a debug command and continue the program.
565
+ If `do: 'command'` is specified, the debugger suspends the program, runs the `command` as a debug command, and continues the program.
566
566
  It is useful if you only want to call a debug command and don't want to stop there.
567
567
 
568
568
  ```
@@ -572,9 +572,9 @@ def initialize
572
572
  end
573
573
  ```
574
574
 
575
- On this case, execute the `info` command then register a watch breakpoint for `@a` and continue to run. You can also use `;;` instead of `\n` to separate your commands.
575
+ In this case, execute the `info` command then register a watch breakpoint for `@a` and continue to run. You can also use `;;` instead of `\n` to separate your commands.
576
576
 
577
- If `pre: 'command'` is specified, the debugger suspends the program and run the `command` as a debug command, and keep suspend.
577
+ If `pre: 'command'` is specified, the debugger suspends the program and runs the `command` as a debug command, and keeps suspended.
578
578
  It is useful if you have operations before suspend.
579
579
 
580
580
  ```
@@ -584,7 +584,7 @@ def foo
584
584
  end
585
585
  ```
586
586
 
587
- On this case, you can see the result of `bar()` every time you stop there.
587
+ In this case, you can see the result of `bar()` every time you stop there.
588
588
 
589
589
  ## rdbg command help
590
590
 
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: debug
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.1
4
+ version: 1.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Koichi Sasada
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-12-22 00:00:00.000000000 Z
11
+ date: 2023-12-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: irb
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.5.0
19
+ version: '1.10'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.5.0
26
+ version: '1.10'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: reline
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 0.3.1
33
+ version: 0.3.8
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 0.3.1
40
+ version: 0.3.8
41
41
  description: Debugging functionality for Ruby. This is completely rewritten debug.rb
42
42
  which was contained by the ancient Ruby versions.
43
43
  email:
@@ -66,7 +66,9 @@ files:
66
66
  - lib/debug/color.rb
67
67
  - lib/debug/config.rb
68
68
  - lib/debug/console.rb
69
+ - lib/debug/dap_custom/traceInspector.rb
69
70
  - lib/debug/frame_info.rb
71
+ - lib/debug/irb_integration.rb
70
72
  - lib/debug/local.rb
71
73
  - lib/debug/open.rb
72
74
  - lib/debug/open_nonstop.rb
@@ -96,14 +98,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
96
98
  requirements:
97
99
  - - ">="
98
100
  - !ruby/object:Gem::Version
99
- version: 2.6.0
101
+ version: 2.7.0
100
102
  required_rubygems_version: !ruby/object:Gem::Requirement
101
103
  requirements:
102
104
  - - ">="
103
105
  - !ruby/object:Gem::Version
104
106
  version: '0'
105
107
  requirements: []
106
- rubygems_version: 3.3.7
108
+ rubygems_version: 3.5.1
107
109
  signing_key:
108
110
  specification_version: 4
109
111
  summary: Debugging functionality for Ruby