Commit 4d6ff7df authored by jgruber's avatar jgruber Committed by Commit bot

[debugger] Stepping and break-related functions in wrapper

This adds clearStepping plus the family of
{set,clear}BreakOn{,Uncaught}Exception functions.

BUG=v8:5530

Review-Url: https://codereview.chromium.org/2482903002
Cr-Commit-Position: refs/heads/master@{#40834}
parent 984e6aed
...@@ -25,8 +25,6 @@ ...@@ -25,8 +25,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --expose-debug-as debug
// Get the Debug object exposed from the debug context global object.
Debug = debug.Debug Debug = debug.Debug
// Simple function which collects a simple call graph. // Simple function which collects a simple call graph.
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --expose-debug-as debug --allow-natives-syntax
// Test debug events when we listen to uncaught exceptions and // Test debug events when we listen to uncaught exceptions and
// the Promise is rejected in a chained closure after it has been resolved. // the Promise is rejected in a chained closure after it has been resolved.
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --harmony-async-await --expose-debug-as debug --allow-natives-syntax // Flags: --harmony-async-await
// The test observes the callbacks that async/await makes to the inspector // The test observes the callbacks that async/await makes to the inspector
// to make accurate stack traces. The pattern is based on saving a stack once // to make accurate stack traces. The pattern is based on saving a stack once
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --allow-natives-syntax --expose-debug-as debug
Debug = debug.Debug; Debug = debug.Debug;
Debug.setListener(function() {}); Debug.setListener(function() {});
......
...@@ -59,6 +59,10 @@ class DebugWrapper { ...@@ -59,6 +59,10 @@ class DebugWrapper {
Module: 8 Module: 8
}; };
// Types of exceptions that can be broken upon.
this.ExceptionBreak = { Caught : 0,
Uncaught: 1 };
// Store the current script id so we can skip corresponding break events. // Store the current script id so we can skip corresponding break events.
this.thisScriptId = %FunctionGetScriptId(receive); this.thisScriptId = %FunctionGetScriptId(receive);
...@@ -76,6 +80,39 @@ class DebugWrapper { ...@@ -76,6 +80,39 @@ class DebugWrapper {
stepInto() { this.sendMessageForMethodChecked("Debugger.stepInto"); } stepInto() { this.sendMessageForMethodChecked("Debugger.stepInto"); }
stepOut() { this.sendMessageForMethodChecked("Debugger.stepOut"); } stepOut() { this.sendMessageForMethodChecked("Debugger.stepOut"); }
setBreakOnException() {
this.sendMessageForMethodChecked(
"Debugger.setPauseOnExceptions", { state : "all" });
}
clearBreakOnException() {
const newState = this.isBreakOnUncaughtException() ? "uncaught" : "none";
this.sendMessageForMethodChecked(
"Debugger.setPauseOnExceptions", { state : newState });
}
isBreakOnException() {
return !!%IsBreakOnException(this.ExceptionBreak.Caught);
};
setBreakOnUncaughtException() {
const newState = this.isBreakOnException() ? "all" : "uncaught";
this.sendMessageForMethodChecked(
"Debugger.setPauseOnExceptions", { state : newState });
}
clearBreakOnUncaughtException() {
const newState = this.isBreakOnException() ? "all" : "none";
this.sendMessageForMethodChecked(
"Debugger.setPauseOnExceptions", { state : newState });
}
isBreakOnUncaughtException() {
return !!%IsBreakOnException(this.ExceptionBreak.Uncaught);
};
clearStepping() { %ClearStepping(); };
// Returns the resulting breakpoint id. // Returns the resulting breakpoint id.
setBreakPoint(func, opt_line, opt_column, opt_condition) { setBreakPoint(func, opt_line, opt_column, opt_condition) {
assertTrue(%IsFunction(func)); assertTrue(%IsFunction(func));
...@@ -161,8 +198,8 @@ class DebugWrapper { ...@@ -161,8 +198,8 @@ class DebugWrapper {
send(message); send(message);
} }
sendMessageForMethodChecked(method) { sendMessageForMethodChecked(method, params) {
const {msgid, msg} = this.createMessage(method); const {msgid, msg} = this.createMessage(method, params);
this.sendMessage(msg); this.sendMessage(msg);
this.takeReplyChecked(msgid); this.takeReplyChecked(msgid);
} }
......
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