Skip to content

Commit a655fb4

Browse files
committed
Added command line param to enable RM-specific incompatible protocol changes
1 parent e52743d commit a655fb4

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

bin/rdebug-ide

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ options = OpenStruct.new(
1919
'tracing' => false,
2020
'int_handler' => true,
2121
'dispatcher_port' => -1,
22-
'evaluation_timeout' => 10
22+
'evaluation_timeout' => 10,
23+
'rm_protocol_extensions' => false
2324
)
2425

2526
opts = OptionParser.new do |opts|
@@ -54,6 +55,9 @@ EOB
5455

5556
opts.on("--keep-frame-binding", "Keep frame bindings") {options.frame_bind = true}
5657
opts.on("--disable-int-handler", "Disables interrupt signal handler") {options.int_handler = false}
58+
opts.on("--rubymine-protocol-extensions", "Enable RubyMine-specific incompatible protocol extensions") do
59+
options.rm_protocol_extensions = true
60+
end
5761
opts.separator ""
5862
opts.separator "Common options:"
5963
opts.on_tail("-v", "--version", "Show version") do
@@ -112,6 +116,7 @@ end
112116
Debugger.keep_frame_binding = options.frame_bind
113117
Debugger.tracing = options.tracing
114118
Debugger.evaluation_timeout = options.evaluation_timeout
119+
Debugger.rm_protocol_extensions = options.rm_protocol_extensions
115120

116121
Debugger.debug_program(options)
117122

lib/ruby-debug-ide/xml_printer.rb

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def print_current_frame(frame_pos)
7878
def print_frame(context, frame_id, current_frame_id)
7979
# idx + 1: one-based numbering as classic-debugger
8080
file = context.frame_file(frame_id)
81-
print "<frame no=\'%s\' file=\'%s\' line=\'%s\' #{"current='true' " if frame_id == current_frame_id}/>",
81+
print "<frame no=\"%s\" file=\"%s\" line=\"%s\" #{"current='true' " if frame_id == current_frame_id}/>",
8282
frame_id + 1, File.expand_path(file), context.frame_line(frame_id)
8383
end
8484

@@ -173,9 +173,9 @@ def print_variable(name, value, kind)
173173
value_str = handle_binary_data(value_str)
174174
escaped_value_str = CGI.escapeHTML(value_str)
175175
print("<variable name=\"%s\" %s kind=\"%s\" value=\"%s\" type=\"%s\" hasChildren=\"%s\" objectId=\"%#+x\">",
176-
CGI.escapeHTML(name), build_compact_value_attr(value), kind, escaped_value_str, value.class,
176+
CGI.escapeHTML(name), build_compact_value_attr(value), kind, build_value_attr(escaped_value_str), value.class,
177177
has_children, value.respond_to?(:object_id) ? value.object_id : value.id)
178-
print("<value><![CDATA[%s]]></value>", escaped_value_str)
178+
print("<value><![CDATA[%s]]></value>", escaped_value_str) if Debugger.rm_protocol_extensions
179179
print('</variable>')
180180
end
181181

@@ -367,6 +367,10 @@ def build_compact_value_attr(value)
367367
compact_value_str.nil? ? '' : "compactValue=\"#{CGI.escapeHTML(compact_value_str)}\""
368368
end
369369

370+
def build_value_attr(escaped_value_str)
371+
Debugger.rm_protocol_extensions ? '' : escaped_value_str
372+
end
373+
370374
instance_methods.each do |m|
371375
if m.to_s.index('print_') == 0
372376
protect m

0 commit comments

Comments
 (0)