debug 1.6.1 → 1.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CONTRIBUTING.md +1 -1
- data/README.md +2 -2
- data/exe/rdbg +18 -3
- data/lib/debug/client.rb +1 -1
- data/lib/debug/prelude.rb +1 -0
- data/lib/debug/server_cdp.rb +1 -1
- data/lib/debug/server_dap.rb +5 -5
- data/lib/debug/session.rb +20 -11
- data/lib/debug/thread_client.rb +1 -1
- data/lib/debug/version.rb +1 -1
- data/lib/debug.rb +1 -0
- data/misc/README.md.erb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61c14c6e761a2ed0f10294682cb7b152c4329d3cd0eccbffff68e3ae122d00a0
|
4
|
+
data.tar.gz: 714add08d21df0ceb674a8a9c8b8599f0dcc45cb38b68611c766fab1b6ddcd41
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c43d785c88ce38a676941b87ab320d126d9083f8b4dcc487ef22b8f7f0c4a144ed2fe9dfc800f8d7b2bf9287694c3d5abcd3b7c5075248b5ca08bd6bd0b3bcf
|
7
|
+
data.tar.gz: 8f2e9922aac4e297c437f3fc63ec11df2af430c2f3b3406df8723d4703fc254705246300fee99fee6f38f1da62348184b3ff0dcb6a4ddf302c3345f8ae5d4634
|
data/CONTRIBUTING.md
CHANGED
@@ -269,7 +269,7 @@ Currently, there are 2 kinds of test frameworks for DAP and CDP.
|
|
269
269
|
|
270
270
|
If you want to write protocol-based tests, you should use the test generator.
|
271
271
|
To run the test generator, you can enter `$ bin/gentest target.rb --open=vscode` in the terminal, VSCode will be executed.
|
272
|
-
Also, if you enter
|
272
|
+
Also, if you enter `$ bin/gentest target.rb --open=chrome` there, Chrome will be executed.
|
273
273
|
If you need to modify existing tests, it is basically a good idea to regenerate them by the test generator instead of rewriting them directly.
|
274
274
|
Please refer to [the Microsoft "Debug Adapter Protocol" article](https://microsoft.github.io/debug-adapter-protocol/specification) to learn more about DAP formats.
|
275
275
|
Please refer to [Procol viewer for "Chrome DevTools Protocol"](https://chromedevtools.github.io/devtools-protocol/) to learn more about CDP formats.
|
data/README.md
CHANGED
@@ -438,12 +438,12 @@ $ rdbg target.rb --open=chrome
|
|
438
438
|
DEBUGGER: Debugger can attach via TCP/IP (127.0.0.1:43633)
|
439
439
|
DEBUGGER: With Chrome browser, type the following URL in the address-bar:
|
440
440
|
|
441
|
-
devtools://devtools/bundled/inspector.html?ws=127.0.0.1:
|
441
|
+
devtools://devtools/bundled/inspector.html?v8only=true&panel=sources&ws=127.0.0.1:57231/b32a55cd-2eb5-4c5c-87d8-b3dfc59d80ef
|
442
442
|
|
443
443
|
DEBUGGER: wait for debugger connection...
|
444
444
|
```
|
445
445
|
|
446
|
-
Type `devtools://devtools/bundled/inspector.html?ws=127.0.0.1:
|
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
|
|
data/exe/rdbg
CHANGED
@@ -13,10 +13,25 @@ when :start
|
|
13
13
|
start_mode = config[:remote] ? "open" : 'start'
|
14
14
|
cmd = config[:command] ? ARGV.shift : (ENV['RUBY'] || RbConfig.ruby)
|
15
15
|
|
16
|
+
if defined?($:.resolve_feature_path)
|
17
|
+
begin
|
18
|
+
_, sopath = $:.resolve_feature_path('debug/debug.so')
|
19
|
+
rescue LoadError
|
20
|
+
# raises LoadError before 3.1 (2.7 and 3.0)
|
21
|
+
else
|
22
|
+
sopath = File.dirname(File.dirname(sopath)) if sopath
|
23
|
+
end
|
24
|
+
else
|
25
|
+
# `$:.resolve_feature_path` is not defined in 2.6 or earlier.
|
26
|
+
so = "debug/debug.#{RbConfig::CONFIG['DLEXT']}"
|
27
|
+
sopath = $:.find {|dir| File.exist?(File.join(dir, so))}
|
28
|
+
end
|
29
|
+
added = "-r #{libpath}/#{start_mode}"
|
30
|
+
added = "-I #{sopath} #{added}" if sopath
|
31
|
+
rubyopt = ENV['RUBYOPT']
|
16
32
|
env = ::DEBUGGER__::Config.config_to_env_hash(config)
|
17
|
-
|
18
|
-
env['
|
19
|
-
env['RUBYOPT'] = "#{added} #{rubyopt}"
|
33
|
+
env['RUBY_DEBUG_ADDED_RUBYOPT'] = added
|
34
|
+
env['RUBYOPT'] = "#{rubyopt} #{added}"
|
20
35
|
|
21
36
|
exec(env, cmd, *ARGV)
|
22
37
|
|
data/lib/debug/client.rb
CHANGED
data/lib/debug/prelude.rb
CHANGED
data/lib/debug/server_cdp.rb
CHANGED
@@ -998,7 +998,7 @@ module DEBUGGER__
|
|
998
998
|
|
999
999
|
def search_const b, expr
|
1000
1000
|
cs = expr.delete_prefix('::').split('::')
|
1001
|
-
[Object, *b.eval('Module.nesting')].reverse_each{|mod|
|
1001
|
+
[Object, *b.eval('::Module.nesting')].reverse_each{|mod|
|
1002
1002
|
if cs.all?{|c|
|
1003
1003
|
if mod.const_defined?(c)
|
1004
1004
|
mod = mod.const_get(c)
|
data/lib/debug/server_dap.rb
CHANGED
@@ -263,7 +263,7 @@ module DEBUGGER__
|
|
263
263
|
|
264
264
|
def process
|
265
265
|
while req = recv_request
|
266
|
-
raise "not a request: #{req.
|
266
|
+
raise "not a request: #{req.inspect}" unless req['type'] == 'request'
|
267
267
|
args = req.dig('arguments')
|
268
268
|
|
269
269
|
case req['command']
|
@@ -348,6 +348,9 @@ module DEBUGGER__
|
|
348
348
|
when 'disconnect'
|
349
349
|
terminate = args.fetch("terminateDebuggee", false)
|
350
350
|
|
351
|
+
SESSION.clear_all_breakpoints
|
352
|
+
send_response req
|
353
|
+
|
351
354
|
if SESSION.in_subsession?
|
352
355
|
if terminate
|
353
356
|
@q_msg << 'kill!'
|
@@ -361,9 +364,6 @@ module DEBUGGER__
|
|
361
364
|
end
|
362
365
|
end
|
363
366
|
|
364
|
-
SESSION.clear_all_breakpoints
|
365
|
-
send_response req
|
366
|
-
|
367
367
|
## control
|
368
368
|
when 'continue'
|
369
369
|
@q_msg << 'c'
|
@@ -911,7 +911,7 @@ module DEBUGGER__
|
|
911
911
|
|
912
912
|
def search_const b, expr
|
913
913
|
cs = expr.delete_prefix('::').split('::')
|
914
|
-
[Object, *b.eval('Module.nesting')].reverse_each{|mod|
|
914
|
+
[Object, *b.eval('::Module.nesting')].reverse_each{|mod|
|
915
915
|
if cs.all?{|c|
|
916
916
|
if mod.const_defined?(c)
|
917
917
|
mod = mod.const_get(c)
|
data/lib/debug/session.rb
CHANGED
@@ -22,8 +22,9 @@ end
|
|
22
22
|
# restore RUBYOPT
|
23
23
|
if (added_opt = ENV['RUBY_DEBUG_ADDED_RUBYOPT']) &&
|
24
24
|
(rubyopt = ENV['RUBYOPT']) &&
|
25
|
-
rubyopt.
|
26
|
-
|
25
|
+
rubyopt.end_with?(added_opt)
|
26
|
+
|
27
|
+
ENV['RUBYOPT'] = rubyopt.delete_suffix(added_opt)
|
27
28
|
ENV['RUBY_DEBUG_ADDED_RUBYOPT'] = nil
|
28
29
|
end
|
29
30
|
|
@@ -212,18 +213,24 @@ module DEBUGGER__
|
|
212
213
|
|
213
214
|
def process_event evt
|
214
215
|
# variable `@internal_info` is only used for test
|
215
|
-
|
216
|
+
tc, output, ev, @internal_info, *ev_args = evt
|
216
217
|
|
217
218
|
output.each{|str| @ui.puts str} if ev != :suspend
|
218
219
|
|
219
|
-
|
220
|
-
|
221
|
-
|
220
|
+
# special event, tc is nil
|
221
|
+
# and we don't want to set @tc to the newly created thread's ThreadClient
|
222
|
+
if ev == :thread_begin
|
222
223
|
th = ev_args.shift
|
223
224
|
q = ev_args.shift
|
224
225
|
on_thread_begin th
|
225
226
|
q << true
|
226
227
|
|
228
|
+
return
|
229
|
+
end
|
230
|
+
|
231
|
+
@tc = tc
|
232
|
+
|
233
|
+
case ev
|
227
234
|
when :init
|
228
235
|
enter_subsession
|
229
236
|
wait_command_loop
|
@@ -1886,9 +1893,11 @@ module DEBUGGER__
|
|
1886
1893
|
|
1887
1894
|
def after_fork child: true
|
1888
1895
|
if child || !@lock_file
|
1889
|
-
@m = Mutex.new
|
1890
|
-
@
|
1891
|
-
|
1896
|
+
@m = Mutex.new unless @m
|
1897
|
+
@m.synchronize do
|
1898
|
+
@lock_level = 0
|
1899
|
+
@lock_file = open(@lock_tempfile.path, 'w')
|
1900
|
+
end
|
1892
1901
|
end
|
1893
1902
|
end
|
1894
1903
|
|
@@ -2120,7 +2129,7 @@ module DEBUGGER__
|
|
2120
2129
|
end
|
2121
2130
|
|
2122
2131
|
# Inspector
|
2123
|
-
|
2132
|
+
|
2124
2133
|
SHORT_INSPECT_LENGTH = 40
|
2125
2134
|
|
2126
2135
|
class LimitedPP
|
@@ -2222,7 +2231,7 @@ module DEBUGGER__
|
|
2222
2231
|
# depend on the file system. So this check is only roughly estimation.
|
2223
2232
|
|
2224
2233
|
def self.compare_path(a, b)
|
2225
|
-
a
|
2234
|
+
a&.downcase == b&.downcase
|
2226
2235
|
end
|
2227
2236
|
else
|
2228
2237
|
def self.compare_path(a, b)
|
data/lib/debug/thread_client.rb
CHANGED
@@ -568,7 +568,7 @@ module DEBUGGER__
|
|
568
568
|
unless only_self
|
569
569
|
s.ancestors.each{|c| break if c == Object; cs[c] = :ancestors}
|
570
570
|
if b = current_frame&.binding
|
571
|
-
b.eval('Module.nesting').each{|c| cs[c] = :nesting unless cs.has_key? c}
|
571
|
+
b.eval('::Module.nesting').each{|c| cs[c] = :nesting unless cs.has_key? c}
|
572
572
|
end
|
573
573
|
end
|
574
574
|
|
data/lib/debug/version.rb
CHANGED
data/lib/debug.rb
CHANGED
data/misc/README.md.erb
CHANGED
@@ -438,12 +438,12 @@ $ rdbg target.rb --open=chrome
|
|
438
438
|
DEBUGGER: Debugger can attach via TCP/IP (127.0.0.1:43633)
|
439
439
|
DEBUGGER: With Chrome browser, type the following URL in the address-bar:
|
440
440
|
|
441
|
-
devtools://devtools/bundled/inspector.html?ws=127.0.0.1:
|
441
|
+
devtools://devtools/bundled/inspector.html?v8only=true&panel=sources&ws=127.0.0.1:57231/b32a55cd-2eb5-4c5c-87d8-b3dfc59d80ef
|
442
442
|
|
443
443
|
DEBUGGER: wait for debugger connection...
|
444
444
|
```
|
445
445
|
|
446
|
-
Type `devtools://devtools/bundled/inspector.html?ws=127.0.0.1:
|
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
|
|
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.6.
|
4
|
+
version: 1.6.3
|
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-
|
11
|
+
date: 2022-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: irb
|