Reviewers: Michael Starzinger,
Description:
Do not enter the debugger when debugger is not active.
[email protected]
BUG=
TEST=test-debug/DebuggerCreatesContextIffActive
Please review this at https://chromiumcodereview.appspot.com/10702166/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/execution.cc
M test/cctest/test-debug.cc
M test/cctest/test-heap.cc
Index: src/execution.cc
diff --git a/src/execution.cc b/src/execution.cc
index
40ed7de4140d1ea5716c5bc625bd46c00d26fa9b..2613c20f0f4ed1b23e47e211fa8839ca7a22af58
100644
--- a/src/execution.cc
+++ b/src/execution.cc
@@ -832,6 +832,11 @@ Object* Execution::DebugBreakHelper() {
return isolate->heap()->undefined_value();
}
+ // Ignore debug break if debugger is not active.
+ if (!isolate->debugger()->IsDebuggerActive()) {
+ return isolate->heap()->undefined_value();
+ }
+
StackLimitCheck check(isolate);
if (check.HasOverflowed()) {
return isolate->heap()->undefined_value();
Index: test/cctest/test-debug.cc
diff --git a/test/cctest/test-debug.cc b/test/cctest/test-debug.cc
index
9f52cea2b3d490a846ecdacb86a68e7cd131fd6f..39d918d25e610a3ebc9df587907ca375638a8a35
100644
--- a/test/cctest/test-debug.cc
+++ b/test/cctest/test-debug.cc
@@ -7392,4 +7392,32 @@ TEST(Regress131642) {
v8::Debug::SetDebugEventListener(NULL);
}
+
+// Import from test-heap.cc
+int CountGlobalContexts();
+
+
+static void NopListener(v8::DebugEvent event,
+ v8::Handle<v8::Object> exec_state,
+ v8::Handle<v8::Object> event_data,
+ v8::Handle<v8::Value> data) {
+}
+
+
+TEST(DebuggerCreatesContextIffActive) {
+ v8::HandleScope scope;
+ DebugLocalContext env;
+ CHECK_EQ(1, CountGlobalContexts());
+
+ v8::Debug::SetDebugEventListener(NULL);
+ CompileRun("debugger;");
+ CHECK_EQ(1, CountGlobalContexts());
+
+ v8::Debug::SetDebugEventListener(NopListener);
+ CompileRun("debugger;");
+ CHECK_EQ(2, CountGlobalContexts());
+
+ v8::Debug::SetDebugEventListener(NULL);
+}
+
#endif // ENABLE_DEBUGGER_SUPPORT
Index: test/cctest/test-heap.cc
diff --git a/test/cctest/test-heap.cc b/test/cctest/test-heap.cc
index
8ba7f408cf9818cb0a53575b7c241b74cc4bd0e2..a7deeeba3f1f6cca0bbbc1337d29ca8e5a6713e9
100644
--- a/test/cctest/test-heap.cc
+++ b/test/cctest/test-heap.cc
@@ -984,7 +984,7 @@ TEST(TestCodeFlushing) {
// Count the number of global contexts in the weak list of global contexts.
-static int CountGlobalContexts() {
+int CountGlobalContexts() {
int count = 0;
Object* object = HEAP->global_contexts_list();
while (!object->IsUndefined()) {
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev