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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 78f83c7a7b44c3cae68d784d70fd653410ebce976c02bf846a9992f102634d98
4
- data.tar.gz: b34c3d6b060aa20db1794905aef969105070d556862ceac4cf02ccc88db9bf0a
3
+ metadata.gz: 61c14c6e761a2ed0f10294682cb7b152c4329d3cd0eccbffff68e3ae122d00a0
4
+ data.tar.gz: 714add08d21df0ceb674a8a9c8b8599f0dcc45cb38b68611c766fab1b6ddcd41
5
5
  SHA512:
6
- metadata.gz: c408ae087cd00a03e53410a9f6c3c54e2e4536d41784fb109dedd278d8b7941182a925593bf34991bfc2c15ed43e7baa20c736bde0aecb72b832fbdb4f4b55fe
7
- data.tar.gz: b223e415ae539a0b95303b065f029afe48cd2007697979d66ca94e157d7823b848ffd40c1ccc5e2947d69a8aa1c23c08961ade262bc6315f267ec73176c2d882
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 ``$ bin/gentest target.rb --open=chrome` there, Chrome will be executed.
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:43633
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:43633` 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
 
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
- rubyopt = env['RUBYOPT']
18
- env['RUBY_DEBUG_ADDED_RUBYOPT'] = added = "-r #{libpath}/#{start_mode}"
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
@@ -42,7 +42,7 @@ module DEBUGGER__
42
42
  when /csh/
43
43
  :csh
44
44
  when /zsh/
45
- :szh
45
+ :zsh
46
46
  when /dash/
47
47
  :dash
48
48
  else
data/lib/debug/prelude.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ return if ENV['RUBY_DEBUG_ENABLE'] == '0'
3
4
  return if defined?(::DEBUGGER__)
4
5
 
5
6
  # Put the following line in your login script (e.g. ~/.bash_profile) with modified path:
@@ -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)
@@ -263,7 +263,7 @@ module DEBUGGER__
263
263
 
264
264
  def process
265
265
  while req = recv_request
266
- raise "not a request: #{req.inpsect}" unless req['type'] == 'request'
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.start_with?(added_opt)
26
- ENV['RUBYOPT'] = rubyopt.delete_prefix(rubyopt)
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
- @tc, output, ev, @internal_info, *ev_args = evt
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
- case ev
220
-
221
- when :thread_begin # special event, tc is nil
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
- @lock_level = 0
1891
- @lock_file = open(@lock_tempfile.path, 'w')
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.downcase == b.downcase
2234
+ a&.downcase == b&.downcase
2226
2235
  end
2227
2236
  else
2228
2237
  def self.compare_path(a, b)
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DEBUGGER__
4
- VERSION = "1.6.1"
4
+ VERSION = "1.6.3"
5
5
  end
data/lib/debug.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative 'debug/session'
4
+ return unless defined?(DEBUGGER__)
4
5
  DEBUGGER__::start no_sigint_hook: true, nonstop: true
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:43633
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:43633` 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
 
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.1
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-07-13 00:00:00.000000000 Z
11
+ date: 2022-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: irb