readapt 1.4.1 → 1.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +16 -16
- data/.rspec +2 -2
- data/.travis.yml +19 -19
- data/CHANGELOG.md +97 -91
- data/Gemfile +4 -4
- data/LICENSE.txt +21 -21
- data/README.md +37 -37
- data/Rakefile +14 -14
- data/bin/console +14 -14
- data/bin/setup +8 -8
- data/exe/readapt +5 -5
- data/ext/readapt/breakpoints.c +83 -83
- data/ext/readapt/breakpoints.h +11 -11
- data/ext/readapt/extconf.rb +0 -0
- data/ext/readapt/frame.c +137 -137
- data/ext/readapt/frame.h +17 -17
- data/ext/readapt/inspector.c +51 -51
- data/ext/readapt/inspector.h +8 -8
- data/ext/readapt/lookup_table.c +211 -211
- data/ext/readapt/lookup_table.h +30 -30
- data/ext/readapt/monitor.c +2 -2
- data/ext/readapt/monitor.h +0 -0
- data/ext/readapt/normalize.c +62 -59
- data/ext/readapt/normalize.h +7 -7
- data/ext/readapt/readapt.c +18 -18
- data/ext/readapt/stack.c +86 -86
- data/ext/readapt/stack.h +20 -20
- data/ext/readapt/threads.c +0 -0
- data/ext/readapt/threads.h +0 -0
- data/lib/readapt.rb +21 -21
- data/lib/readapt/adapter.rb +98 -98
- data/lib/readapt/breakpoint.rb +21 -21
- data/lib/readapt/data_reader.rb +62 -62
- data/lib/readapt/debugger.rb +227 -227
- data/lib/readapt/error.rb +63 -63
- data/lib/readapt/finder.rb +34 -34
- data/lib/readapt/frame.rb +40 -40
- data/lib/readapt/input.rb +7 -7
- data/lib/readapt/message.rb +62 -62
- data/lib/readapt/message/attach.rb +11 -11
- data/lib/readapt/message/base.rb +32 -32
- data/lib/readapt/message/configuration_done.rb +11 -11
- data/lib/readapt/message/continue.rb +15 -15
- data/lib/readapt/message/disconnect.rb +13 -13
- data/lib/readapt/message/evaluate.rb +18 -18
- data/lib/readapt/message/initialize.rb +21 -21
- data/lib/readapt/message/launch.rb +11 -11
- data/lib/readapt/message/next.rb +12 -12
- data/lib/readapt/message/pause.rb +11 -11
- data/lib/readapt/message/scopes.rb +26 -26
- data/lib/readapt/message/set_breakpoints.rb +25 -25
- data/lib/readapt/message/set_exception_breakpoints.rb +11 -11
- data/lib/readapt/message/stack_trace.rb +38 -38
- data/lib/readapt/message/step_in.rb +11 -11
- data/lib/readapt/message/step_out.rb +11 -11
- data/lib/readapt/message/threads.rb +18 -18
- data/lib/readapt/message/variables.rb +53 -53
- data/lib/readapt/monitor.rb +0 -0
- data/lib/readapt/output.rb +25 -25
- data/lib/readapt/references.rb +27 -27
- data/lib/readapt/server.rb +22 -22
- data/lib/readapt/shell.rb +104 -104
- data/lib/readapt/snapshot.rb +0 -0
- data/lib/readapt/thread.rb +20 -20
- data/lib/readapt/variable.rb +0 -0
- data/lib/readapt/version.rb +3 -3
- data/readapt.gemspec +39 -39
- metadata +6 -6
@@ -1,11 +1,11 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Readapt
|
4
|
-
module Message
|
5
|
-
class ConfigurationDone < Base
|
6
|
-
def run
|
7
|
-
debugger.start
|
8
|
-
end
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Readapt
|
4
|
+
module Message
|
5
|
+
class ConfigurationDone < Base
|
6
|
+
def run
|
7
|
+
debugger.start
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -1,15 +1,15 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Readapt
|
4
|
-
module Message
|
5
|
-
class Continue < Base
|
6
|
-
def run
|
7
|
-
thread = debugger.thread(arguments['threadId'])
|
8
|
-
thread.control = :continue
|
9
|
-
set_body({
|
10
|
-
allThreadsContinued: false
|
11
|
-
})
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Readapt
|
4
|
+
module Message
|
5
|
+
class Continue < Base
|
6
|
+
def run
|
7
|
+
thread = debugger.thread(arguments['threadId'])
|
8
|
+
thread.control = :continue
|
9
|
+
set_body({
|
10
|
+
allThreadsContinued: false
|
11
|
+
})
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -1,13 +1,13 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Readapt
|
4
|
-
module Message
|
5
|
-
class Disconnect < Base
|
6
|
-
def run
|
7
|
-
# The message only sets an empty body to acknowledge that the request
|
8
|
-
# was received. The adapter handles the actual disconnection process.
|
9
|
-
set_body({})
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Readapt
|
4
|
+
module Message
|
5
|
+
class Disconnect < Base
|
6
|
+
def run
|
7
|
+
# The message only sets an empty body to acknowledge that the request
|
8
|
+
# was received. The adapter handles the actual disconnection process.
|
9
|
+
set_body({})
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -1,18 +1,18 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'json'
|
4
|
-
|
5
|
-
module Readapt
|
6
|
-
module Message
|
7
|
-
class Evaluate < Base
|
8
|
-
def run
|
9
|
-
ref = arguments['frameId']
|
10
|
-
frame = debugger.frame(ref)
|
11
|
-
result = frame.evaluate(arguments['expression'])
|
12
|
-
set_body(
|
13
|
-
result: result
|
14
|
-
)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
module Readapt
|
6
|
+
module Message
|
7
|
+
class Evaluate < Base
|
8
|
+
def run
|
9
|
+
ref = arguments['frameId']
|
10
|
+
frame = debugger.frame(ref)
|
11
|
+
result = frame.evaluate(arguments['expression'])
|
12
|
+
set_body(
|
13
|
+
result: result
|
14
|
+
)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -1,21 +1,21 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Readapt
|
4
|
-
module Message
|
5
|
-
class Initialize < Base
|
6
|
-
def run
|
7
|
-
set_body({
|
8
|
-
supportsConfigurationDoneRequest: true,
|
9
|
-
exceptionBreakpointFilters: [
|
10
|
-
{
|
11
|
-
filter: 'raise',
|
12
|
-
label: 'Break on raised exceptions',
|
13
|
-
description: 'The debugger will break when an exception is raised, regardless of whether it is subsequently rescued.',
|
14
|
-
default: false
|
15
|
-
}
|
16
|
-
]
|
17
|
-
})
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Readapt
|
4
|
+
module Message
|
5
|
+
class Initialize < Base
|
6
|
+
def run
|
7
|
+
set_body({
|
8
|
+
supportsConfigurationDoneRequest: true,
|
9
|
+
exceptionBreakpointFilters: [
|
10
|
+
{
|
11
|
+
filter: 'raise',
|
12
|
+
label: 'Break on raised exceptions',
|
13
|
+
description: 'The debugger will break when an exception is raised, regardless of whether it is subsequently rescued.',
|
14
|
+
default: false
|
15
|
+
}
|
16
|
+
]
|
17
|
+
})
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -1,11 +1,11 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Readapt
|
4
|
-
module Message
|
5
|
-
class Launch < Base
|
6
|
-
def run
|
7
|
-
debugger.config arguments, :launch
|
8
|
-
end
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Readapt
|
4
|
+
module Message
|
5
|
+
class Launch < Base
|
6
|
+
def run
|
7
|
+
debugger.config arguments, :launch
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
data/lib/readapt/message/next.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Readapt
|
4
|
-
module Message
|
5
|
-
class Next < Base
|
6
|
-
def run
|
7
|
-
thread = debugger.thread(arguments['threadId'])
|
8
|
-
thread.control = :next
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Readapt
|
4
|
+
module Message
|
5
|
+
class Next < Base
|
6
|
+
def run
|
7
|
+
thread = debugger.thread(arguments['threadId'])
|
8
|
+
thread.control = :next
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -1,11 +1,11 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Readapt
|
4
|
-
module Message
|
5
|
-
class Pause < Base
|
6
|
-
def run
|
7
|
-
Monitor.pause arguments['threadId']
|
8
|
-
end
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Readapt
|
4
|
+
module Message
|
5
|
+
class Pause < Base
|
6
|
+
def run
|
7
|
+
Monitor.pause arguments['threadId']
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -1,26 +1,26 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Readapt
|
4
|
-
module Message
|
5
|
-
class Scopes < Base
|
6
|
-
def run
|
7
|
-
frame = debugger.frame(arguments['frameId'])
|
8
|
-
set_body({
|
9
|
-
scopes: [
|
10
|
-
{
|
11
|
-
name: 'Local',
|
12
|
-
variablesReference: frame.local_id,
|
13
|
-
expensive: false
|
14
|
-
},
|
15
|
-
{
|
16
|
-
name: 'Global',
|
17
|
-
# @todo 1 is a magic number representing the toplevel binding
|
18
|
-
variablesReference: 1,
|
19
|
-
expensive: true
|
20
|
-
}
|
21
|
-
]
|
22
|
-
})
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Readapt
|
4
|
+
module Message
|
5
|
+
class Scopes < Base
|
6
|
+
def run
|
7
|
+
frame = debugger.frame(arguments['frameId'])
|
8
|
+
set_body({
|
9
|
+
scopes: [
|
10
|
+
{
|
11
|
+
name: 'Local',
|
12
|
+
variablesReference: frame.local_id,
|
13
|
+
expensive: false
|
14
|
+
},
|
15
|
+
{
|
16
|
+
name: 'Global',
|
17
|
+
# @todo 1 is a magic number representing the toplevel binding
|
18
|
+
variablesReference: 1,
|
19
|
+
expensive: true
|
20
|
+
}
|
21
|
+
]
|
22
|
+
})
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -1,25 +1,25 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Readapt
|
4
|
-
module Message
|
5
|
-
class SetBreakpoints < Base
|
6
|
-
def run
|
7
|
-
path = Readapt.normalize_path(arguments['source']['path'])
|
8
|
-
debugger.clear_breakpoints path
|
9
|
-
lines = []
|
10
|
-
set_body(
|
11
|
-
breakpoints: arguments['breakpoints'].map do |val|
|
12
|
-
debugger.set_breakpoint path, val['line'], val['condition'], val['hitCondition']
|
13
|
-
lines.push val['line']
|
14
|
-
{
|
15
|
-
verified: true, # @todo Verify
|
16
|
-
source: arguments['source'],
|
17
|
-
line: val['line']
|
18
|
-
}
|
19
|
-
end
|
20
|
-
)
|
21
|
-
Breakpoints.set(path, lines)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Readapt
|
4
|
+
module Message
|
5
|
+
class SetBreakpoints < Base
|
6
|
+
def run
|
7
|
+
path = Readapt.normalize_path(arguments['source']['path'])
|
8
|
+
debugger.clear_breakpoints path
|
9
|
+
lines = []
|
10
|
+
set_body(
|
11
|
+
breakpoints: arguments['breakpoints'].map do |val|
|
12
|
+
debugger.set_breakpoint path, val['line'], val['condition'], val['hitCondition']
|
13
|
+
lines.push val['line']
|
14
|
+
{
|
15
|
+
verified: true, # @todo Verify
|
16
|
+
source: arguments['source'],
|
17
|
+
line: val['line']
|
18
|
+
}
|
19
|
+
end
|
20
|
+
)
|
21
|
+
Breakpoints.set(path, lines)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -1,11 +1,11 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Readapt
|
4
|
-
module Message
|
5
|
-
class SetExceptionBreakpoints < Base
|
6
|
-
def run
|
7
|
-
debugger.pause_on_raise = arguments['filters'] && arguments['filters'].include?('raise')
|
8
|
-
end
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Readapt
|
4
|
+
module Message
|
5
|
+
class SetExceptionBreakpoints < Base
|
6
|
+
def run
|
7
|
+
debugger.pause_on_raise = arguments['filters'] && arguments['filters'].include?('raise')
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -1,38 +1,38 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Readapt
|
4
|
-
module Message
|
5
|
-
class StackTrace < Base
|
6
|
-
@@file_hash = {}
|
7
|
-
|
8
|
-
def run
|
9
|
-
frames = debugger.thread(arguments['threadId']).frames
|
10
|
-
set_body({
|
11
|
-
stackFrames: frames.map do |frm|
|
12
|
-
{
|
13
|
-
name: frame_code(frm.file, frm.line),
|
14
|
-
source: {
|
15
|
-
name: frm.file ? File.basename(frm.file) : nil,
|
16
|
-
path: frm.file
|
17
|
-
},
|
18
|
-
id: frm.local_id,
|
19
|
-
line: frm.line,
|
20
|
-
column: 0
|
21
|
-
}
|
22
|
-
end,
|
23
|
-
totalFrames: frames.length
|
24
|
-
})
|
25
|
-
end
|
26
|
-
|
27
|
-
private
|
28
|
-
|
29
|
-
def read_file file
|
30
|
-
@@file_hash[file] ||= File.read(file)
|
31
|
-
end
|
32
|
-
|
33
|
-
def frame_code file, line
|
34
|
-
read_file(file).lines[line - 1].strip
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Readapt
|
4
|
+
module Message
|
5
|
+
class StackTrace < Base
|
6
|
+
@@file_hash = {}
|
7
|
+
|
8
|
+
def run
|
9
|
+
frames = debugger.thread(arguments['threadId']).frames
|
10
|
+
set_body({
|
11
|
+
stackFrames: frames.map do |frm|
|
12
|
+
{
|
13
|
+
name: frame_code(frm.file, frm.line),
|
14
|
+
source: {
|
15
|
+
name: frm.file ? File.basename(frm.file) : nil,
|
16
|
+
path: frm.file
|
17
|
+
},
|
18
|
+
id: frm.local_id,
|
19
|
+
line: frm.line,
|
20
|
+
column: 0
|
21
|
+
}
|
22
|
+
end,
|
23
|
+
totalFrames: frames.length
|
24
|
+
})
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def read_file file
|
30
|
+
@@file_hash[file] ||= File.read(file)
|
31
|
+
end
|
32
|
+
|
33
|
+
def frame_code file, line
|
34
|
+
read_file(file).lines[line - 1].strip
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -1,11 +1,11 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Readapt
|
4
|
-
module Message
|
5
|
-
class StepIn < Base
|
6
|
-
def run
|
7
|
-
debugger.thread(arguments['threadId']).control = :step_in
|
8
|
-
end
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Readapt
|
4
|
+
module Message
|
5
|
+
class StepIn < Base
|
6
|
+
def run
|
7
|
+
debugger.thread(arguments['threadId']).control = :step_in
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|