readapt 0.6.2 → 0.7.0
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/CHANGELOG.md +4 -0
- data/lib/readapt.rb +1 -0
- data/lib/readapt/breakpoint.rb +13 -0
- data/lib/readapt/debugger.rb +34 -0
- data/lib/readapt/message/set_breakpoints.rb +7 -3
- data/lib/readapt/shell.rb +9 -4
- data/lib/readapt/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7be0d8ef56332ff58877c89e39b738afc657a831c753c28412f4e418b5edfbc9
|
|
4
|
+
data.tar.gz: cc7c1cc3bcf5e0ca5aadbc67dd03e97549ad9ef9fb047c737898ab7b9a7b1d96
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5828479f0932064d54fb722763e31d0c9cf5c4edb65d24e1fb712254ff641ee2c10af0ec5b2f248b945fd2d3eecf8e08204face7ad884e6809cc0161ecaca0ac
|
|
7
|
+
data.tar.gz: b7aaabdcf80008587403f20e24d03c537f20e33eaf977f18b3fea60687f8fb9e12e641baefda5a0ea85a31ff63339892dd78aa44fc1ae04f2e2aedcec4dfb285
|
data/CHANGELOG.md
CHANGED
data/lib/readapt.rb
CHANGED
data/lib/readapt/debugger.rb
CHANGED
|
@@ -23,6 +23,7 @@ module Readapt
|
|
|
23
23
|
@config = {}
|
|
24
24
|
@original_argv = ARGV.clone
|
|
25
25
|
@machine = machine
|
|
26
|
+
@breakpoints = {}
|
|
26
27
|
end
|
|
27
28
|
|
|
28
29
|
def config arguments, request
|
|
@@ -91,6 +92,20 @@ module Readapt
|
|
|
91
92
|
})
|
|
92
93
|
end
|
|
93
94
|
|
|
95
|
+
def get_breakpoint source, line
|
|
96
|
+
@breakpoints["#{source}:#{line}"] || Breakpoint.new(source, line, nil)
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def set_breakpoint source, line, condition
|
|
100
|
+
@breakpoints["#{source}:#{line}"] = Breakpoint.new(source, line, condition)
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def clear_breakpoints source
|
|
104
|
+
@breakpoints.delete_if { |key, value|
|
|
105
|
+
value.source == source
|
|
106
|
+
}
|
|
107
|
+
end
|
|
108
|
+
|
|
94
109
|
def disconnect
|
|
95
110
|
shutdown if launched?
|
|
96
111
|
@request = nil
|
|
@@ -126,6 +141,25 @@ module Readapt
|
|
|
126
141
|
# elsif snapshot.event == :entry
|
|
127
142
|
# snapshot.control = :continue
|
|
128
143
|
else
|
|
144
|
+
if snapshot.event == :breakpoint
|
|
145
|
+
bp = get_breakpoint(snapshot.file, snapshot.line)
|
|
146
|
+
unless bp.condition.nil? || bp.condition.empty?
|
|
147
|
+
# @type [Binding]
|
|
148
|
+
bnd = ObjectSpace._id2ref(snapshot.binding_id)
|
|
149
|
+
begin
|
|
150
|
+
unless bnd.eval(bp.condition)
|
|
151
|
+
snapshot.control = :continue
|
|
152
|
+
return
|
|
153
|
+
end
|
|
154
|
+
rescue Exception => e
|
|
155
|
+
STDERR.puts "Breakpoint condition raised an error"
|
|
156
|
+
STDERR.puts "#{snapshot.file}:#{snapshot.line} - `#{bp.condition}`"
|
|
157
|
+
STDERR.puts "[#{e.class}] #{e.message}"
|
|
158
|
+
snapshot.control = :continue
|
|
159
|
+
return
|
|
160
|
+
end
|
|
161
|
+
end
|
|
162
|
+
end
|
|
129
163
|
changed
|
|
130
164
|
thread = self.thread(snapshot.thread_id)
|
|
131
165
|
thread.control = :pause
|
|
@@ -5,16 +5,20 @@ module Readapt
|
|
|
5
5
|
class SetBreakpoints < Base
|
|
6
6
|
def run
|
|
7
7
|
path = Readapt.normalize_path(arguments['source']['path'])
|
|
8
|
-
|
|
8
|
+
debugger.clear_breakpoints path
|
|
9
|
+
lines = []
|
|
9
10
|
set_body(
|
|
10
|
-
breakpoints: arguments['
|
|
11
|
+
breakpoints: arguments['breakpoints'].map do |val|
|
|
12
|
+
debugger.set_breakpoint path, val['line'], val['condition']
|
|
13
|
+
lines.push val['line']
|
|
11
14
|
{
|
|
12
15
|
verified: true, # @todo Verify
|
|
13
16
|
source: arguments['source'],
|
|
14
|
-
line:
|
|
17
|
+
line: val['line']
|
|
15
18
|
}
|
|
16
19
|
end
|
|
17
20
|
)
|
|
21
|
+
Breakpoints.set(path, lines)
|
|
18
22
|
end
|
|
19
23
|
end
|
|
20
24
|
end
|
data/lib/readapt/shell.rb
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
require 'thor'
|
|
2
|
-
require 'socket'
|
|
3
|
-
require 'stringio'
|
|
4
2
|
require 'backport'
|
|
5
3
|
|
|
6
4
|
module Readapt
|
|
@@ -19,10 +17,10 @@ module Readapt
|
|
|
19
17
|
machine = Backport::Machine.new
|
|
20
18
|
machine.run do
|
|
21
19
|
Signal.trap("INT") do
|
|
22
|
-
|
|
20
|
+
graceful_shutdown
|
|
23
21
|
end
|
|
24
22
|
Signal.trap("TERM") do
|
|
25
|
-
|
|
23
|
+
graceful_shutdown
|
|
26
24
|
end
|
|
27
25
|
debugger = Readapt::Debugger.new(machine)
|
|
28
26
|
Readapt::Adapter.host debugger
|
|
@@ -30,5 +28,12 @@ module Readapt
|
|
|
30
28
|
STDERR.puts "Readapt Debugger #{Readapt::VERSION} is listening HOST=#{options[:host]} PORT=#{options[:port]} PID=#{Process.pid}"
|
|
31
29
|
end
|
|
32
30
|
end
|
|
31
|
+
|
|
32
|
+
private
|
|
33
|
+
|
|
34
|
+
def graceful_shutdown
|
|
35
|
+
Backport.stop
|
|
36
|
+
exit
|
|
37
|
+
end
|
|
33
38
|
end
|
|
34
39
|
end
|
data/lib/readapt/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: readapt
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.7.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Fred Snyder
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2019-
|
|
11
|
+
date: 2019-10-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: backport
|
|
@@ -130,6 +130,7 @@ files:
|
|
|
130
130
|
- ext/readapt/threads.h
|
|
131
131
|
- lib/readapt.rb
|
|
132
132
|
- lib/readapt/adapter.rb
|
|
133
|
+
- lib/readapt/breakpoint.rb
|
|
133
134
|
- lib/readapt/debugger.rb
|
|
134
135
|
- lib/readapt/finder.rb
|
|
135
136
|
- lib/readapt/frame.rb
|