Skip to content

Commit

Permalink
better handling of int signal.
Browse files Browse the repository at this point in the history
  • Loading branch information
equivalence1 committed Nov 9, 2016
1 parent 7e69ab7 commit e1d1d36
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
10 changes: 7 additions & 3 deletions bin/gdb_wrapper
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,15 @@ require 'ruby-debug-ide/attach/process_thread'
debugger = choose_debugger(options.ruby_path, options.pid, options.gems_to_include, debugger_loader_path, argv)

trap('INT') do
unless debugger.pipe.closed?
unless debugger.exited?
$stderr.puts "backtraces for threads:\n\n"
debugger.process_threads.each do |thread|
$stderr.puts "#{thread.thread_info}\n#{thread.last_bt}\n\n"
process_threads = debugger.process_threads
if process_threads
process_threads.each do |thread|
$stderr.puts "#{thread.thread_info}\n#{thread.last_bt}\n\n"
end
end
debugger.exit
end
exit!
end
Expand Down
5 changes: 4 additions & 1 deletion lib/ruby-debug-ide/attach/native_debugger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,11 @@ def load_debugger

end

def exited?
@pipe.closed?
end

def exit
execute 'q'
@pipe.close
end

Expand Down

0 comments on commit e1d1d36

Please sign in to comment.