debug 1.2.2 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/debug/breakpoint.rb +2 -2
- data/lib/debug/client.rb +33 -32
- data/lib/debug/config.rb +18 -1
- data/lib/debug/version.rb +1 -1
- 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: ebbeeac4c437bdefb9c0115008b705debb189b6332ee9ea056fd469c323c7149
|
4
|
+
data.tar.gz: 7a6abfb0490eaa49ec118efe89e50c51111be291a0b342fca930c3887a66aa72
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7bfb31a8b9b5fc882c20c28992ecdc501d4a11a8088023664ef2d590385e7ba3a8f756b92b74c607b0148e7e6710c213a14659ce8f33e10b261ee4031993582d
|
7
|
+
data.tar.gz: ad174799dd193021f845e971e08c19cc8c31bb915ee603659c33299c4a5e21d9bdf2e7687dfb1da75e0e573442fdc116b343d8caa7e54550ae62fbeea1ed6165
|
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/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/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.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: 2021-10-
|
11
|
+
date: 2021-10-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: irb
|