lib/ruby-debug.rb in ruby-debug-ide-0.3.3 vs lib/ruby-debug.rb in ruby-debug-ide-0.3.4
- old
+ new
@@ -17,11 +17,11 @@
$stderr.printf("\n")
$stderr.flush
end
end
end
-
+
class Context
def interrupt
self.stop_next = 1
end
@@ -91,11 +91,15 @@
# wait for 'start' command
@mutex.synchronize do
@proceed.wait(@mutex)
end
- debug_load(Debugger::PROG_SCRIPT, false, load_mode)
+ bt = debug_load(Debugger::PROG_SCRIPT, false, load_mode)
+ if bt
+ $stderr.print bt.backtrace.map{|l| "\t#{l}"}.join("\n"), "\n"
+ $stderr.print "Uncaught exception: #{bt}\n"
+ end
end
def run_prog_script
@mutex.synchronize do
@proceed.signal
@@ -104,23 +108,29 @@
def start_control(host, port)
raise "Debugger is not started" unless started?
return if @control_thread
@control_thread = DebugThread.new do
- unless RUBY_PLATFORM =~ /darwin/i # Mac OS X seems to have problem with 'localhost'
- host ||= 'localhost' # nil does not seem to work for IPv6, localhost does
- end
- Debugger.print_debug("Waiting for connection on '#{host}:#{port}'")
- $stderr.puts "Fast Debugger (ruby-debug-ide 0.3.3) listens on #{host}:#{port}"
- server = TCPServer.new(host, port)
- while (session = server.accept)
- begin
- interface = RemoteInterface.new(session)
- @event_processor = EventProcessor.new(interface)
- ControlCommandProcessor.new(interface).process_commands
- rescue StandardError, ScriptError => ex
- puts ex
+ begin
+ unless RUBY_PLATFORM =~ /darwin/i # Mac OS X seems to have problem with 'localhost'
+ host ||= 'localhost' # nil does not seem to work for IPv6, localhost does
end
+ Debugger.print_debug("Waiting for connection on '#{host}:#{port}'")
+ $stderr.printf "Fast Debugger (ruby-debug-ide 0.3.4) listens on #{host}:#{port}\n"
+ server = TCPServer.new(host, port)
+ while (session = server.accept)
+ begin
+ interface = RemoteInterface.new(session)
+ @event_processor = EventProcessor.new(interface)
+ ControlCommandProcessor.new(interface).process_commands
+ rescue StandardError, ScriptError => ex
+ $stderr.printf "Exception in DebugThread loop: #{ex}\n"
+ exit 1
+ end
+ end
+ rescue
+ $stderr.printf "Exception in DebugThread: #$!\n"
+ exit 2
end
end
end
end