Skip to content

Commit

Permalink
notify debugger about gdb_wrapper pid to kill it when debugging finis…
Browse files Browse the repository at this point in the history
…hed (#149)
  • Loading branch information
ViugiNick authored and valich committed Jun 13, 2018
1 parent 421fb00 commit bff3618
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion bin/gdb_wrapper
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ unless options.ruby_path
exit 1
end

argv = '["' + ARGV * '", "' + '"]'
main_process_argv = ARGV
main_process_argv << '--gdb-wrapper-pid' << "#{Process.pid}"
argv = '["' + main_process_argv * '", "' + '"]'

child_argv = '["' + ARGV * '", "' + "', '--ignore-port" + '"]'
debugger_loader_path = File.expand_path(File.dirname(__FILE__)) + '/../lib/ruby-debug-ide/attach/debugger_loader'

Expand Down
4 changes: 4 additions & 0 deletions bin/rdebug-ide
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ options = OpenStruct.new(
'value_as_nested_element' => false,
'attach_mode' => false,
'cli_debug' => false,
'gdb_wrapper_pid' => nil,
'key_value_mode' => false
)

Expand All @@ -43,6 +44,8 @@ EOB

opts.on("-h", "--host HOST", "Host name used for remote debugging") {|host| options.host = host}
opts.on("-p", "--port PORT", Integer, "Port used for remote debugging") {|port| options.port = port}
opts.on("-gdbp", "--gdb-wrapper-pid PID", Integer, "Pid of corresponding gdb_wrapper (for attach case)") {|pid| options.gdb_wrapper_pid = pid}

opts.on("--dispatcher-port PORT", Integer, "Port used for multi-process debugging dispatcher") do |dp|
options.dispatcher_port = dp
end
Expand Down Expand Up @@ -173,6 +176,7 @@ Debugger.value_as_nested_element = options.value_as_nested_element || options.rm
Debugger.key_value_mode = options.key_value_mode

if options.attach_mode
at_exit {Process.kill('INT', options.gdb_wrapper_pid)} if options.gdb_wrapper_pid
if Debugger::FRONT_END == "debase"
Debugger.init_variables
end
Expand Down

0 comments on commit bff3618

Please sign in to comment.