Fix crash in Debug::SendCommand.

R=vitalyr@chromium.org
BUG=
TEST=

Review URL: http://codereview.chromium.org/6715029

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7310 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent b6d288a0
...@@ -276,8 +276,12 @@ class EXPORT Debug { ...@@ -276,8 +276,12 @@ class EXPORT Debug {
static void SetMessageHandler(MessageHandler handler, static void SetMessageHandler(MessageHandler handler,
bool message_handler_thread = false); bool message_handler_thread = false);
static void SetMessageHandler2(MessageHandler2 handler); static void SetMessageHandler2(MessageHandler2 handler);
// If no isolate is provided the default isolate is
// used.
static void SendCommand(const uint16_t* command, int length, static void SendCommand(const uint16_t* command, int length,
ClientData* client_data = NULL); ClientData* client_data = NULL,
Isolate* isolate = NULL);
// Dispatch interface. // Dispatch interface.
static void SetHostDispatchHandler(HostDispatchHandler handler, static void SetHostDispatchHandler(HostDispatchHandler handler,
......
...@@ -4904,10 +4904,17 @@ void Debug::SetMessageHandler2(v8::Debug::MessageHandler2 handler) { ...@@ -4904,10 +4904,17 @@ void Debug::SetMessageHandler2(v8::Debug::MessageHandler2 handler) {
void Debug::SendCommand(const uint16_t* command, int length, void Debug::SendCommand(const uint16_t* command, int length,
ClientData* client_data) { ClientData* client_data,
if (!i::Isolate::Current()->IsInitialized()) return; Isolate* isolate) {
i::Isolate::Current()->debugger()->ProcessCommand( // If no isolate is supplied, use the default isolate.
i::Vector<const uint16_t>(command, length), client_data); if (isolate != NULL) {
i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
internal_isolate->debugger()->ProcessCommand(
i::Vector<const uint16_t>(command, length), client_data);
} else {
i::Isolate::GetDefaultIsolateDebugger()->ProcessCommand(
i::Vector<const uint16_t>(command, length), client_data);
}
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment