ruby-debug-ide22 0.7.4 → 0.7.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES +75 -75
  3. data/ChangeLog.archive +1073 -1073
  4. data/ChangeLog.md +594 -594
  5. data/Gemfile +38 -38
  6. data/MIT-LICENSE +24 -24
  7. data/Rakefile +92 -92
  8. data/bin/gdb_wrapper +96 -96
  9. data/bin/rdebug-ide +200 -200
  10. data/ext/mkrf_conf.rb +44 -44
  11. data/lib/ruby-debug-ide/attach/debugger_loader.rb +20 -20
  12. data/lib/ruby-debug-ide/attach/gdb.rb +73 -73
  13. data/lib/ruby-debug-ide/attach/lldb.rb +71 -71
  14. data/lib/ruby-debug-ide/attach/native_debugger.rb +133 -133
  15. data/lib/ruby-debug-ide/attach/process_thread.rb +54 -54
  16. data/lib/ruby-debug-ide/attach/util.rb +114 -114
  17. data/lib/ruby-debug-ide/command.rb +187 -187
  18. data/lib/ruby-debug-ide/commands/breakpoints.rb +128 -128
  19. data/lib/ruby-debug-ide/commands/catchpoint.rb +64 -64
  20. data/lib/ruby-debug-ide/commands/condition.rb +51 -51
  21. data/lib/ruby-debug-ide/commands/control.rb +164 -158
  22. data/lib/ruby-debug-ide/commands/enable.rb +203 -203
  23. data/lib/ruby-debug-ide/commands/eval.rb +64 -64
  24. data/lib/ruby-debug-ide/commands/expression_info.rb +71 -71
  25. data/lib/ruby-debug-ide/commands/file_filtering.rb +106 -106
  26. data/lib/ruby-debug-ide/commands/frame.rb +155 -155
  27. data/lib/ruby-debug-ide/commands/inspect.rb +25 -25
  28. data/lib/ruby-debug-ide/commands/load.rb +17 -17
  29. data/lib/ruby-debug-ide/commands/stepping.rb +108 -108
  30. data/lib/ruby-debug-ide/commands/threads.rb +178 -178
  31. data/lib/ruby-debug-ide/commands/variables.rb +154 -154
  32. data/lib/ruby-debug-ide/event_processor.rb +71 -71
  33. data/lib/ruby-debug-ide/greeter.rb +42 -42
  34. data/lib/ruby-debug-ide/helper.rb +33 -33
  35. data/lib/ruby-debug-ide/ide_processor.rb +155 -155
  36. data/lib/ruby-debug-ide/interface.rb +47 -45
  37. data/lib/ruby-debug-ide/multiprocess/monkey.rb +46 -46
  38. data/lib/ruby-debug-ide/multiprocess/pre_child.rb +58 -58
  39. data/lib/ruby-debug-ide/multiprocess/starter.rb +10 -10
  40. data/lib/ruby-debug-ide/multiprocess/unmonkey.rb +30 -30
  41. data/lib/ruby-debug-ide/multiprocess.rb +22 -22
  42. data/lib/ruby-debug-ide/thread_alias.rb +26 -26
  43. data/lib/ruby-debug-ide/version.rb +3 -3
  44. data/lib/ruby-debug-ide/xml_printer.rb +570 -570
  45. data/lib/ruby-debug-ide.rb +230 -228
  46. data/ruby-debug-ide.gemspec +47 -47
  47. metadata +4 -4
