debug 1.2.3 → 1.3.2
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/CONTRIBUTING.md +9 -11
- data/README.md +116 -5
- data/ext/debug/debug.c +3 -2
- data/ext/debug/extconf.rb +2 -0
- data/lib/debug/client.rb +39 -17
- data/lib/debug/config.rb +66 -30
- data/lib/debug/console.rb +92 -25
- data/lib/debug/local.rb +22 -1
- data/lib/debug/prelude.rb +49 -0
- data/lib/debug/server.rb +188 -25
- data/lib/debug/server_cdp.rb +410 -0
- data/lib/debug/server_dap.rb +53 -23
- data/lib/debug/session.rb +388 -121
- data/lib/debug/thread_client.rb +4 -2
- data/lib/debug/version.rb +1 -1
- data/misc/README.md.erb +95 -1
- metadata +8 -6
data/lib/debug/thread_client.rb
CHANGED
@@ -3,7 +3,6 @@
|
|
3
3
|
require 'objspace'
|
4
4
|
require 'pp'
|
5
5
|
|
6
|
-
require_relative 'frame_info'
|
7
6
|
require_relative 'color'
|
8
7
|
|
9
8
|
module DEBUGGER__
|
@@ -120,6 +119,7 @@ module DEBUGGER__
|
|
120
119
|
raise "unknown mode: #{mode}"
|
121
120
|
end
|
122
121
|
|
122
|
+
# DEBUGGER__.warn "#{@mode} => #{mode} @ #{self.inspect}"
|
123
123
|
@mode = mode
|
124
124
|
end
|
125
125
|
|
@@ -954,12 +954,14 @@ module DEBUGGER__
|
|
954
954
|
|
955
955
|
when :dap
|
956
956
|
process_dap args
|
957
|
+
when :cdp
|
958
|
+
process_cdp args
|
957
959
|
else
|
958
960
|
raise [cmd, *args].inspect
|
959
961
|
end
|
960
962
|
end
|
961
963
|
|
962
|
-
rescue SuspendReplay, SystemExit
|
964
|
+
rescue SuspendReplay, SystemExit, Interrupt
|
963
965
|
raise
|
964
966
|
rescue Exception => e
|
965
967
|
pp ["DEBUGGER Exception: #{__FILE__}:#{__LINE__}", e, e.backtrace]
|
data/lib/debug/version.rb
CHANGED
data/misc/README.md.erb
CHANGED
@@ -11,7 +11,9 @@ New debug.rb has several advantages:
|
|
11
11
|
* [Remote debugging](#remote-debugging): Support remote debugging natively.
|
12
12
|
* UNIX domain socket
|
13
13
|
* TCP/IP
|
14
|
-
*
|
14
|
+
* Integration with rich debugger frontend
|
15
|
+
* VSCode/DAP ([VSCode rdbg Ruby Debugger - Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=KoichiSasada.vscode-rdbg))
|
16
|
+
* Chrome DevTools
|
15
17
|
* Extensible: application can introduce debugging support with several ways:
|
16
18
|
* By `rdbg` command
|
17
19
|
* By loading libraries with `-r` command line option
|
@@ -336,6 +338,97 @@ By default, UNIX domain socket is used for the debugging port. To use TCP/IP, yo
|
|
336
338
|
$ RUBY_DEBUG_PORT=12345 ruby target.rb
|
337
339
|
```
|
338
340
|
|
341
|
+
### Integration with external debugger frontend
|
342
|
+
|
343
|
+
You can attach with external debugger frontend with VSCode and Chrome.
|
344
|
+
|
345
|
+
```
|
346
|
+
$ rdbg --open=[frontend] target.rb
|
347
|
+
```
|
348
|
+
|
349
|
+
will open a debug port and `[frontned]` can attache to the port.
|
350
|
+
|
351
|
+
Also `open` command allows opening the debug port.
|
352
|
+
|
353
|
+
#### VSCode integration
|
354
|
+
|
355
|
+
If you don't run a debuggee Ruby process on VSCode, you can attach with VSCode later with the following steps.
|
356
|
+
|
357
|
+
`rdbg --open=vscode` opens the debug port and tries to invoke the VSCode (`code` command).
|
358
|
+
|
359
|
+
```
|
360
|
+
$ rdbg --open=vscode target.rb
|
361
|
+
DEBUGGER: Debugger can attach via UNIX domain socket (/tmp/ruby-debug-sock-1000/ruby-debug-ko1-27706)
|
362
|
+
DEBUGGER: wait for debugger connection...
|
363
|
+
Launching: code /tmp/ruby-debug-vscode-20211014-27706-gd7e85/ /tmp/ruby-debug-vscode-20211014-27706-gd7e85/README.rb
|
364
|
+
DEBUGGER: Connected.
|
365
|
+
```
|
366
|
+
|
367
|
+
And it tries to invoke the new VSCode window and VSCode starts attaching to the debuggee Ruby program automatically.
|
368
|
+
|
369
|
+
You can also use `open vscode` command in REPL.
|
370
|
+
|
371
|
+
```
|
372
|
+
$ rdbg target.rb
|
373
|
+
[1, 8] in target.rb
|
374
|
+
1|
|
375
|
+
=> 2| p a = 1
|
376
|
+
3| p b = 2
|
377
|
+
4| p c = 3
|
378
|
+
5| p d = 4
|
379
|
+
6| p e = 5
|
380
|
+
7|
|
381
|
+
8| __END__
|
382
|
+
=>#0 <main> at target.rb:2
|
383
|
+
(rdbg) open vscode # command
|
384
|
+
DEBUGGER: wait for debugger connection...
|
385
|
+
DEBUGGER: Debugger can attach via UNIX domain socket (/tmp/ruby-debug-sock-1000/ruby-debug-ko1-28337)
|
386
|
+
Launching: code /tmp/ruby-debug-vscode-20211014-28337-kg9dm/ /tmp/ruby-debug-vscode-20211014-28337-kg9dm/README.rb
|
387
|
+
DEBUGGER: Connected.
|
388
|
+
```
|
389
|
+
|
390
|
+
If the machine which runs the Ruby process doesn't have a `code` command, the following message will be shown:
|
391
|
+
|
392
|
+
```
|
393
|
+
(rdbg) open vscode
|
394
|
+
DEBUGGER: wait for debugger connection...
|
395
|
+
DEBUGGER: Debugger can attach via UNIX domain socket (/tmp/ruby-debug-sock-1000/ruby-debug-ko1-455)
|
396
|
+
Launching: code /tmp/ruby-debug-vscode-20211014-455-gtjpwi/ /tmp/ruby-debug-vscode-20211014-455-gtjpwi/README.rb
|
397
|
+
DEBUGGER: Can not invoke the command.
|
398
|
+
Use the command-line on your terminal (with modification if you need).
|
399
|
+
|
400
|
+
code /tmp/ruby-debug-vscode-20211014-455-gtjpwi/ /tmp/ruby-debug-vscode-20211014-455-gtjpwi/README.rb
|
401
|
+
|
402
|
+
If your application is running on a SSH remote host, please try:
|
403
|
+
|
404
|
+
code --remote ssh-remote+[SSH hostname] /tmp/ruby-debug-vscode-20211014-455-gtjpwi/ /tmp/ruby-debug-vscode-20211014-455-gtjpwi/README.rb
|
405
|
+
|
406
|
+
```
|
407
|
+
|
408
|
+
and try to use proposed commands.
|
409
|
+
|
410
|
+
Note that you can attach with `rdbg --attach` and continue REPL debugging.
|
411
|
+
|
412
|
+
#### Chrome DevTool integration
|
413
|
+
|
414
|
+
With `rdbg --open=chrome` command will shows the following message.
|
415
|
+
|
416
|
+
```
|
417
|
+
$ rdbg target.rb --open=chrome
|
418
|
+
DEBUGGER: Debugger can attach via TCP/IP (127.0.0.1:43633)
|
419
|
+
DEBUGGER: With Chrome browser, type the following URL in the address-bar:
|
420
|
+
|
421
|
+
devtools://devtools/bundled/inspector.html?ws=127.0.0.1:43633
|
422
|
+
|
423
|
+
DEBUGGER: wait for debugger connection...
|
424
|
+
```
|
425
|
+
|
426
|
+
Type `devtools://devtools/bundled/inspector.html?ws=127.0.0.1:43633` in the address-bar on Chrome browser, and you can continue the debugging with chrome browser.
|
427
|
+
|
428
|
+
Also `open chrome` command works like `open vscode`.
|
429
|
+
|
430
|
+
For more information about how to use Chrome debugging, you might want to read [here](https://developer.chrome.com/docs/devtools/)
|
431
|
+
|
339
432
|
## Configuration
|
340
433
|
|
341
434
|
You can configure the debugger's behavior with debug commands and environment variables.
|
@@ -480,3 +573,4 @@ Please also check the [contributing guideline](/CONTRIBUTING.md).
|
|
480
573
|
# Acknowledgement
|
481
574
|
|
482
575
|
* Some tests are based on [deivid-rodriguez/byebug: Debugging in Ruby 2](https://github.com/deivid-rodriguez/byebug)
|
576
|
+
* Several codes in `server_cdp.rb` are based on [geoffreylitt/ladybug: Visual Debugger](https://github.com/geoffreylitt/ladybug)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: debug
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2
|
4
|
+
version: 1.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Koichi Sasada
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-10-
|
11
|
+
date: 2021-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: irb
|
@@ -78,7 +78,9 @@ files:
|
|
78
78
|
- lib/debug/local.rb
|
79
79
|
- lib/debug/open.rb
|
80
80
|
- lib/debug/open_nonstop.rb
|
81
|
+
- lib/debug/prelude.rb
|
81
82
|
- lib/debug/server.rb
|
83
|
+
- lib/debug/server_cdp.rb
|
82
84
|
- lib/debug/server_dap.rb
|
83
85
|
- lib/debug/session.rb
|
84
86
|
- lib/debug/source_repository.rb
|
@@ -94,7 +96,7 @@ licenses:
|
|
94
96
|
metadata:
|
95
97
|
homepage_uri: https://github.com/ruby/debug
|
96
98
|
source_code_uri: https://github.com/ruby/debug
|
97
|
-
post_install_message:
|
99
|
+
post_install_message:
|
98
100
|
rdoc_options: []
|
99
101
|
require_paths:
|
100
102
|
- lib
|
@@ -109,8 +111,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
109
111
|
- !ruby/object:Gem::Version
|
110
112
|
version: '0'
|
111
113
|
requirements: []
|
112
|
-
rubygems_version: 3.
|
113
|
-
signing_key:
|
114
|
+
rubygems_version: 3.1.6
|
115
|
+
signing_key:
|
114
116
|
specification_version: 4
|
115
117
|
summary: Debugging functionality for Ruby
|
116
118
|
test_files: []
|