Skip to content

Commit 3779b43

Browse files
committed
notify debugger about gdb_wrapper pid to kill it when debugging finished
1 parent 91ff6d7 commit 3779b43

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

bin/gdb_wrapper

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,10 @@ unless options.ruby_path
6565
exit 1
6666
end
6767

68-
argv = '["' + ARGV * '", "' + '"]'
68+
main_process_argv = ARGV
69+
main_process_argv << '--gdb-wrapper-pid' << "#{Process.pid}"
70+
argv = '["' + main_process_argv * '", "' + '"]'
71+
6972
child_argv = '["' + ARGV * '", "' + "', '--ignore-port" + '"]'
7073
debugger_loader_path = File.expand_path(File.dirname(__FILE__)) + '/../lib/ruby-debug-ide/attach/debugger_loader'
7174

bin/rdebug-ide

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ options = OpenStruct.new(
2727
'catchpoint_deleted_event' => false,
2828
'value_as_nested_element' => false,
2929
'attach_mode' => false,
30-
'cli_debug' => false
30+
'cli_debug' => false,
31+
'gdb_wrapper_pid' => nil
3132
)
3233

3334
opts = OptionParser.new do |opts|
@@ -42,6 +43,8 @@ EOB
4243

4344
opts.on("-h", "--host HOST", "Host name used for remote debugging") {|host| options.host = host}
4445
opts.on("-p", "--port PORT", Integer, "Port used for remote debugging") {|port| options.port = port}
46+
opts.on("-gdbp", "--gdb-wrapper-pid PID", Integer, "Pid of corresponding gdb_wrapper (for attach case)") {|pid| options.gdb_wrapper_pid = pid}
47+
4548
opts.on("--dispatcher-port PORT", Integer, "Port used for multi-process debugging dispatcher") do |dp|
4649
options.dispatcher_port = dp
4750
end
@@ -168,6 +171,7 @@ Debugger.catchpoint_deleted_event = options.catchpoint_deleted_event || options.
168171
Debugger.value_as_nested_element = options.value_as_nested_element || options.rm_protocol_extensions
169172

170173
if options.attach_mode
174+
at_exit {Process.kill('INT', options.gdb_wrapper_pid)} if options.gdb_wrapper_pid
171175
if Debugger::FRONT_END == "debase"
172176
Debugger.init_variables
173177
end

0 commit comments

Comments
 (0)