@@ -1,203 +1,203 @@
1
- module Debugger
2
- # Mix-in module to assist in command parsing.
3
- module EnableDisableFunctions # :nodoc:
4
- def enable_disable_breakpoints(is_enable, args)
5
- breakpoints = Debugger.breakpoints.sort_by{|b| b.id }
6
- largest = breakpoints.inject(0) do |largest_so_far, b|
7
- b.id if b.id > largest_so_far
8
- end
9
- if 0 == largest
10
- errmsg "No breakpoints have been set.\n"
11
- return
12
- end
13
- args.each do |pos|
14
- pos = get_int(pos, "#{is_enable} breakpoints", 1, largest)
15
- return nil unless pos
16
- breakpoints.each do |b|
17
- if b.id == pos
18
- enabled = ("Enable" == is_enable)
19
- if enabled
20
- unless syntax_valid?(b.expr)
21
- errmsg("Expression \"#{b.expr}\" syntactically incorrect; breakpoint remains disabled.\n")
22
- break
23
- end
24
- end
25
- b.enabled = enabled
26
- enabled ? print_breakpoint_enabled(b) : print_breakpoint_disabled(b)
27
- break
28
- end
29
- end
30
- end
31
- end
32
-
33
- def enable_disable_display(is_enable, args)
34
- if 0 == @state.display.size
35
- errmsg "No display expressions have been set.\n"
36
- return
37
- end
38
- args.each do |pos|
39
- pos = get_int(pos, "#{is_enable} display", 1, @state.display.size)
40
- return nil unless pos
41
- @state.display[pos-1][0] = ("Enable" == is_enable)
42
- end
43
- end
44
-
45
- end
46
-
47
- class EnableCommand < Command # :nodoc:
48
- Subcommands =
49
- [
50
- ['breakpoints', 2, "Enable specified breakpoints",
51
- "Give breakpoint numbers (separated by spaces) as arguments.
52
- This is used to cancel the effect of the \"disable\" command."
53
- ],
54
- ['display', 2,
55
- "Enable some expressions to be displayed when program stops",
56
- "Arguments are the code numbers of the expressions to resume displaying.
57
- Do \"info display\" to see current list of code numbers."],
58
- ].map do |name, min, short_help, long_help|
59
- SubcmdStruct.new(name, min, short_help, long_help)
60
- end unless defined?(Subcommands)
61
-
62
- def regexp
63
- /^\s* en(?:able)? (?:\s+(.*))?$/ix
64
- end
65
-
66
- def execute
67
- if not @match[1]
68
- errmsg "\"enable\" must be followed \"display\", \"breakpoints\"" +
69
- " or breakpoint numbers.\n"
70
- else
71
- args = @match[1].split(/[ \t]+/)
72
- param = args.shift
73
- subcmd = find(Subcommands, param)
74
- if subcmd
75
- send("enable_#{subcmd.name}", args)
76
- else
77
- send("enable_breakpoints", args.unshift(param))
78
- end
79
- end
80
- end
81
-
82
- def enable_breakpoints(args)
83
- enable_disable_breakpoints("Enable", args)
84
- end
85
-
86
- def enable_display(args)
87
- enable_disable_display("Enable", args)
88
- end
89
-
90
- class << self
91
- def help_command
92
- 'enable'
93
- end
94
-
95
- def help(args)
96
- if args[1]
97
- s = args[1]
98
- subcmd = Subcommands.find do |try_subcmd|
99
- (s.size >= try_subcmd.min) and
100
- (try_subcmd.name[0..s.size-1] == s)
101
- end
102
- if subcmd
103
- str = subcmd.short_help + '.'
104
- str += "\n" + subcmd.long_help if subcmd.long_help
105
- return str
106
- else
107
- return "Invalid 'enable' subcommand '#{args[1]}'."
108
- end
109
- end
110
- s = %{
111
- Enable some things.
112
- This is used to cancel the effect of the "disable" command.
113
- --
114
- List of enable subcommands:
115
- --
116
- }
117
- for subcmd in Subcommands do
118
- s += "enable #{subcmd.name} -- #{subcmd.short_help}\n"
119
- end
120
- return s
121
- end
122
- end
123
- end
124
-
125
- class DisableCommand < Command # :nodoc:
126
- Subcommands =
127
- [
128
- ['breakpoints', 1, "Disable some breakpoints",
129
- "Arguments are breakpoint numbers with spaces in between.
130
- A disabled breakpoint is not forgotten, but has no effect until reenabled."],
131
- ['display', 1, "Disable some display expressions when program stops",
132
- "Arguments are the code numbers of the expressions to stop displaying.
133
- Do \"info display\" to see current list of code numbers."],
134
- ].map do |name, min, short_help, long_help|
135
- SubcmdStruct.new(name, min, short_help, long_help)
136
- end unless defined?(Subcommands)
137
-
138
- def regexp
139
- /^\s* dis(?:able)? (?:\s+(.*))?$/ix
140
- end
141
-
142
- def execute
143
- if not @match[1]
144
- errmsg "\"disable\" must be followed \"display\", \"breakpoints\"" +
145
- " or breakpoint numbers.\n"
146
- else
147
- args = @match[1].split(/[ \t]+/)
148
- param = args.shift
149
- subcmd = find(Subcommands, param)
150
- if subcmd
151
- send("disable_#{subcmd.name}", args)
152
- else
153
- send("disable_breakpoints", args.unshift(param))
154
- end
155
- end
156
- end
157
-
158
- def disable_breakpoints(args)
159
- enable_disable_breakpoints("Disable", args)
160
- end
161
-
162
- def disable_display(args)
163
- enable_disable_display("Disable", args)
164
- end
165
-
166
- class << self
167
- def help_command
168
- 'disable'
169
- end
170
-
171
- def help(args)
172
- if args[1]
173
- s = args[1]
174
- subcmd = Subcommands.find do |try_subcmd|
175
- (s.size >= try_subcmd.min) and
176
- (try_subcmd.name[0..s.size-1] == s)
177
- end
178
- if subcmd
179
- str = subcmd.short_help + '.'
180
- str += "\n" + subcmd.long_help if subcmd.long_help
181
- return str
182
- else
183
- return "Invalid 'disable' subcommand '#{args[1]}'."
184
- end
185
- end
186
- s = %{
187
- Disable some things.
188
-
189
- A disabled item is not forgotten, but has no effect until reenabled.
190
- Use the "enable" command to have it take effect again.
191
- --
192
- List of disable subcommands:
193
- --
194
- }
195
- for subcmd in Subcommands do
196
- s += "disable #{subcmd.name} -- #{subcmd.short_help}\n"
197
- end
198
- return s
199
- end
200
- end
201
- end
202
-
203
- end # module Debugger
1
+ module Debugger
2
+ # Mix-in module to assist in command parsing.
3
+ module EnableDisableFunctions # :nodoc:
4
+ def enable_disable_breakpoints(is_enable, args)
5
+ breakpoints = Debugger.breakpoints.sort_by{|b| b.id }
6
+ largest = breakpoints.inject(0) do |largest_so_far, b|
7
+ b.id if b.id > largest_so_far
8
+ end
9
+ if 0 == largest
10
+ errmsg "No breakpoints have been set.\n"
11
+ return
12
+ end
13
+ args.each do |pos|
14
+ pos = get_int(pos, "#{is_enable} breakpoints", 1, largest)
15
+ return nil unless pos
16
+ breakpoints.each do |b|
17
+ if b.id == pos
18
+ enabled = ("Enable" == is_enable)
19
+ if enabled
20
+ unless syntax_valid?(b.expr)
21
+ errmsg("Expression \"#{b.expr}\" syntactically incorrect; breakpoint remains disabled.\n")
22
+ break
23
+ end
24
+ end
25
+ b.enabled = enabled
26
+ enabled ? print_breakpoint_enabled(b) : print_breakpoint_disabled(b)
27
+ break
28
+ end
29
+ end
30
+ end
31
+ end
32
+
33
+ def enable_disable_display(is_enable, args)
34
+ if 0 == @state.display.size
35
+ errmsg "No display expressions have been set.\n"
36
+ return
37
+ end
38
+ args.each do |pos|
39
+ pos = get_int(pos, "#{is_enable} display", 1, @state.display.size)
40
+ return nil unless pos
41
+ @state.display[pos-1][0] = ("Enable" == is_enable)
42
+ end
43
+ end
44
+
45
+ end
46
+
47
+ class EnableCommand < Command # :nodoc:
48
+ Subcommands =
49
+ [
50
+ ['breakpoints', 2, "Enable specified breakpoints",
51
+ "Give breakpoint numbers (separated by spaces) as arguments.
52
+ This is used to cancel the effect of the \"disable\" command."
53
+ ],
54
+ ['display', 2,
55
+ "Enable some expressions to be displayed when program stops",
56
+ "Arguments are the code numbers of the expressions to resume displaying.
57
+ Do \"info display\" to see current list of code numbers."],
58
+ ].map do |name, min, short_help, long_help|
59
+ SubcmdStruct.new(name, min, short_help, long_help)
60
+ end unless defined?(Subcommands)
61
+
62
+ def regexp
63
+ /^\s* en(?:able)? (?:\s+(.*))?$/ix
64
+ end
65
+
66
+ def execute
67
+ if not @match[1]
68
+ errmsg "\"enable\" must be followed \"display\", \"breakpoints\"" +
69
+ " or breakpoint numbers.\n"
70
+ else
71
+ args = @match[1].split(/[ \t]+/)
72
+ param = args.shift
73
+ subcmd = find(Subcommands, param)
74
+ if subcmd
75
+ send("enable_#{subcmd.name}", args)
76
+ else
77
+ send("enable_breakpoints", args.unshift(param))
78
+ end
79
+ end
80
+ end
81
+
82
+ def enable_breakpoints(args)
83
+ enable_disable_breakpoints("Enable", args)
84
+ end
85
+
86
+ def enable_display(args)
87
+ enable_disable_display("Enable", args)
88
+ end
89
+
90
+ class << self
91
+ def help_command
92
+ 'enable'
93
+ end
94
+
95
+ def help(args)
96
+ if args[1]
97
+ s = args[1]
98
+ subcmd = Subcommands.find do |try_subcmd|
99
+ (s.size >= try_subcmd.min) and
100
+ (try_subcmd.name[0..s.size-1] == s)
101
+ end
102
+ if subcmd
103
+ str = subcmd.short_help + '.'
104
+ str += "\n" + subcmd.long_help if subcmd.long_help
105
+ return str
106
+ else
107
+ return "Invalid 'enable' subcommand '#{args[1]}'."
108
+ end
109
+ end
110
+ s = %{
111
+ Enable some things.
112
+ This is used to cancel the effect of the "disable" command.
113
+ --
114
+ List of enable subcommands:
115
+ --
116
+ }
117
+ for subcmd in Subcommands do
118
+ s += "enable #{subcmd.name} -- #{subcmd.short_help}\n"
119
+ end
120
+ return s
121
+ end
122
+ end
123
+ end
124
+
125
+ class DisableCommand < Command # :nodoc:
126
+ Subcommands =
127
+ [
128
+ ['breakpoints', 1, "Disable some breakpoints",
129
+ "Arguments are breakpoint numbers with spaces in between.
130
+ A disabled breakpoint is not forgotten, but has no effect until reenabled."],
131
+ ['display', 1, "Disable some display expressions when program stops",
132
+ "Arguments are the code numbers of the expressions to stop displaying.
133
+ Do \"info display\" to see current list of code numbers."],
134
+ ].map do |name, min, short_help, long_help|
135
+ SubcmdStruct.new(name, min, short_help, long_help)
136
+ end unless defined?(Subcommands)
137
+
138
+ def regexp
139
+ /^\s* dis(?:able)? (?:\s+(.*))?$/ix
140
+ end
141
+
142
+ def execute
143
+ if not @match[1]
144
+ errmsg "\"disable\" must be followed \"display\", \"breakpoints\"" +
145
+ " or breakpoint numbers.\n"
146
+ else
147
+ args = @match[1].split(/[ \t]+/)
148
+ param = args.shift
149
+ subcmd = find(Subcommands, param)
150
+ if subcmd
151
+ send("disable_#{subcmd.name}", args)
152
+ else
153
+ send("disable_breakpoints", args.unshift(param))
154
+ end
155
+ end
156
+ end
157
+
158
+ def disable_breakpoints(args)
159
+ enable_disable_breakpoints("Disable", args)
160
+ end
161
+
162
+ def disable_display(args)
163
+ enable_disable_display("Disable", args)
164
+ end
165
+
166
+ class << self
167
+ def help_command
168
+ 'disable'
169
+ end
170
+
171
+ def help(args)
172
+ if args[1]
173
+ s = args[1]
174
+ subcmd = Subcommands.find do |try_subcmd|
175
+ (s.size >= try_subcmd.min) and
176
+ (try_subcmd.name[0..s.size-1] == s)
177
+ end
178
+ if subcmd
179
+ str = subcmd.short_help + '.'
180
+ str += "\n" + subcmd.long_help if subcmd.long_help
181
+ return str
182
+ else
183
+ return "Invalid 'disable' subcommand '#{args[1]}'."
184
+ end
185
+ end
186
+ s = %{
187
+ Disable some things.
188
+
189
+ A disabled item is not forgotten, but has no effect until reenabled.
190
+ Use the "enable" command to have it take effect again.
191
+ --
192
+ List of disable subcommands:
193
+ --
194
+ }
195
+ for subcmd in Subcommands do
196
+ s += "disable #{subcmd.name} -- #{subcmd.short_help}\n"
197
+ end
198
+ return s
199
+ end
200
+ end
201
+ end
202
+
203
+ end # module Debugger
@@ -1,64 +1,64 @@
1
- module Debugger
2
- class EvalCommand < Command # :nodoc:
3
- #self.control = true
4
-
5
- def match(input)
6
- @input = input
7
- super
8
- end
9
-
10
- def regexp
11
- /^\s*(p|e(?:val)?)\s+/
12
- end
13
-
14
- def execute
15
- expr = @match ? @match.post_match : @input
16
- binding = @state.context ? get_binding : TOPLEVEL_BINDING
17
- print_eval expr, debug_eval(expr, binding).inspect
18
- end
19
-
20
- class << self
21
- def help_command
22
- %w|p eval|
23
- end
24
-
25
- def help(cmd)
26
- if cmd == 'p'
27
- %{
28
- p expression\tevaluate expression and print its value
29
- }
30
- else
31
- %{
32
- e[val] expression\tevaluate expression and print its value,
33
- \t\t\talias for p.
34
- }
35
- end
36
- end
37
- end
38
- end
39
-
40
- class PPCommand < Command # :nodoc:
41
- def regexp
42
- /^\s*pp\s+/
43
- end
44
-
45
- def execute
46
- exp = @match.post_match
47
- out = StringIO.new
48
- PP.pp(debug_eval(exp), out) rescue out.puts $!.message
49
- print_pp out.string
50
- end
51
-
52
- class << self
53
- def help_command
54
- 'pp'
55
- end
56
-
57
- def help(cmd)
58
- %{
59
- pp expression\tevaluate expression and print its value
60
- }
61
- end
62
- end
63
- end
64
- end
1
+ module Debugger
2
+ class EvalCommand < Command # :nodoc:
3
+ #self.control = true
4
+
5
+ def match(input)
6
+ @input = input
7
+ super
8
+ end
9
+
10
+ def regexp
11
+ /^\s*(p|e(?:val)?)\s+/
12
+ end
13
+
14
+ def execute
15
+ expr = @match ? @match.post_match : @input
16
+ binding = @state.context ? get_binding : TOPLEVEL_BINDING
17
+ print_eval expr, debug_eval(expr, binding).inspect
18
+ end
19
+
20
+ class << self
21
+ def help_command
22
+ %w|p eval|
23
+ end
24
+
25
+ def help(cmd)
26
+ if cmd == 'p'
27
+ %{
28
+ p expression\tevaluate expression and print its value
29
+ }
30
+ else
31
+ %{
32
+ e[val] expression\tevaluate expression and print its value,
33
+ \t\t\talias for p.
34
+ }
35
+ end
36
+ end
37
+ end
38
+ end
39
+
40
+ class PPCommand < Command # :nodoc:
41
+ def regexp
42
+ /^\s*pp\s+/
43
+ end
44
+
45
+ def execute
46
+ exp = @match.post_match
47
+ out = StringIO.new
48
+ PP.pp(debug_eval(exp), out) rescue out.puts $!.message
49
+ print_pp out.string
50
+ end
51
+
52
+ class << self
53
+ def help_command
54
+ 'pp'
55
+ end
56
+
57
+ def help(cmd)
58
+ %{
59
+ pp expression\tevaluate expression and print its value
60
+ }
61
+ end
62
+ end
63
+ end
64
+ end
@@ -1,71 +1,71 @@
1
- require 'stringio'
2
- require 'irb/ruby-lex'
3
-
4
- module Debugger
5
-
6
- class ExpressionInfoCommand < Command
7
- def regexp
8
- /^\s*ex(?:pression_info)?\s+/
9
- end
10
-
11
- def execute
12
- string_to_parse = Command.unescape_incoming(@match.post_match) + " \n \n\n"
13
- total_lines = string_to_parse.count("\n") + 1
14
-
15
- lexer = RubyLex.new
16
- lexer.set_input(create_io_reader(string_to_parse))
17
-
18
- last_statement = ''
19
- last_prompt = ''
20
- last_indent = 0
21
- lexer.set_prompt do |ltype, indent, continue, lineno|
22
- next if (lineno >= total_lines)
23
-
24
- last_prompt = ltype || ''
25
- last_indent = indent
26
- end
27
-
28
- lexer.each_top_level_statement do |line, line_no|
29
- last_statement = line
30
- end
31
-
32
- incomplete = true
33
- if /\A\s*\Z/m =~ last_statement
34
- incomplete = false
35
- end
36
-
37
- @printer.print_expression_info(incomplete, last_prompt, last_indent)
38
- end
39
-
40
- def create_io_reader(string_to_parse)
41
- io = StringIO.new(string_to_parse)
42
-
43
- if string_to_parse.respond_to?(:encoding)
44
- io.instance_exec(string_to_parse.encoding) do |string_encoding|
45
- @my_encoding = string_encoding
46
- def self.encoding
47
- @my_encoding
48
- end
49
- end
50
- end
51
-
52
- io
53
- end
54
-
55
- class << self
56
- def help_command
57
- "expression_info"
58
- end
59
-
60
- def help(cmd)
61
- %{
62
- ex[pression_info] <expression>\t
63
- returns parser-related information for the expression given\t\t
64
- 'incomplete'=true|false\tindicates whether expression is a complete ruby
65
- expression and can be evaluated without getting syntax errors
66
- }
67
- end
68
- end
69
- end
70
-
71
- end
1
+ require 'stringio'
2
+ require 'irb/ruby-lex'
3
+
4
+ module Debugger
5
+
6
+ class ExpressionInfoCommand < Command
7
+ def regexp
8
+ /^\s*ex(?:pression_info)?\s+/
9
+ end
10
+
11
+ def execute
12
+ string_to_parse = Command.unescape_incoming(@match.post_match) + " \n \n\n"
13
+ total_lines = string_to_parse.count("\n") + 1
14
+
15
+ lexer = RubyLex.new
16
+ lexer.set_input(create_io_reader(string_to_parse))
17
+
18
+ last_statement = ''
19
+ last_prompt = ''
20
+ last_indent = 0
21
+ lexer.set_prompt do |ltype, indent, continue, lineno|
22
+ next if (lineno >= total_lines)
23
+
24
+ last_prompt = ltype || ''
25
+ last_indent = indent
26
+ end
27
+
28
+ lexer.each_top_level_statement do |line, line_no|
29
+ last_statement = line
30
+ end
31
+
32
+ incomplete = true
33
+ if /\A\s*\Z/m =~ last_statement
34
+ incomplete = false
35
+ end
36
+
37
+ @printer.print_expression_info(incomplete, last_prompt, last_indent)
38
+ end
39
+
40
+ def create_io_reader(string_to_parse)
41
+ io = StringIO.new(string_to_parse)
42
+
43
+ if string_to_parse.respond_to?(:encoding)
44
+ io.instance_exec(string_to_parse.encoding) do |string_encoding|
45
+ @my_encoding = string_encoding
46
+ def self.encoding
47
+ @my_encoding
48
+ end
49
+ end
50
+ end
51
+
52
+ io
53
+ end
54
+
55
+ class << self
56
+ def help_command
57
+ "expression_info"
58
+ end
59
+
60
+ def help(cmd)
61
+ %{
62
+ ex[pression_info] <expression>\t
63
+ returns parser-related information for the expression given\t\t
64
+ 'incomplete'=true|false\tindicates whether expression is a complete ruby
65
+ expression and can be evaluated without getting syntax errors
66
+ }
67
+ end
68
+ end
69
+ end
70
+
71
+ end