bool Debug::AddDebugEventListener(DebugEventCallback that, Handle<Value> data) {
- EnsureInitialized("v8::V8::AddDebugEventListener()");
- ON_BAILOUT("v8::V8::AddDebugEventListener()", return false);
+ EnsureInitialized("v8::Debug::AddDebugEventListener()");
+ ON_BAILOUT("v8::Debug::AddDebugEventListener()", return false);
HandleScope scope;
NeanderArray listeners(i::Factory::debug_event_listeners());
NeanderObject obj(2);
bool Debug::AddDebugEventListener(v8::Handle<v8::Function> that,
Handle<Value> data) {
- ON_BAILOUT("v8::V8::AddDebugEventListener()", return false);
+ ON_BAILOUT("v8::Debug::AddDebugEventListener()", return false);
HandleScope scope;
NeanderArray listeners(i::Factory::debug_event_listeners());
NeanderObject obj(2);
void Debug::RemoveDebugEventListener(DebugEventCallback that) {
- EnsureInitialized("v8::V8::RemoveDebugEventListener()");
- ON_BAILOUT("v8::V8::RemoveDebugEventListener()", return);
+ EnsureInitialized("v8::Debug::RemoveDebugEventListener()");
+ ON_BAILOUT("v8::Debug::RemoveDebugEventListener()", return);
HandleScope scope;
NeanderArray listeners(i::Factory::debug_event_listeners());
for (int i = 0; i < listeners.length(); i++) {
void Debug::RemoveDebugEventListener(v8::Handle<v8::Function> that) {
- ON_BAILOUT("v8::V8::RemoveDebugEventListener()", return);
+ ON_BAILOUT("v8::Debug::RemoveDebugEventListener()", return);
HandleScope scope;
NeanderArray listeners(i::Factory::debug_event_listeners());
for (int i = 0; i < listeners.length(); i++) {
void Debug::DebugBreak() {
+ if (!i::V8::HasBeenSetup()) return;
i::StackGuard::DebugBreak();
}
void Debug::SetMessageHandler(v8::DebugMessageHandler handler, void* data) {
+ EnsureInitialized("v8::Debug::SetMessageHandler");
i::Debugger::SetMessageHandler(handler, data);
}
void Debug::SendCommand(const uint16_t* command, int length) {
+ if (!i::V8::HasBeenSetup()) return;
i::Debugger::ProcessCommand(i::Vector<const uint16_t>(command, length));
}
breakpoints_v8_thread.Join();
breakpoints_debugger_thread.Join();
}
+
+
+static void DummyDebugEventListener(v8::DebugEvent event,
+ v8::Handle<v8::Object> exec_state,
+ v8::Handle<v8::Object> event_data,
+ v8::Handle<v8::Value> data) {
+}
+
+
+TEST(AddDebugEventListenerOnUninitializedVM) {
+ v8::Debug::AddDebugEventListener(DummyDebugEventListener);
+}
+
+
+static void DummyMessageHandler(const uint16_t* message,
+ int length, void *data) {
+}
+
+
+TEST(SetMessageHandlerOnUninitializedVM) {
+ v8::Debug::SetMessageHandler(DummyMessageHandler);
+}
+
+
+TEST(DebugBreakOnUninitializedVM) {
+ v8::Debug::DebugBreak();
+}
+
+
+TEST(SendCommandToUninitializedVM) {
+ const char* dummy_command = "{}";
+ uint16_t dummy_buffer[80];
+ int dummy_length = AsciiToUtf16(dummy_command, dummy_buffer);
+ v8::Debug::SendCommand(dummy_buffer, dummy_length);
+}