Reviewers: Vitaly Repeshko,
Description:
Fix crash in Debug::SendCommand.
[email protected]
BUG=
TEST=
Please review this at http://codereview.chromium.org/6715029/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M include/v8-debug.h
M src/api.cc
Index: include/v8-debug.h
diff --git a/include/v8-debug.h b/include/v8-debug.h
index
10e8bef83be03576293a482d934c92f6115d9110..0bdff8465ae8c216f2a618c816e8016bee425b9c
100755
--- a/include/v8-debug.h
+++ b/include/v8-debug.h
@@ -276,8 +276,12 @@ class EXPORT Debug {
static void SetMessageHandler(MessageHandler handler,
bool message_handler_thread = false);
static void SetMessageHandler2(MessageHandler2 handler);
+
+ // If no isolate is provided the default isolate is
+ // used.
static void SendCommand(const uint16_t* command, int length,
- ClientData* client_data = NULL);
+ ClientData* client_data = NULL,
+ Isolate* isolate = NULL);
// Dispatch interface.
static void SetHostDispatchHandler(HostDispatchHandler handler,
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index
667aa60b7ef0051d1ebb77913693e84e9233bd7e..af9e3fd4c985e90043d5b5755369a636817b596a
100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -4903,10 +4903,17 @@ void
Debug::SetMessageHandler2(v8::Debug::MessageHandler2 handler) {
void Debug::SendCommand(const uint16_t* command, int length,
- ClientData* client_data) {
- if (!i::Isolate::Current()->IsInitialized()) return;
- i::Isolate::Current()->debugger()->ProcessCommand(
- i::Vector<const uint16_t>(command, length), client_data);
+ ClientData* client_data,
+ Isolate* isolate) {
+ // If no isolate is supplied, use the default isolate.
+ 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);
+ }
}
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev