debug 1.2.0 → 1.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/ISSUE_TEMPLATE/bug_report.md +24 -0
- data/.github/ISSUE_TEMPLATE/custom.md +10 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +14 -0
- data/Rakefile +9 -6
- data/debug.gemspec +1 -1
- data/lib/debug/breakpoint.rb +2 -2
- data/lib/debug/client.rb +33 -32
- data/lib/debug/color.rb +25 -3
- data/lib/debug/config.rb +18 -1
- data/lib/debug/frame_info.rb +3 -3
- data/lib/debug/server_dap.rb +15 -13
- data/lib/debug/session.rb +4 -3
- data/lib/debug/version.rb +1 -1
- metadata +8 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6251dbcd2eb75a8b4932a740fe0294da996c7bcaaaa965f42353144786b5c0a
|
4
|
+
data.tar.gz: 328c4949a62eeb5277d8d6882c1a7da565b2c5aaa4c2fc5cf52850ca7e454240
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c8c83768d7d9eca50f18018dc9255a54234ee9c048d9885d54d46399e7bf9910ca87f85a9cd804108ec319ec985095016b00b1ab0d45a787fb55ef96b2a9483
|
7
|
+
data.tar.gz: 24c87a5fbef8a8c1851ffea1b21c53613389d0c8fa46a3a205562aa2c98f6515ad863e97a5ee8857914a0363110ef277bc961b8d04902b0a5f537f133f6f18af
|
@@ -0,0 +1,24 @@
|
|
1
|
+
---
|
2
|
+
name: Bug report
|
3
|
+
about: Create a report to help us improve
|
4
|
+
title: ''
|
5
|
+
labels: ''
|
6
|
+
assignees: ''
|
7
|
+
|
8
|
+
---
|
9
|
+
|
10
|
+
**Your environment**
|
11
|
+
|
12
|
+
* `ruby -v`:
|
13
|
+
* `rdbg -v`:
|
14
|
+
|
15
|
+
**Describe the bug**
|
16
|
+
A clear and concise description of what the bug is.
|
17
|
+
|
18
|
+
**To Reproduce**
|
19
|
+
|
20
|
+
**Expected behavior**
|
21
|
+
A clear and concise description of what you expected to happen.
|
22
|
+
|
23
|
+
**Additional context**
|
24
|
+
Add any other context about the problem here.
|
@@ -0,0 +1,14 @@
|
|
1
|
+
---
|
2
|
+
name: Feature request
|
3
|
+
about: Suggest an idea for this project
|
4
|
+
title: ''
|
5
|
+
labels: ''
|
6
|
+
assignees: ''
|
7
|
+
|
8
|
+
---
|
9
|
+
|
10
|
+
**Your proposal**
|
11
|
+
What is your idea?
|
12
|
+
|
13
|
+
**Additional context**
|
14
|
+
Add any other context or screenshots about the feature request here.
|
data/Rakefile
CHANGED
@@ -7,14 +7,17 @@ Rake::TestTask.new(:test) do |t|
|
|
7
7
|
t.test_files = FileList["test/**/*_test.rb"]
|
8
8
|
end
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
task :build => :compile
|
13
|
-
|
14
|
-
Rake::ExtensionTask.new("debug") do |ext|
|
15
|
-
|
10
|
+
begin
|
11
|
+
require "rake/extensiontask"
|
12
|
+
task :build => :compile
|
13
|
+
|
14
|
+
Rake::ExtensionTask.new("debug") do |ext|
|
15
|
+
ext.lib_dir = "lib/debug"
|
16
|
+
end
|
17
|
+
rescue LoadError
|
16
18
|
end
|
17
19
|
|
20
|
+
|
18
21
|
task :default => [:clobber, :compile, 'README.md', :test]
|
19
22
|
|
20
23
|
file 'README.md' => ['lib/debug/session.rb', 'lib/debug/config.rb',
|
data/debug.gemspec
CHANGED
@@ -25,6 +25,6 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.require_paths = ["lib"]
|
26
26
|
spec.extensions = ['ext/debug/extconf.rb']
|
27
27
|
|
28
|
-
spec.add_dependency "irb" # for its color_printer class, which was added after 1.3
|
28
|
+
spec.add_dependency "irb", ">= 1.3.6" # for its color_printer class, which was added after 1.3
|
29
29
|
spec.add_dependency "reline", ">= 0.2.7"
|
30
30
|
end
|
data/lib/debug/breakpoint.rb
CHANGED
@@ -437,7 +437,7 @@ module DEBUGGER__
|
|
437
437
|
end
|
438
438
|
end
|
439
439
|
|
440
|
-
rescue ArgumentError
|
440
|
+
rescue ArgumentError
|
441
441
|
raise if retried
|
442
442
|
retried = true
|
443
443
|
|
@@ -458,7 +458,7 @@ module DEBUGGER__
|
|
458
458
|
@override_method = true if @method
|
459
459
|
retry
|
460
460
|
end
|
461
|
-
rescue Exception
|
461
|
+
rescue Exception
|
462
462
|
raise unless added
|
463
463
|
end
|
464
464
|
|
data/lib/debug/client.rb
CHANGED
@@ -13,9 +13,37 @@ module DEBUGGER__
|
|
13
13
|
class CommandLineOptionError < Exception; end
|
14
14
|
|
15
15
|
class Client
|
16
|
-
|
17
|
-
|
16
|
+
class << self
|
17
|
+
def util name
|
18
|
+
case name
|
19
|
+
when 'gen-sockpath'
|
20
|
+
puts DEBUGGER__.create_unix_domain_socket_name
|
21
|
+
when 'list-socks'
|
22
|
+
cleanup_unix_domain_sockets
|
23
|
+
puts list_connections
|
24
|
+
else
|
25
|
+
raise "Unknown utility: #{name}"
|
26
|
+
end
|
27
|
+
end
|
18
28
|
|
29
|
+
def cleanup_unix_domain_sockets
|
30
|
+
Dir.glob(DEBUGGER__.create_unix_domain_socket_name_prefix + '*') do |file|
|
31
|
+
if /(\d+)$/ =~ file
|
32
|
+
begin
|
33
|
+
Process.kill(0, $1.to_i)
|
34
|
+
rescue Errno::ESRCH
|
35
|
+
File.unlink(file)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def list_connections
|
42
|
+
Dir.glob(DEBUGGER__.create_unix_domain_socket_name_prefix + '*')
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def initialize argv
|
19
47
|
@console = Console.new
|
20
48
|
|
21
49
|
case argv.size
|
@@ -48,34 +76,6 @@ module DEBUGGER__
|
|
48
76
|
@console.readline "(rdbg:remote) "
|
49
77
|
end
|
50
78
|
|
51
|
-
def util name
|
52
|
-
case name
|
53
|
-
when 'gen-sockpath'
|
54
|
-
puts DEBUGGER__.create_unix_domain_socket_name
|
55
|
-
when 'list-socks'
|
56
|
-
cleanup_unix_domain_sockets
|
57
|
-
puts list_connections
|
58
|
-
else
|
59
|
-
raise "Unknown utility: #{name}"
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
def cleanup_unix_domain_sockets
|
64
|
-
Dir.glob(DEBUGGER__.create_unix_domain_socket_name_prefix + '*') do |file|
|
65
|
-
if /(\d+)$/ =~ file
|
66
|
-
begin
|
67
|
-
Process.kill(0, $1.to_i)
|
68
|
-
rescue Errno::ESRCH
|
69
|
-
File.unlink(file)
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
def list_connections
|
76
|
-
Dir.glob(DEBUGGER__.create_unix_domain_socket_name_prefix + '*')
|
77
|
-
end
|
78
|
-
|
79
79
|
def connect_unix name = nil
|
80
80
|
if name
|
81
81
|
if File.exist? name
|
@@ -84,8 +84,9 @@ module DEBUGGER__
|
|
84
84
|
@s = Socket.unix(File.join(DEBUGGER__.unix_domain_socket_dir, name))
|
85
85
|
end
|
86
86
|
else
|
87
|
-
cleanup_unix_domain_sockets
|
88
|
-
files = list_connections
|
87
|
+
Client.cleanup_unix_domain_sockets
|
88
|
+
files = Client.list_connections
|
89
|
+
|
89
90
|
case files.size
|
90
91
|
when 0
|
91
92
|
$stderr.puts "No debug session is available."
|
data/lib/debug/color.rb
CHANGED
@@ -17,9 +17,25 @@ end
|
|
17
17
|
module DEBUGGER__
|
18
18
|
module Color
|
19
19
|
if defined? IRB::Color.colorize
|
20
|
+
begin
|
21
|
+
IRB::Color.colorize('', [:DIM], colorable: true)
|
22
|
+
SUPPORT_COLORABLE_OPTION = true
|
23
|
+
rescue ArgumentError
|
24
|
+
end
|
25
|
+
|
26
|
+
if defined? SUPPORT_COLORABLE_OPTION
|
27
|
+
def irb_colorize str, color
|
28
|
+
IRB::Color.colorize str, color, colorable: true
|
29
|
+
end
|
30
|
+
else
|
31
|
+
def irb_colorize str, color
|
32
|
+
IRB::Color.colorize str, color
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
20
36
|
def colorize str, color
|
21
37
|
if !CONFIG[:no_color]
|
22
|
-
|
38
|
+
irb_colorize str, color
|
23
39
|
else
|
24
40
|
str
|
25
41
|
end
|
@@ -63,8 +79,14 @@ module DEBUGGER__
|
|
63
79
|
end
|
64
80
|
|
65
81
|
if defined? IRB::Color.colorize_code
|
66
|
-
|
67
|
-
|
82
|
+
if SUPPORT_COLORABLE_OPTION
|
83
|
+
def colorize_code code
|
84
|
+
IRB::Color.colorize_code(code, colorable: true)
|
85
|
+
end
|
86
|
+
else
|
87
|
+
def colorize_code code
|
88
|
+
IRB::Color.colorize_code(code)
|
89
|
+
end
|
68
90
|
end
|
69
91
|
else
|
70
92
|
def colorize_code code
|
data/lib/debug/config.rb
CHANGED
@@ -313,7 +313,7 @@ module DEBUGGER__
|
|
313
313
|
|
314
314
|
o.on('--util=NAME', 'Utility mode (used by tools)') do |name|
|
315
315
|
require_relative 'client'
|
316
|
-
Client.
|
316
|
+
Client.util(name)
|
317
317
|
exit
|
318
318
|
end
|
319
319
|
|
@@ -352,9 +352,26 @@ module DEBUGGER__
|
|
352
352
|
## Unix domain socket configuration
|
353
353
|
|
354
354
|
def self.unix_domain_socket_dir
|
355
|
+
require 'tmpdir'
|
356
|
+
|
355
357
|
case
|
356
358
|
when path = CONFIG[:sock_dir]
|
357
359
|
when path = ENV['XDG_RUNTIME_DIR']
|
360
|
+
when tmpdir = Dir.tmpdir
|
361
|
+
path = File.join(tmpdir, "ruby-debug-sock-#{Process.uid}")
|
362
|
+
|
363
|
+
if File.exist?(path)
|
364
|
+
fs = File.stat(path)
|
365
|
+
unless (dir_uid = fs.uid) == (uid = Process.uid)
|
366
|
+
raise "#{path} uid is #{dir_uid}, but Process.uid is #{uid}"
|
367
|
+
end
|
368
|
+
unless (dir_mode = fs.mode) == 040700 # 4: dir, 7:rwx
|
369
|
+
raise "#{path}'s mode is #{dir_mode.to_s(8)} (should be 040700)"
|
370
|
+
end
|
371
|
+
else
|
372
|
+
d = Dir.mktmpdir
|
373
|
+
File.rename(d, path)
|
374
|
+
end
|
358
375
|
when home = ENV['HOME']
|
359
376
|
path = File.join(home, '.ruby-debug-sock')
|
360
377
|
|
data/lib/debug/frame_info.rb
CHANGED
@@ -9,10 +9,10 @@ module DEBUGGER__
|
|
9
9
|
)
|
10
10
|
|
11
11
|
# extend FrameInfo with debug.so
|
12
|
-
|
12
|
+
begin
|
13
13
|
require_relative 'debug.so'
|
14
|
-
|
15
|
-
|
14
|
+
rescue LoadError
|
15
|
+
require 'debug/debug.so'
|
16
16
|
end
|
17
17
|
|
18
18
|
class FrameInfo
|
data/lib/debug/server_dap.rb
CHANGED
@@ -182,7 +182,7 @@ module DEBUGGER__
|
|
182
182
|
@q_msg << 'continue'
|
183
183
|
when 'attach'
|
184
184
|
send_response req
|
185
|
-
Process.kill(:
|
185
|
+
Process.kill(:SIGURG, Process.pid)
|
186
186
|
when 'disconnect'
|
187
187
|
send_response req
|
188
188
|
@q_msg << 'continue'
|
@@ -205,7 +205,7 @@ module DEBUGGER__
|
|
205
205
|
exit
|
206
206
|
when 'pause'
|
207
207
|
send_response req
|
208
|
-
Process.kill(:
|
208
|
+
Process.kill(:SIGURG, Process.pid)
|
209
209
|
when 'reverseContinue'
|
210
210
|
send_response req,
|
211
211
|
success: false, message: 'cancelled',
|
@@ -256,7 +256,7 @@ module DEBUGGER__
|
|
256
256
|
def event type, *args
|
257
257
|
case type
|
258
258
|
when :suspend_bp
|
259
|
-
_i, bp = *args
|
259
|
+
_i, bp, tid = *args
|
260
260
|
if bp.kind_of?(CatchBreakpoint)
|
261
261
|
reason = 'exception'
|
262
262
|
text = bp.description
|
@@ -268,24 +268,26 @@ module DEBUGGER__
|
|
268
268
|
send_event 'stopped', reason: reason,
|
269
269
|
description: text,
|
270
270
|
text: text,
|
271
|
-
threadId:
|
271
|
+
threadId: tid,
|
272
272
|
allThreadsStopped: true
|
273
273
|
when :suspend_trap
|
274
|
+
_sig, tid = *args
|
274
275
|
send_event 'stopped', reason: 'pause',
|
275
|
-
threadId:
|
276
|
+
threadId: tid,
|
276
277
|
allThreadsStopped: true
|
277
278
|
when :suspended
|
279
|
+
tid, = *args
|
278
280
|
send_event 'stopped', reason: 'step',
|
279
|
-
threadId:
|
281
|
+
threadId: tid,
|
280
282
|
allThreadsStopped: true
|
281
283
|
end
|
282
284
|
end
|
283
285
|
end
|
284
286
|
|
285
287
|
class Session
|
286
|
-
def
|
288
|
+
def find_waiting_tc id
|
287
289
|
@th_clients.each{|th, tc|
|
288
|
-
return tc if tc.id == id
|
290
|
+
return tc if tc.id == id && tc.waiting?
|
289
291
|
}
|
290
292
|
return nil
|
291
293
|
end
|
@@ -306,7 +308,7 @@ module DEBUGGER__
|
|
306
308
|
|
307
309
|
when 'stackTrace'
|
308
310
|
tid = req.dig('arguments', 'threadId')
|
309
|
-
if tc =
|
311
|
+
if tc = find_waiting_tc(tid)
|
310
312
|
tc << [:dap, :backtrace, req]
|
311
313
|
else
|
312
314
|
fail_response req
|
@@ -315,7 +317,7 @@ module DEBUGGER__
|
|
315
317
|
frame_id = req.dig('arguments', 'frameId')
|
316
318
|
if @frame_map[frame_id]
|
317
319
|
tid, fid = @frame_map[frame_id]
|
318
|
-
if tc =
|
320
|
+
if tc = find_waiting_tc(tid)
|
319
321
|
tc << [:dap, :scopes, req, fid]
|
320
322
|
else
|
321
323
|
fail_response req
|
@@ -348,7 +350,7 @@ module DEBUGGER__
|
|
348
350
|
frame_id = ref[1]
|
349
351
|
tid, fid = @frame_map[frame_id]
|
350
352
|
|
351
|
-
if tc =
|
353
|
+
if tc = find_waiting_tc(tid)
|
352
354
|
tc << [:dap, :scope, req, fid]
|
353
355
|
else
|
354
356
|
fail_response req
|
@@ -357,7 +359,7 @@ module DEBUGGER__
|
|
357
359
|
when :variable
|
358
360
|
tid, vid = ref[1], ref[2]
|
359
361
|
|
360
|
-
if tc =
|
362
|
+
if tc = find_waiting_tc(tid)
|
361
363
|
tc << [:dap, :variable, req, vid]
|
362
364
|
else
|
363
365
|
fail_response req
|
@@ -373,7 +375,7 @@ module DEBUGGER__
|
|
373
375
|
if @frame_map[frame_id]
|
374
376
|
tid, fid = @frame_map[frame_id]
|
375
377
|
expr = req.dig('arguments', 'expression')
|
376
|
-
if tc =
|
378
|
+
if tc = find_waiting_tc(tid)
|
377
379
|
tc << [:dap, :evaluate, req, fid, expr]
|
378
380
|
else
|
379
381
|
fail_response req
|
data/lib/debug/session.rb
CHANGED
@@ -25,6 +25,7 @@ require_relative 'tracer'
|
|
25
25
|
|
26
26
|
# To prevent loading old lib/debug.rb in Ruby 2.6 to 3.0
|
27
27
|
$LOADED_FEATURES << 'debug.rb'
|
28
|
+
$LOADED_FEATURES << File.expand_path(File.join(__dir__, '..', 'debug.rb'))
|
28
29
|
require 'debug' # invalidate the $LOADED_FEATURE cache
|
29
30
|
|
30
31
|
require 'json' if ENV['RUBY_DEBUG_TEST_MODE']
|
@@ -215,16 +216,16 @@ module DEBUGGER__
|
|
215
216
|
case ev_args.first
|
216
217
|
when :breakpoint
|
217
218
|
bp, i = bp_index ev_args[1]
|
218
|
-
@ui.event :suspend_bp, i, bp
|
219
|
+
@ui.event :suspend_bp, i, bp, tc.id
|
219
220
|
when :trap
|
220
|
-
@ui.event :suspend_trap, sig = ev_args[1]
|
221
|
+
@ui.event :suspend_trap, sig = ev_args[1], tc.id
|
221
222
|
|
222
223
|
if sig == :SIGINT && (@intercepted_sigint_cmd.kind_of?(Proc) || @intercepted_sigint_cmd.kind_of?(String))
|
223
224
|
@ui.puts "#{@intercepted_sigint_cmd.inspect} is registerred as SIGINT handler."
|
224
225
|
@ui.puts "`sigint` command execute it."
|
225
226
|
end
|
226
227
|
else
|
227
|
-
@ui.event :suspended
|
228
|
+
@ui.event :suspended, tc.id
|
228
229
|
end
|
229
230
|
|
230
231
|
if @displays.empty?
|
data/lib/debug/version.rb
CHANGED
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.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Koichi Sasada
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-10-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: irb
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 1.3.6
|
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:
|
26
|
+
version: 1.3.6
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: reline
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -48,6 +48,9 @@ extensions:
|
|
48
48
|
- ext/debug/extconf.rb
|
49
49
|
extra_rdoc_files: []
|
50
50
|
files:
|
51
|
+
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
52
|
+
- ".github/ISSUE_TEMPLATE/custom.md"
|
53
|
+
- ".github/ISSUE_TEMPLATE/feature_request.md"
|
51
54
|
- ".github/workflows/ruby.yml"
|
52
55
|
- ".gitignore"
|
53
56
|
- CONTRIBUTING.md
|
@@ -106,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
109
|
- !ruby/object:Gem::Version
|
107
110
|
version: '0'
|
108
111
|
requirements: []
|
109
|
-
rubygems_version: 3.
|
112
|
+
rubygems_version: 3.3.0.dev
|
110
113
|
signing_key:
|
111
114
|
specification_version: 4
|
112
115
|
summary: Debugging functionality for Ruby
|