readapt 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +16 -15
  3. data/.rspec +2 -2
  4. data/.travis.yml +18 -18
  5. data/CHANGELOG.md +72 -69
  6. data/Gemfile +4 -4
  7. data/LICENSE.txt +21 -21
  8. data/README.md +37 -29
  9. data/Rakefile +14 -14
  10. data/bin/console +14 -14
  11. data/bin/setup +8 -8
  12. data/exe/readapt +5 -5
  13. data/ext/readapt/breakpoints.c +83 -83
  14. data/ext/readapt/breakpoints.h +11 -11
  15. data/ext/readapt/extconf.rb +0 -0
  16. data/ext/readapt/frame.c +137 -137
  17. data/ext/readapt/frame.h +17 -17
  18. data/ext/readapt/hash_table.c +211 -211
  19. data/ext/readapt/hash_table.h +30 -30
  20. data/ext/readapt/inspector.c +51 -51
  21. data/ext/readapt/inspector.h +8 -8
  22. data/ext/readapt/monitor.c +1 -1
  23. data/ext/readapt/monitor.h +0 -0
  24. data/ext/readapt/normalize.c +59 -59
  25. data/ext/readapt/normalize.h +7 -7
  26. data/ext/readapt/readapt.c +18 -18
  27. data/ext/readapt/stack.c +86 -86
  28. data/ext/readapt/stack.h +20 -20
  29. data/ext/readapt/threads.c +15 -11
  30. data/ext/readapt/threads.h +1 -1
  31. data/lib/readapt.rb +21 -20
  32. data/lib/readapt/adapter.rb +98 -98
  33. data/lib/readapt/breakpoint.rb +20 -20
  34. data/lib/readapt/data_reader.rb +62 -62
  35. data/lib/readapt/debugger.rb +220 -220
  36. data/lib/readapt/error.rb +63 -63
  37. data/lib/readapt/finder.rb +20 -20
  38. data/lib/readapt/frame.rb +40 -40
  39. data/lib/readapt/input.rb +7 -7
  40. data/lib/readapt/message.rb +62 -62
  41. data/lib/readapt/message/attach.rb +11 -11
  42. data/lib/readapt/message/base.rb +32 -32
  43. data/lib/readapt/message/configuration_done.rb +11 -11
  44. data/lib/readapt/message/continue.rb +15 -15
  45. data/lib/readapt/message/disconnect.rb +13 -13
  46. data/lib/readapt/message/evaluate.rb +18 -18
  47. data/lib/readapt/message/initialize.rb +13 -13
  48. data/lib/readapt/message/launch.rb +11 -11
  49. data/lib/readapt/message/next.rb +12 -12
  50. data/lib/readapt/message/pause.rb +11 -11
  51. data/lib/readapt/message/scopes.rb +26 -26
  52. data/lib/readapt/message/set_breakpoints.rb +25 -25
  53. data/lib/readapt/message/set_exception_breakpoints.rb +8 -8
  54. data/lib/readapt/message/stack_trace.rb +38 -38
  55. data/lib/readapt/message/step_in.rb +11 -11
  56. data/lib/readapt/message/step_out.rb +11 -11
  57. data/lib/readapt/message/threads.rb +18 -18
  58. data/lib/readapt/message/variables.rb +61 -61
  59. data/lib/readapt/monitor.rb +0 -0
  60. data/lib/readapt/output.rb +25 -25
  61. data/lib/readapt/references.rb +27 -0
  62. data/lib/readapt/server.rb +22 -22
  63. data/lib/readapt/shell.rb +104 -104
  64. data/lib/readapt/snapshot.rb +0 -0
  65. data/lib/readapt/thread.rb +23 -23
  66. data/lib/readapt/variable.rb +1 -1
  67. data/lib/readapt/version.rb +3 -3
  68. data/readapt.gemspec +39 -39
  69. metadata +4 -3
