Revision: 24924
Author:   [email protected]
Date:     Tue Oct 28 09:44:16 2014 UTC
Log:      Prevent recursion in the debug event listener.

[email protected]
BUG=chromium:409614
LOG=N

Review URL: https://codereview.chromium.org/684573005
https://code.google.com/p/v8/source/detail?r=24924

Added:
 /branches/bleeding_edge/test/mjsunit/regress/regress-crbug-409614.js
Modified:
 /branches/bleeding_edge/src/debug.cc

=======================================
--- /dev/null
+++ /branches/bleeding_edge/test/mjsunit/regress/regress-crbug-409614.js Tue Oct 28 09:44:16 2014 UTC
@@ -0,0 +1,37 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --expose-debug-as debug
+
+Debug = debug.Debug;
+var exception = null;
+var error_count = 0;
+
+function f() {
+  return 0;  // Break
+}
+
+function listener(event, exec_state, event_data, data) {
+  if (event != Debug.DebugEvent.Break) return;
+  try {
+    if (exec_state.frame(0).sourceLineText().indexOf("Break") <0) {
+      error_count++;
+    }
+    exec_state.prepareStep(Debug.StepAction.StepIn, 2);
+    f();  // We should not break in this call of f().
+  } catch (e) {
+    print(e + e.stack);
+    exception = e;
+  }
+}
+
+Debug.setListener(listener);
+
+debugger;  // Break
+f();
+
+Debug.setListener(null);  // Break
+
+assertNull(exception);
+assertEquals(0, error_count);
=======================================
--- /branches/bleeding_edge/src/debug.cc        Mon Oct 27 12:03:25 2014 UTC
+++ /branches/bleeding_edge/src/debug.cc        Tue Oct 28 09:44:16 2014 UTC
@@ -2762,6 +2762,7 @@
                               Handle<Object> exec_state,
                               Handle<Object> event_data,
                               v8::Debug::ClientData* client_data) {
+  DisableBreak no_break(this, true);
   if (event_listener_->IsForeign()) {
     // Invoke the C debug event listener.
     v8::Debug::EventCallback callback =

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to