Author: [email protected]
Date: Wed Jun 17 07:04:55 2009
New Revision: 2208

Modified:
    trunk/src/api.cc
    trunk/src/version.cc
    trunk/test/cctest/test-debug.cc

Log:
Version 1.2.8.1.

Merge bleeding_e...@2206 to fix unloading the debugger with active  
breakpoints.

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

Modified: trunk/src/api.cc
==============================================================================
--- trunk/src/api.cc    (original)
+++ trunk/src/api.cc    Wed Jun 17 07:04:55 2009
@@ -3384,6 +3384,7 @@
  void Debug::SetMessageHandler2(v8::Debug::MessageHandler2 handler) {
    EnsureInitialized("v8::Debug::SetMessageHandler");
    ENTER_V8;
+  HandleScope scope;
    i::Debugger::SetMessageHandler(handler);
  }


Modified: trunk/src/version.cc
==============================================================================
--- trunk/src/version.cc        (original)
+++ trunk/src/version.cc        Wed Jun 17 07:04:55 2009
@@ -35,7 +35,7 @@
  #define MAJOR_VERSION     1
  #define MINOR_VERSION     2
  #define BUILD_NUMBER      8
-#define PATCH_LEVEL       0
+#define PATCH_LEVEL       1
  #define CANDIDATE_VERSION false

  // Define SONAME to have the SCons build the put a specific SONAME into the

Modified: trunk/test/cctest/test-debug.cc
==============================================================================
--- trunk/test/cctest/test-debug.cc     (original)
+++ trunk/test/cctest/test-debug.cc     Wed Jun 17 07:04:55 2009
@@ -4235,57 +4235,83 @@
  }


+// Debugger message handler which counts the number of breaks.
+static void SendContinueCommand();
+static void MessageHandlerBreakPointHitCount(
+    const v8::Debug::Message& message) {
+  if (message.IsEvent() && message.GetEvent() == v8::Break) {
+    // Count the number of breaks.
+    break_point_hit_count++;
+
+    SendContinueCommand();
+  }
+}
+
+
  // Test that clearing the debug event listener actually clears all break  
points
  // and related information.
  TEST(DebuggerUnload) {
-  v8::HandleScope scope;
    DebugLocalContext env;

    // Check debugger is unloaded before it is used.
    CheckDebuggerUnloaded();

-  // Add debug event listener.
+  // Set a debug event listener.
+  break_point_hit_count = 0;
    v8::Debug::SetDebugEventListener(DebugEventBreakPointHitCount,
                                     v8::Undefined());
-  // Create a couple of functions for the test.
-  v8::Local<v8::Function> foo =
-      CompileFunction(&env, "function foo(){x=1}", "foo");
-  v8::Local<v8::Function> bar =
-      CompileFunction(&env, "function bar(){y=2}", "bar");
-
-  // Set some break points.
-  SetBreakPoint(foo, 0);
-  SetBreakPoint(foo, 4);
-  SetBreakPoint(bar, 0);
-  SetBreakPoint(bar, 4);
-
-  // Make sure that the break points are there.
-  break_point_hit_count = 0;
-  foo->Call(env->Global(), 0, NULL);
-  CHECK_EQ(2, break_point_hit_count);
-  bar->Call(env->Global(), 0, NULL);
-  CHECK_EQ(4, break_point_hit_count);
-
-  // Remove the debug event listener without clearing breakpoints.
+  {
+    v8::HandleScope scope;
+    // Create a couple of functions for the test.
+    v8::Local<v8::Function> foo =
+        CompileFunction(&env, "function foo(){x=1}", "foo");
+    v8::Local<v8::Function> bar =
+        CompileFunction(&env, "function bar(){y=2}", "bar");
+
+    // Set some break points.
+    SetBreakPoint(foo, 0);
+    SetBreakPoint(foo, 4);
+    SetBreakPoint(bar, 0);
+    SetBreakPoint(bar, 4);
+
+    // Make sure that the break points are there.
+    break_point_hit_count = 0;
+    foo->Call(env->Global(), 0, NULL);
+    CHECK_EQ(2, break_point_hit_count);
+    bar->Call(env->Global(), 0, NULL);
+    CHECK_EQ(4, break_point_hit_count);
+  }
+
+  // Remove the debug event listener without clearing breakpoints. Do this
+  // outside a handle scope.
    v8::Debug::SetDebugEventListener(NULL);
    CheckDebuggerUnloaded(true);

-  // Set a new debug event listener.
-  v8::Debug::SetDebugEventListener(DebugEventBreakPointHitCount,
-                                   v8::Undefined());
-  // Check that the break points was actually cleared.
+  // Now set a debug message handler.
    break_point_hit_count = 0;
-  foo->Call(env->Global(), 0, NULL);
-  CHECK_EQ(0, break_point_hit_count);
-
-  // Set break points and run again.
-  SetBreakPoint(foo, 0);
-  SetBreakPoint(foo, 4);
-  foo->Call(env->Global(), 0, NULL);
-  CHECK_EQ(2, break_point_hit_count);
-
-  // Remove the debug event listener without clearing breakpoints again.
-  v8::Debug::SetDebugEventListener(NULL);
+  v8::Debug::SetMessageHandler2(MessageHandlerBreakPointHitCount);
+  {
+    v8::HandleScope scope;
+
+    // Get the test functions again.
+    v8::Local<v8::Function> foo =
+       
v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("foo")));
+    v8::Local<v8::Function> bar =
+       
v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("foo")));
+
+    foo->Call(env->Global(), 0, NULL);
+    CHECK_EQ(0, break_point_hit_count);
+
+    // Set break points and run again.
+    SetBreakPoint(foo, 0);
+    SetBreakPoint(foo, 4);
+    foo->Call(env->Global(), 0, NULL);
+    CHECK_EQ(2, break_point_hit_count);
+  }
+
+  // Remove the debug message handler without clearing breakpoints. Do this
+  // outside a handle scope.
+  v8::Debug::SetMessageHandler2(NULL);
    CheckDebuggerUnloaded(true);
  }


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"v8-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/v8-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to