@@ -1,20 +1,20 @@
1
- require 'pathname'
2
-
3
- module Readapt
4
- module Finder
5
- module_function
6
-
7
- def find program
8
- return program if File.exist?(program)
9
- which(program) || raise(LoadError, "#{program} is not a valid Ruby file or program")
10
- end
11
-
12
- def which program
13
- ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
14
- exe = File.join(path, program)
15
- return exe if File.file?(exe)
16
- end
17
- nil
18
- end
19
- end
20
- end
1
+ require 'pathname'
2
+
3
+ module Readapt
4
+ module Finder
5
+ module_function
6
+
7
+ def find program
8
+ return program if File.exist?(program)
9
+ which(program) || raise(LoadError, "#{program} is not a valid Ruby file or program")
10
+ end
11
+
12
+ def which program
13
+ ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
14
+ exe = File.join(path, program)
15
+ return exe if File.file?(exe)
16
+ end
17
+ nil
18
+ end
19
+ end
20
+ end
@@ -1,40 +1,40 @@
1
- # frozen_string_literal: true
2
-
3
- module Readapt
4
- # @!method file
5
- # @return [String]
6
- # @!method line
7
- # @return [Integer]
8
- # @!method binding_id
9
- # @return [Integer]
10
- # @!method initialize(file, line, binding_id)
11
- class Frame
12
- def evaluate code
13
- frame_binding.eval(code).inspect
14
- rescue Exception => e
15
- "[#{e.class}] #{e.message}"
16
- end
17
-
18
- def local_id
19
- frame_binding.object_id
20
- end
21
-
22
- def locals
23
- return [] if frame_binding.nil?
24
- result = []
25
- frame_binding.local_variables.sort.each do |sym|
26
- var = frame_binding.local_variable_get(sym)
27
- result.push Variable.new(sym, var)
28
- end
29
- result.push Variable.new(:self, frame_binding.receiver)
30
- result
31
- end
32
-
33
- def local sym
34
- return frame_binding.receiver if sym == :self
35
- frame_binding.local_variable_get sym
36
- end
37
-
38
- NULL_FRAME = Frame.new("", 0, nil)
39
- end
40
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Readapt
4
+ # @!method file
5
+ # @return [String]
6
+ # @!method line
7
+ # @return [Integer]
8
+ # @!method binding_id
9
+ # @return [Integer]
10
+ # @!method initialize(file, line, binding_id)
11
+ class Frame
12
+ def evaluate code
13
+ frame_binding.eval(code).inspect
14
+ rescue Exception => e
15
+ "[#{e.class}] #{e.message}"
16
+ end
17
+
18
+ def local_id
19
+ frame_binding.object_id
20
+ end
21
+
22
+ def locals
23
+ return [] if frame_binding.nil?
24
+ result = []
25
+ frame_binding.local_variables.sort.each do |sym|
26
+ var = frame_binding.local_variable_get(sym)
27
+ result.push Variable.new(sym, var)
28
+ end
29
+ result.push Variable.new(:self, frame_binding.receiver)
30
+ result
31
+ end
32
+
33
+ def local sym
34
+ return frame_binding.receiver if sym == :self
35
+ frame_binding.local_variable_get sym
36
+ end
37
+
38
+ NULL_FRAME = Frame.new("", 0, nil)
39
+ end
40
+ end
@@ -1,7 +1,7 @@
1
- module Readapt
2
- module Input
3
- def receiving data
4
- print data
5
- end
6
- end
7
- end
1
+ module Readapt
2
+ module Input
3
+ def receiving data
4
+ print data
5
+ end
6
+ end
7
+ end
@@ -1,62 +1,62 @@
1
- # frozen_string_literal: true
2
-
3
- require 'readapt/message/base'
4
- require 'readapt/message/initialize'
5
- require 'readapt/message/launch'
6
- require 'readapt/message/set_breakpoints'
7
- require 'readapt/message/set_exception_breakpoints'
8
- require 'readapt/message/configuration_done'
9
- require 'readapt/message/threads'
10
- require 'readapt/message/stack_trace'
11
- require 'readapt/message/scopes'
12
- require 'readapt/message/continue'
13
- require 'readapt/message/variables'
14
- require 'readapt/message/next'
15
- require 'readapt/message/step_in'
16
- require 'readapt/message/step_out'
17
- require 'readapt/message/disconnect'
18
- require 'readapt/message/attach'
19
- require 'readapt/message/pause'
20
- require 'readapt/message/evaluate'
21
-
22
- module Readapt
23
- module Message
24
- @@messages = {}
25
- @@seq = 0
26
-
27
- def self.register name, klass
28
- @@messages[name] = klass
29
- end
30
-
31
- def self.process arguments, debugger
32
- klass = @@messages[arguments['command']]
33
- if klass.nil?
34
- STDERR.puts "Debugger received unrecognized command `#{arguments['command']}`"
35
- Message::Base.new(arguments, debugger)
36
- else
37
- message = klass.new(arguments['arguments'], debugger)
38
- message.run
39
- message
40
- end
41
- end
42
-
43
- register 'initialize', Message::Initialize
44
- register 'attach', Message::Attach
45
- register 'launch', Message::Launch
46
- register 'setBreakpoints', Message::SetBreakpoints
47
- register 'setExceptionBreakpoints', Message::SetExceptionBreakpoints
48
- register 'configurationDone', Message::ConfigurationDone
49
- register 'threads', Message::Threads
50
- register 'stackTrace', Message::StackTrace
51
- register 'scopes', Message::Scopes
52
- register 'continue', Message::Continue
53
- register 'variables', Message::Variables
54
- register 'next', Message::Next
55
- register 'stepIn', Message::StepIn
56
- register 'stepOut', Message::StepOut
57
- register 'disconnect', Message::Disconnect
58
- register 'pause', Message::Pause
59
- register 'evaluate', Message::Evaluate
60
- # register 'source', Message::Base # @todo Placeholder
61
- end
62
- end
1
+ # frozen_string_literal: true
2
+
3
+ require 'readapt/message/base'
4
+ require 'readapt/message/initialize'
5
+ require 'readapt/message/launch'
6
+ require 'readapt/message/set_breakpoints'
7
+ require 'readapt/message/set_exception_breakpoints'
8
+ require 'readapt/message/configuration_done'
9
+ require 'readapt/message/threads'
10
+ require 'readapt/message/stack_trace'
11
+ require 'readapt/message/scopes'
12
+ require 'readapt/message/continue'
13
+ require 'readapt/message/variables'
14
+ require 'readapt/message/next'
15
+ require 'readapt/message/step_in'
16
+ require 'readapt/message/step_out'
17
+ require 'readapt/message/disconnect'
18
+ require 'readapt/message/attach'
19
+ require 'readapt/message/pause'
20
+ require 'readapt/message/evaluate'
21
+
22
+ module Readapt
23
+ module Message
24
+ @@messages = {}
25
+ @@seq = 0
26
+
27
+ def self.register name, klass
28
+ @@messages[name] = klass
29
+ end
30
+
31
+ def self.process arguments, debugger
32
+ klass = @@messages[arguments['command']]
33
+ if klass.nil?
34
+ STDERR.puts "Debugger received unrecognized command `#{arguments['command']}`"
35
+ Message::Base.new(arguments, debugger)
36
+ else
37
+ message = klass.new(arguments['arguments'], debugger)
38
+ message.run
39
+ message
40
+ end
41
+ end
42
+
43
+ register 'initialize', Message::Initialize
44
+ register 'attach', Message::Attach
45
+ register 'launch', Message::Launch
46
+ register 'setBreakpoints', Message::SetBreakpoints
47
+ register 'setExceptionBreakpoints', Message::SetExceptionBreakpoints
48
+ register 'configurationDone', Message::ConfigurationDone
49
+ register 'threads', Message::Threads
50
+ register 'stackTrace', Message::StackTrace
51
+ register 'scopes', Message::Scopes
52
+ register 'continue', Message::Continue
53
+ register 'variables', Message::Variables
54
+ register 'next', Message::Next
55
+ register 'stepIn', Message::StepIn
56
+ register 'stepOut', Message::StepOut
57
+ register 'disconnect', Message::Disconnect
58
+ register 'pause', Message::Pause
59
+ register 'evaluate', Message::Evaluate
60
+ # register 'source', Message::Base # @todo Placeholder
61
+ end
62
+ end
@@ -1,11 +1,11 @@
1
- # frozen_string_literal: true
2
-
3
- module Readapt
4
- module Message
5
- class Attach < Base
6
- def run
7
- debugger.config arguments, :attach
8
- end
9
- end
10
- end
11
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Readapt
4
+ module Message
5
+ class Attach < Base
6
+ def run
7
+ debugger.config arguments, :attach
8
+ end
9
+ end
10
+ end
11
+ end
@@ -1,32 +1,32 @@
1
- # frozen_string_literal: true
2
-
3
- module Readapt
4
- module Message
5
- class Base
6
- # @return [Hash]
7
- attr_reader :arguments
8
-
9
- # @return [Debugger]
10
- attr_reader :debugger
11
-
12
- def initialize arguments, debugger
13
- @arguments = arguments
14
- @debugger = debugger
15
- end
16
-
17
- def run; end
18
-
19
- def body
20
- @body ||= {}
21
- end
22
-
23
- def set_body hash
24
- @body = hash
25
- end
26
-
27
- def self.run arguments, debugger
28
- new(arguments, debugger).run
29
- end
30
- end
31
- end
32
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Readapt
4
+ module Message
5
+ class Base
6
+ # @return [Hash]
7
+ attr_reader :arguments
8
+
9
+ # @return [Debugger]
10
+ attr_reader :debugger
11
+
12
+ def initialize arguments, debugger
13
+ @arguments = arguments
14
+ @debugger = debugger
15
+ end
16
+
17
+ def run; end
18
+
19
+ def body
20
+ @body ||= {}
21
+ end
22
+
23
+ def set_body hash
24
+ @body = hash
25
+ end
26
+
27
+ def self.run arguments, debugger
28
+ new(arguments, debugger).run
29
+ end
30
+ end
31
+ end
32
+ end
@@ -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