Skip to content

Commit ffff13c

Browse files
author
Oleg Sukhodolsky
committed
Evaluation timeout has been made configurable
1 parent a854f91 commit ffff13c

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

bin/rdebug-ide

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ options = OpenStruct.new(
1818
'stop' => false,
1919
'tracing' => false,
2020
'int_handler' => true,
21-
'dispatcher_port' => -1
21+
'dispatcher_port' => -1,
22+
'evaluation_timeout' => 10
2223
)
2324

2425
opts = OptionParser.new do |opts|
@@ -34,7 +35,10 @@ EOB
3435
opts.on("-p", "--port PORT", Integer, "Port used for remote debugging") {|port| options.port = port}
3536
opts.on("--dispatcher-port PORT", Integer, "Port used for multi-process debugging dispatcher") do |dp|
3637
options.dispatcher_port = dp
37-
end
38+
end
39+
opts.on('--evaluation-timeout TIMEOUT', Integer,'evaluation timeout in seconds (default: 10)') do |timeout|
40+
options.evaluation_timeout = timeout
41+
end
3842
opts.on('--stop', 'stop when the script is loaded') {options.stop = true}
3943
opts.on("-x", "--trace", "turn on line tracing") {options.tracing = true}
4044
opts.on("-l", "--load-mode", "load mode (experimental)") {options.load_mode = true}
@@ -107,6 +111,7 @@ end
107111
# set options
108112
Debugger.keep_frame_binding = options.frame_bind
109113
Debugger.tracing = options.tracing
114+
Debugger.evaluation_timeout = options.evaluation_timeout
110115

111116
Debugger.debug_program(options)
112117

lib/ruby-debug-ide.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def cleanup_backtrace(backtrace)
4141
cleared
4242
end
4343

44-
attr_accessor :cli_debug, :xml_debug
44+
attr_accessor :cli_debug, :xml_debug, :evaluation_timeout
4545
attr_accessor :control_thread
4646
attr_reader :interface
4747

lib/ruby-debug-ide/command.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def timeout(sec)
115115
def debug_eval(str, b = get_binding)
116116
begin
117117
str = str.to_s
118-
max_time = 10
118+
max_time = Debugger.evaluation_timeout
119119
to_inspect = str.gsub(/\\n/, "\n")
120120
@printer.print_debug("Evaluating #{str} with timeout after %i sec", max_time)
121121
timeout(max_time) do

0 commit comments

Comments
 (0)