Revision: 3465
Author: [email protected]
Date: Tue Dec 15 01:17:15 2009
Log: Ignore debug break events when bootstrapper is active. Collecting
debug data when the context is not yet setup may lead to subtle errors like
in the following Chromium bug: http://crbug.com/28933
Review URL: http://codereview.chromium.org/497006
http://code.google.com/p/v8/source/detail?r=3465
Modified:
/branches/bleeding_edge/src/execution.cc
/branches/bleeding_edge/test/cctest/test-debug.cc
=======================================
--- /branches/bleeding_edge/src/execution.cc Thu Nov 5 05:59:40 2009
+++ /branches/bleeding_edge/src/execution.cc Tue Dec 15 01:17:15 2009
@@ -30,6 +30,7 @@
#include "v8.h"
#include "api.h"
+#include "bootstrapper.h"
#include "codegen-inl.h"
#include "debug.h"
#include "simulator.h"
@@ -606,6 +607,11 @@
if (Debug::disable_break()) {
return Heap::undefined_value();
}
+
+ // Ignore debug break during bootstrapping.
+ if (Bootstrapper::IsActive()) {
+ return Heap::undefined_value();
+ }
{
JavaScriptFrameIterator it;
=======================================
--- /branches/bleeding_edge/test/cctest/test-debug.cc Fri Nov 27 06:10:48
2009
+++ /branches/bleeding_edge/test/cctest/test-debug.cc Tue Dec 15 01:17:15
2009
@@ -3141,6 +3141,39 @@
CheckDebuggerUnloaded();
}
+static const char* kSimpleExtensionSource =
+ "(function Foo() {"
+ " return 4;"
+ "})() ";
+
+// http://crbug.com/28933
+// Test that debug break is disabled when bootstrapper is active.
+TEST(NoBreakWhenBootstrapping) {
+ v8::HandleScope scope;
+
+ // Register a debug event listener which sets the break flag and counts.
+ v8::Debug::SetDebugEventListener(DebugEventCounter);
+
+ // Set the debug break flag.
+ v8::Debug::DebugBreak();
+ break_point_hit_count = 0;
+ {
+ // Create a context with an extension to make sure that some JavaScript
+ // code is executed during bootstrapping.
+ v8::RegisterExtension(new v8::Extension("simpletest",
+ kSimpleExtensionSource));
+ const char* extension_names[] = { "simpletest" };
+ v8::ExtensionConfiguration extensions(1, extension_names);
+ v8::Persistent<v8::Context> context = v8::Context::New(&extensions);
+ context.Dispose();
+ }
+ // Check that no DebugBreak events occured during the context creation.
+ CHECK_EQ(0, break_point_hit_count);
+
+ // Get rid of the debug event listener.
+ v8::Debug::SetDebugEventListener(NULL);
+ CheckDebuggerUnloaded();
+}
static v8::Handle<v8::Array> NamedEnum(const v8::AccessorInfo&) {
v8::Handle<v8::Array> result = v8::Array::New(3);
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev