Continue running if failing to make a debug event into a JSON event for sending to...
authorsgjesse@chromium.org <sgjesse@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Thu, 11 Dec 2008 11:25:06 +0000 (11:25 +0000)
committersgjesse@chromium.org <sgjesse@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Thu, 11 Dec 2008 11:25:06 +0000 (11:25 +0000)
This partly fixes Chromium issue 5349 (http://code.google.com/p/chromium/issues/detail?id=5349).
Review URL: http://codereview.chromium.org/13384

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@966 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/debug.cc
src/debug.h

index 820a4a7..027c89b 100644 (file)
@@ -1701,7 +1701,7 @@ void DebugMessageThread::SendMessage(Vector<uint16_t> message) {
 }
 
 
-void DebugMessageThread::SetEventJSONFromEvent(Handle<Object> event_data) {
+bool DebugMessageThread::SetEventJSONFromEvent(Handle<Object> event_data) {
   v8::HandleScope scope;
   // Call toJSONProtocol on the debug event object.
   v8::Local<v8::Object> api_event_data =
@@ -1727,8 +1727,9 @@ void DebugMessageThread::SetEventJSONFromEvent(Handle<Object> event_data) {
     }
   } else {
     PrintLn(try_catch.Exception());
-    SendMessage(Vector<uint16_t>::empty());
+    return false;
   }
+  return true;
 }
 
 
@@ -1791,10 +1792,14 @@ void DebugMessageThread::DebugEvent(v8::DebugEvent event,
   }
 
   // Notify the debugger that a debug event has occurred.
-  host_running_ = false;
-  SetEventJSONFromEvent(event_data);
+  bool success = SetEventJSONFromEvent(event_data);
+  if (!success) {
+    // If failed to notify debugger just continue running.
+    return;
+  }
 
   // Wait for requests from the debugger.
+  host_running_ = false;
   while (true) {
     command_received_->Wait();
     Logger::DebugTag("Got request from command queue, in interactive loop.");
index b86e62b..fdb80bd 100644 (file)
@@ -460,7 +460,7 @@ class DebugMessageThread: public Thread {
   // which forwards it to the debug_message_handler set by the API.
   void SendMessage(Vector<uint16_t> event_json);
   // Formats an event into JSON, and calls SendMessage.
-  void SetEventJSONFromEvent(Handle<Object> event_data);
+  bool SetEventJSONFromEvent(Handle<Object> event_data);
   // Puts a command coming from the public API on the queue.  Called
   // by the API client thread.  This is where the API client hands off
   // processing of the command to the DebugMessageThread thread.