Commit 4f7caf2f authored by yangguo's avatar yangguo Committed by Commit bot

Debugger: fix stepping when break points are deactivated.

The flag for deactivating break points also affects stepping, since both
are implemented via debug break slots. Fixing this by introducing a new
flag solely responsible for deactivating actual break points.

R=mvstanton@chromium.org
BUG=chromium:119800
LOG=N

Review URL: https://codereview.chromium.org/1402913002

Cr-Commit-Position: refs/heads/master@{#31236}
parent ec1046f9
...@@ -38,6 +38,7 @@ Debug::Debug(Isolate* isolate) ...@@ -38,6 +38,7 @@ Debug::Debug(Isolate* isolate)
is_suppressed_(false), is_suppressed_(false),
live_edit_enabled_(true), // TODO(yangguo): set to false by default. live_edit_enabled_(true), // TODO(yangguo): set to false by default.
break_disabled_(false), break_disabled_(false),
break_points_active_(true),
in_debug_event_listener_(false), in_debug_event_listener_(false),
break_on_exception_(false), break_on_exception_(false),
break_on_uncaught_exception_(false), break_on_uncaught_exception_(false),
...@@ -457,7 +458,7 @@ void Debug::Break(Arguments args, JavaScriptFrame* frame) { ...@@ -457,7 +458,7 @@ void Debug::Break(Arguments args, JavaScriptFrame* frame) {
// If there is one or more real break points check whether any of these are // If there is one or more real break points check whether any of these are
// triggered. // triggered.
Handle<Object> break_points_hit(heap->undefined_value(), isolate_); Handle<Object> break_points_hit(heap->undefined_value(), isolate_);
if (break_location.HasBreakPoint()) { if (break_points_active_ && break_location.HasBreakPoint()) {
Handle<Object> break_point_objects = break_location.BreakPointObjects(); Handle<Object> break_point_objects = break_location.BreakPointObjects();
break_points_hit = CheckBreakPoints(break_point_objects); break_points_hit = CheckBreakPoints(break_point_objects);
} }
......
...@@ -482,7 +482,7 @@ class Debug { ...@@ -482,7 +482,7 @@ class Debug {
inline bool in_debug_scope() const { inline bool in_debug_scope() const {
return !!base::NoBarrier_Load(&thread_local_.current_debug_scope_); return !!base::NoBarrier_Load(&thread_local_.current_debug_scope_);
} }
void set_disable_break(bool v) { break_disabled_ = v; } void set_break_points_active(bool v) { break_points_active_ = v; }
StackFrame::Id break_frame_id() { return thread_local_.break_frame_id_; } StackFrame::Id break_frame_id() { return thread_local_.break_frame_id_; }
int break_id() { return thread_local_.break_id_; } int break_id() { return thread_local_.break_id_; }
...@@ -593,6 +593,7 @@ class Debug { ...@@ -593,6 +593,7 @@ class Debug {
bool is_suppressed_; bool is_suppressed_;
bool live_edit_enabled_; bool live_edit_enabled_;
bool break_disabled_; bool break_disabled_;
bool break_points_active_;
bool in_debug_event_listener_; bool in_debug_event_listener_;
bool break_on_exception_; bool break_on_exception_;
bool break_on_uncaught_exception_; bool break_on_uncaught_exception_;
......
...@@ -100,7 +100,7 @@ var debugger_flags = { ...@@ -100,7 +100,7 @@ var debugger_flags = {
getValue: function() { return this.value; }, getValue: function() { return this.value; },
setValue: function(value) { setValue: function(value) {
this.value = !!value; this.value = !!value;
%SetDisableBreak(!this.value); %SetBreakPointsActive(this.value);
} }
}, },
breakOnCaughtException: { breakOnCaughtException: {
......
...@@ -1062,11 +1062,11 @@ RUNTIME_FUNCTION(Runtime_GetThreadDetails) { ...@@ -1062,11 +1062,11 @@ RUNTIME_FUNCTION(Runtime_GetThreadDetails) {
// Sets the disable break state // Sets the disable break state
// args[0]: disable break state // args[0]: disable break state
RUNTIME_FUNCTION(Runtime_SetDisableBreak) { RUNTIME_FUNCTION(Runtime_SetBreakPointsActive) {
HandleScope scope(isolate); HandleScope scope(isolate);
DCHECK(args.length() == 1); DCHECK(args.length() == 1);
CONVERT_BOOLEAN_ARG_CHECKED(disable_break, 0); CONVERT_BOOLEAN_ARG_CHECKED(active, 0);
isolate->debug()->set_disable_break(disable_break); isolate->debug()->set_break_points_active(active);
return isolate->heap()->undefined_value(); return isolate->heap()->undefined_value();
} }
......
...@@ -176,7 +176,7 @@ namespace internal { ...@@ -176,7 +176,7 @@ namespace internal {
F(DebugPrintScopes, 0, 1) \ F(DebugPrintScopes, 0, 1) \
F(GetThreadCount, 1, 1) \ F(GetThreadCount, 1, 1) \
F(GetThreadDetails, 2, 1) \ F(GetThreadDetails, 2, 1) \
F(SetDisableBreak, 1, 1) \ F(SetBreakPointsActive, 1, 1) \
F(GetBreakLocations, 2, 1) \ F(GetBreakLocations, 2, 1) \
F(SetFunctionBreakPoint, 3, 1) \ F(SetFunctionBreakPoint, 3, 1) \
F(SetScriptBreakPoint, 4, 1) \ F(SetScriptBreakPoint, 4, 1) \
......
// Copyright 2015 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
function f() {
1;
2;
3;
}
var Debug = debug.Debug;
var exception = null;
var breaks = [];
function listener(event, exec_state, event_data, data) {
if (event != Debug.DebugEvent.Break) return;
try {
Debug.debuggerFlags().breakPointsActive.setValue(false);
breaks.push(exec_state.frame().sourceLineText().trimLeft());
exec_state.prepareStep(Debug.StepAction.StepIn, 1);
} catch (e) {
exception = e;
}
}
Debug.setListener(listener);
Debug.setBreakPoint(f, 0, 0);
f();
Debug.setListener(null);
Debug.debuggerFlags().breakPointsActive.setValue(true);
assertNull(exception);
assertEquals(breaks, ["1;", "2;", "3;", "}", "Debug.setListener(null);"]);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment