Skip to content

Commit e1d1d36

Browse files
committed
better handling of int signal.
1 parent 7e69ab7 commit e1d1d36

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

bin/gdb_wrapper

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,15 @@ require 'ruby-debug-ide/attach/process_thread'
8181
debugger = choose_debugger(options.ruby_path, options.pid, options.gems_to_include, debugger_loader_path, argv)
8282

8383
trap('INT') do
84-
unless debugger.pipe.closed?
84+
unless debugger.exited?
8585
$stderr.puts "backtraces for threads:\n\n"
86-
debugger.process_threads.each do |thread|
87-
$stderr.puts "#{thread.thread_info}\n#{thread.last_bt}\n\n"
86+
process_threads = debugger.process_threads
87+
if process_threads
88+
process_threads.each do |thread|
89+
$stderr.puts "#{thread.thread_info}\n#{thread.last_bt}\n\n"
90+
end
8891
end
92+
debugger.exit
8993
end
9094
exit!
9195
end

lib/ruby-debug-ide/attach/native_debugger.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,11 @@ def load_debugger
118118

119119
end
120120

121+
def exited?
122+
@pipe.closed?
123+
end
124+
121125
def exit
122-
execute 'q'
123126
@pipe.close
124127
end
125128

0 commit comments

Comments
 (0)