[debug-wrapper] Adapt tests, breakpoint.actual_location
Adapted various tests to restrictions of inspector protocol: * osr-typing-debug-change: Don't set function variable value. * debug-evaluate-locals: Add variable introduced by eval, run typeof inside evaluate(). * regress-419663: Don't set duplicate breakpoints. * regress-crbug-465298: Compare against function name instead of value. * regress-crbug-621361: Make evaluate return string results. * debug-script: Various counts were off due to new way tests are called. Added new inspector script type. Breakpoints now contain the actual break position, and remote object reconstruction has been extended a bit. BUG=v8:5530 Review-Url: https://codereview.chromium.org/2505363002 Cr-Commit-Position: refs/heads/master@{#41129}
This commit is contained in:
parent
bd25a33129
commit
1834ab7246
@ -1815,6 +1815,22 @@ RUNTIME_FUNCTION(Runtime_ScriptPositionInfo) {
|
||||
return *GetJSPositionInfo(script_handle, position, offset_flag, isolate);
|
||||
}
|
||||
|
||||
// TODO(5530): Rename once conflicting function has been deleted.
|
||||
RUNTIME_FUNCTION(Runtime_ScriptPositionInfo2) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK(args.length() == 3);
|
||||
CONVERT_NUMBER_CHECKED(int32_t, scriptid, Int32, args[0]);
|
||||
CONVERT_NUMBER_CHECKED(int32_t, position, Int32, args[1]);
|
||||
CONVERT_BOOLEAN_ARG_CHECKED(with_offset, 2);
|
||||
|
||||
Handle<Script> script;
|
||||
CHECK(GetScriptById(isolate, scriptid, &script));
|
||||
|
||||
const Script::OffsetFlag offset_flag =
|
||||
with_offset ? Script::WITH_OFFSET : Script::NO_OFFSET;
|
||||
return *GetJSPositionInfo(script, position, offset_flag, isolate);
|
||||
}
|
||||
|
||||
// Returns the given line as a string, or null if line is out of bounds.
|
||||
// The parameter line is expected to include the script's line offset.
|
||||
// TODO(5530): Remove once uses in debug.js are gone.
|
||||
|
@ -190,6 +190,7 @@ namespace internal {
|
||||
F(ScriptLocationFromLine, 4, 1) \
|
||||
F(ScriptLocationFromLine2, 4, 1) \
|
||||
F(ScriptPositionInfo, 3, 1) \
|
||||
F(ScriptPositionInfo2, 3, 1) \
|
||||
F(ScriptSourceLine, 2, 1) \
|
||||
F(DebugPrepareStepInIfStepping, 1, 1) \
|
||||
F(DebugPrepareStepInSuspendedGenerator, 0, 1) \
|
||||
|
@ -2,7 +2,6 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --allow-natives-syntax --expose-debug-as debug
|
||||
|
||||
var Debug = debug.Debug;
|
||||
|
||||
@ -80,15 +79,12 @@ if (changed) {
|
||||
assertEquals(0.5, r3);
|
||||
}
|
||||
|
||||
var counter = 0;
|
||||
var o = { toString : function() { counter++; return 100; } };
|
||||
|
||||
function listenerSetJToObject(
|
||||
event, exec_state, event_data, data) {
|
||||
if (event == Debug.DebugEvent.Break) {
|
||||
var scope = exec_state.frame(1).scope(0);
|
||||
try {
|
||||
scope.setVariableValue("j", o);
|
||||
scope.setVariableValue("j", 100);
|
||||
changed = true;
|
||||
} catch(e) {
|
||||
changed = false;
|
||||
@ -113,7 +109,6 @@ function ChangeIntVarAndOsr() {
|
||||
var r4 = ChangeIntVarAndOsr();
|
||||
if (changed) {
|
||||
assertEquals(101, r4);
|
||||
assertEquals(1, counter);
|
||||
} else {
|
||||
assertEquals(5, r4);
|
||||
}
|
@ -25,8 +25,6 @@
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// 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
|
||||
|
||||
listenerComplete = false;
|
||||
@ -65,14 +63,16 @@ function g() {
|
||||
}
|
||||
|
||||
function checkFrame1(frame) {
|
||||
// Frame 1 (g) has normal variable a (and arguments).
|
||||
// Frame 1 (g) has normal variable a, b (and arguments).
|
||||
var count = frame.localCount();
|
||||
assertEquals(2, count);
|
||||
assertEquals(3, count);
|
||||
for (var i = 0; i < count; ++i) {
|
||||
var name = frame.localName(i);
|
||||
var value = frame.localValue(i).value();
|
||||
if (name == 'a') {
|
||||
assertEquals(3, value);
|
||||
} else if (name == 'b') {
|
||||
assertEquals(4, value);
|
||||
} else {
|
||||
assertEquals('arguments', name);
|
||||
}
|
||||
@ -119,11 +119,11 @@ function listener(event, exec_state, event_data, data) {
|
||||
assertEquals(3, exec_state.frame(1).evaluate('a').value());
|
||||
assertEquals(4, exec_state.frame(1).evaluate('b').value());
|
||||
assertEquals("function",
|
||||
typeof exec_state.frame(1).evaluate('eval').value());
|
||||
exec_state.frame(1).evaluate('typeof eval').value());
|
||||
assertEquals(5, exec_state.frame(2).evaluate('a').value());
|
||||
assertEquals(6, exec_state.frame(2).evaluate('b').value());
|
||||
assertEquals("function",
|
||||
typeof exec_state.frame(2).evaluate('eval').value());
|
||||
exec_state.frame(2).evaluate('typeof eval').value());
|
||||
assertEquals("foo",
|
||||
exec_state.frame(0).evaluate('a = "foo"').value());
|
||||
assertEquals("bar",
|
@ -25,8 +25,6 @@
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// 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
|
||||
|
@ -51,6 +51,7 @@ var named_native_count = 0;
|
||||
var named_native_names = {};
|
||||
var extension_count = 0;
|
||||
var normal_count = 0;
|
||||
var inspector_count = 0;
|
||||
var scripts = Debug.scripts();
|
||||
for (i = 0; i < scripts.length; i++) {
|
||||
if (scripts[i].type == Debug.ScriptType.Native) {
|
||||
@ -66,6 +67,8 @@ for (i = 0; i < scripts.length; i++) {
|
||||
extension_count++;
|
||||
} else if (scripts[i].type == Debug.ScriptType.Normal) {
|
||||
normal_count++;
|
||||
} else if (scripts[i].type == Debug.ScriptType.Inspector) {
|
||||
inspector_count++;
|
||||
} else {
|
||||
assertUnreachable('Unexpected type ' + scripts[i].type);
|
||||
}
|
||||
@ -75,9 +78,10 @@ for (i = 0; i < scripts.length; i++) {
|
||||
assertEquals(%NativeScriptsCount(), named_native_count);
|
||||
// The 'gc' extension and one or two extras scripts are loaded.
|
||||
assertTrue(extension_count == 2 || extension_count == 3);
|
||||
// This script and mjsunit.js has been loaded. If using d8, d8 loads
|
||||
// a normal script during startup too.
|
||||
assertTrue(normal_count == 2 || normal_count == 3);
|
||||
// This script, test-api.js and mjsunit.js has been loaded. If using d8, d8
|
||||
// loads a normal script during startup too.
|
||||
assertTrue(normal_count == 3 || normal_count == 4);
|
||||
assertTrue(inspector_count == 1);
|
||||
|
||||
// Test a builtins script.
|
||||
var array_script = Debug.findScript('native array.js');
|
@ -2,7 +2,6 @@
|
||||
// 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 --allow-natives-syntax
|
||||
|
||||
// Test debug events when a Promise is rejected, which is caught by a custom
|
||||
// promise, which has a number for reject closure. We expect an Exception debug
|
@ -2,7 +2,6 @@
|
||||
// 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 --allow-natives-syntax
|
||||
|
||||
// Test debug events when a Promise is rejected, which is caught by a
|
||||
// custom promise, which throws a new exception in its reject handler.
|
@ -2,7 +2,6 @@
|
||||
// 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 --allow-natives-syntax
|
||||
|
||||
// Test debug events when a Promise is rejected, which is caught by a custom
|
||||
// promise, which has undefined for reject closure. We expect an Exception
|
@ -2,7 +2,6 @@
|
||||
// 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
|
||||
|
||||
// Test that the parameter initialization block scope set up for
|
||||
// sloppy eval is visible to the debugger.
|
@ -2,7 +2,6 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --allow-natives-syntax --expose-debug-as debug
|
||||
|
||||
Debug = debug.Debug
|
||||
var exception = null;
|
@ -2,7 +2,6 @@
|
||||
// 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
|
||||
|
||||
var o = {
|
||||
f: function(x) {
|
||||
@ -20,11 +19,8 @@ Debug.setListener(function() {});
|
||||
var script = Debug.findScript(sentinel);
|
||||
|
||||
// Used in Debug.setScriptBreakPointById.
|
||||
var p = Debug.findScriptSourcePosition(script, 9, 0);
|
||||
var p = Debug.findScriptSourcePosition(script, 8, 0);
|
||||
var q = Debug.setBreakPointByScriptIdAndPosition(script.id, p).actual_position;
|
||||
var r = Debug.setBreakPointByScriptIdAndPosition(script.id, q).actual_position;
|
||||
|
||||
assertEquals(q, r);
|
||||
|
||||
function assertLocation(p, l, c) {
|
||||
var location = script.locationFromPosition(p, false);
|
||||
@ -32,6 +28,5 @@ function assertLocation(p, l, c) {
|
||||
assertEquals(c, location.column);
|
||||
}
|
||||
|
||||
assertLocation(p, 9, 0);
|
||||
assertLocation(q, 9, 4);
|
||||
assertLocation(r, 9, 4);
|
||||
assertLocation(p, 8, 0);
|
||||
assertLocation(q, 8, 4);
|
@ -2,7 +2,6 @@
|
||||
// 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 outer() {
|
||||
var C = (function C_() {
|
@ -2,13 +2,12 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --noturbo-osr --noturbo-inlining --expose-debug-as debug
|
||||
// Flags: --noturbo-osr --noturbo-inlining
|
||||
|
||||
var stdlib = this;
|
||||
var buffer = new ArrayBuffer(64 * 1024);
|
||||
var foreign = { thrower: thrower, debugme: debugme }
|
||||
|
||||
// Get the Debug object exposed from the debug context global object.
|
||||
Debug = debug.Debug;
|
||||
|
||||
var listenerCalled = false;
|
||||
@ -16,7 +15,7 @@ function listener(event, exec_state, event_data, data) {
|
||||
try {
|
||||
if (event == Debug.DebugEvent.Break) {
|
||||
var frame = exec_state.frame(1);
|
||||
assertEquals(m.foo, frame.func().value());
|
||||
assertEquals("foo", frame.func().name());
|
||||
listenerCalled = true;
|
||||
}
|
||||
} catch (e) {
|
@ -2,7 +2,6 @@
|
||||
// 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
|
||||
|
||||
var Debug = debug.Debug;
|
||||
var receiver = null;
|
@ -2,7 +2,6 @@
|
||||
// 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
|
||||
|
||||
var Debug = debug.Debug;
|
||||
var receiver = null;
|
@ -2,7 +2,7 @@
|
||||
// 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
|
||||
// Flags: --min-preparse-length=10
|
||||
|
||||
var source =
|
||||
"var foo = function foo() {\n" +
|
@ -2,7 +2,6 @@
|
||||
// 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 --allow-natives-syntax
|
||||
|
||||
var Debug = debug.Debug;
|
||||
var expected = ["debugger;",
|
@ -2,7 +2,6 @@
|
||||
// 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
|
||||
|
||||
var Debug = debug.Debug;
|
||||
var steps = 0;
|
||||
@ -15,12 +14,12 @@ function listener(event, execState, eventData, data) {
|
||||
debug.ScopeType.Script,
|
||||
debug.ScopeType.Global],
|
||||
execState.frame().allScopes().map(s => s.scopeType()));
|
||||
var x_value = execState.frame().evaluate("x").value();
|
||||
var x_value = execState.frame().evaluate("String(x)").value();
|
||||
if (steps < 2) {
|
||||
assertEquals(undefined, x_value);
|
||||
assertEquals("undefined", x_value);
|
||||
execState.prepareStep(Debug.StepAction.StepIn);
|
||||
} else {
|
||||
assertEquals("l => l", x_value.toString());
|
||||
assertEquals("l => l", x_value);
|
||||
}
|
||||
steps++;
|
||||
} catch (e) {
|
@ -7,6 +7,24 @@
|
||||
# Issue 3660: Replacing activated TurboFan frames by unoptimized code does
|
||||
# not work, but we expect it to not crash.
|
||||
'debug/debug-step-turbofan': [PASS, FAIL],
|
||||
|
||||
# Issue 5587: The eval'ed code is piped through Ignition and fails when being
|
||||
# live edited. This needs investigation.
|
||||
'debug/debug-liveedit-double-call': [SKIP],
|
||||
|
||||
# Issue 3641: The new 'then' semantics suppress some exceptions.
|
||||
# These tests may be changed or removed when 'chain' is deprecated.
|
||||
'debug/es6/debug-promises/reject-with-throw-in-reject': [FAIL],
|
||||
'debug/es6/debug-promises/reject-with-undefined-reject': [FAIL],
|
||||
'debug/es6/debug-promises/reject-with-invalid-reject': [FAIL],
|
||||
|
||||
# Issue 5650: Unexpected order of break pauses with microtasks.
|
||||
'debug/regress/regress-crbug-568477-2': [FAIL],
|
||||
'debug/es6/debug-stepin-microtasks': [FAIL],
|
||||
|
||||
# Issue 5651: Context mismatch in ScopeIterator::Type() for eval default
|
||||
# parameter value
|
||||
'debug/es6/debug-scope-default-param-with-eval': [FAIL],
|
||||
}], # ALWAYS
|
||||
|
||||
##############################################################################
|
||||
@ -30,9 +48,23 @@
|
||||
|
||||
# TODO(jarin/mstarzinger): Investigate debugger issues with TurboFan.
|
||||
'debug/debug-evaluate-closure': [FAIL],
|
||||
'debug/debug-evaluate-locals': [FAIL],
|
||||
'debug/es6/debug-evaluate-blockscopes': [FAIL],
|
||||
'debug/debug-liveedit-double-call': [FAIL],
|
||||
}], # variant == turbofan_opt
|
||||
|
||||
##############################################################################
|
||||
['variant == ignition or variant == ignition_staging', {
|
||||
# TODO(5587): fails to liveedit evaled code.
|
||||
'debug/debug-liveedit-double-call': [FAIL],
|
||||
}], # variant == ignition
|
||||
|
||||
##############################################################################
|
||||
['variant == ignition_turbofan', {
|
||||
# TODO(5587): fails to liveedit evaled code.
|
||||
'debug/debug-liveedit-double-call': [FAIL],
|
||||
}], # variant == ignition_turbofan
|
||||
|
||||
##############################################################################
|
||||
['gc_stress == True', {
|
||||
# Async function tests taking too long
|
||||
@ -57,6 +89,7 @@
|
||||
|
||||
# Stack manipulations in LiveEdit is not implemented for this arch.
|
||||
'debug/debug-liveedit-check-stack': [SKIP],
|
||||
'debug/debug-liveedit-double-call': [SKIP],
|
||||
'debug/debug-liveedit-stack-padding': [SKIP],
|
||||
'debug/debug-liveedit-restart-frame': [SKIP],
|
||||
}], # 'arch == s390 or arch == s390x'
|
||||
|
@ -49,7 +49,9 @@ class DebugWrapper {
|
||||
this.ScriptType = { Native: 0,
|
||||
Extension: 1,
|
||||
Normal: 2,
|
||||
Wasm: 3};
|
||||
Wasm: 3,
|
||||
Inspector: 4,
|
||||
};
|
||||
|
||||
// A copy of the scope types from runtime-debug.cc.
|
||||
// NOTE: these constants should be backward-compatible, so
|
||||
@ -160,8 +162,14 @@ class DebugWrapper {
|
||||
return this.setBreakPointAtLocation(scriptid, loc, opt_condition);
|
||||
}
|
||||
|
||||
clearBreakPoint(breakid) {
|
||||
assertTrue(this.breakpoints.has(breakid));
|
||||
setBreakPointByScriptIdAndPosition(scriptid, position) {
|
||||
const loc = %ScriptPositionInfo2(scriptid, position, false);
|
||||
return this.setBreakPointAtLocation(scriptid, loc, undefined);
|
||||
}
|
||||
|
||||
clearBreakPoint(breakpoint) {
|
||||
assertTrue(this.breakpoints.has(breakpoint));
|
||||
const breakid = breakpoint.id;
|
||||
const {msgid, msg} = this.createMessage(
|
||||
"Debugger.removeBreakpoint", { breakpointId : breakid });
|
||||
this.sendMessage(msg);
|
||||
@ -170,8 +178,8 @@ class DebugWrapper {
|
||||
}
|
||||
|
||||
clearAllBreakPoints() {
|
||||
for (let breakid of this.breakpoints) {
|
||||
this.clearBreakPoint(breakid);
|
||||
for (let breakpoint of this.breakpoints) {
|
||||
this.clearBreakPoint(breakpoint);
|
||||
}
|
||||
this.breakpoints.clear();
|
||||
}
|
||||
@ -347,13 +355,21 @@ class DebugWrapper {
|
||||
this.sendMessage(msg);
|
||||
|
||||
const reply = this.takeReplyChecked(msgid);
|
||||
assertTrue(reply.result !== undefined);
|
||||
const breakid = reply.result.breakpointId;
|
||||
const result = reply.result;
|
||||
assertTrue(result !== undefined);
|
||||
const breakid = result.breakpointId;
|
||||
assertTrue(breakid !== undefined);
|
||||
|
||||
this.breakpoints.add(breakid);
|
||||
const actualLoc = %ScriptLocationFromLine2(scriptid,
|
||||
result.actualLocation.lineNumber, result.actualLocation.columnNumber,
|
||||
0);
|
||||
|
||||
return breakid;
|
||||
const breakpoint = { id : result.breakpointId,
|
||||
actual_position : actualLoc.position,
|
||||
}
|
||||
|
||||
this.breakpoints.add(breakpoint);
|
||||
return breakpoint;
|
||||
}
|
||||
|
||||
execStatePrepareStep(action) {
|
||||
@ -418,7 +434,10 @@ class DebugWrapper {
|
||||
newValue : { value : value }
|
||||
});
|
||||
this.sendMessage(msg);
|
||||
this.takeReplyChecked(msgid);
|
||||
const reply = this.takeReplyChecked(msgid);
|
||||
if (reply.error) {
|
||||
throw new Error("Failed to set variable value");
|
||||
}
|
||||
}
|
||||
|
||||
execStateScope(frame, scope_index) {
|
||||
@ -455,7 +474,7 @@ class DebugWrapper {
|
||||
|
||||
getProperties(objectId) {
|
||||
const {msgid, msg} = this.createMessage(
|
||||
"Runtime.getProperties", { objectId : objectId });
|
||||
"Runtime.getProperties", { objectId : objectId, ownProperties: true });
|
||||
this.sendMessage(msg);
|
||||
const reply = this.takeReplyChecked(msgid);
|
||||
return reply.result.result;
|
||||
@ -501,31 +520,62 @@ class DebugWrapper {
|
||||
|
||||
reconstructRemoteObject(obj) {
|
||||
let value = obj.value;
|
||||
if (obj.type == "object") {
|
||||
if (obj.subtype == "error") {
|
||||
const desc = obj.description;
|
||||
switch (obj.className) {
|
||||
case "EvalError": throw new EvalError(desc);
|
||||
case "RangeError": throw new RangeError(desc);
|
||||
case "ReferenceError": throw new ReferenceError(desc);
|
||||
case "SyntaxError": throw new SyntaxError(desc);
|
||||
case "TypeError": throw new TypeError(desc);
|
||||
case "URIError": throw new URIError(desc);
|
||||
default: throw new Error(desc);
|
||||
let isUndefined = false;
|
||||
|
||||
switch (obj.type) {
|
||||
case "object": {
|
||||
switch (obj.subtype) {
|
||||
case "error": {
|
||||
const desc = obj.description;
|
||||
switch (obj.className) {
|
||||
case "EvalError": throw new EvalError(desc);
|
||||
case "RangeError": throw new RangeError(desc);
|
||||
case "ReferenceError": throw new ReferenceError(desc);
|
||||
case "SyntaxError": throw new SyntaxError(desc);
|
||||
case "TypeError": throw new TypeError(desc);
|
||||
case "URIError": throw new URIError(desc);
|
||||
default: throw new Error(desc);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "array": {
|
||||
const array = [];
|
||||
const props = this.propertiesToObject(
|
||||
this.getProperties(obj.objectId));
|
||||
for (let i = 0; i < props.length; i++) {
|
||||
array[i] = props[i];
|
||||
}
|
||||
value = array;
|
||||
break;
|
||||
}
|
||||
case "null": {
|
||||
value = null;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
value = this.propertiesToObject(this.getProperties(obj.objectId));
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (obj.subtype == "array") {
|
||||
const array = [];
|
||||
const props = this.propertiesToObject(
|
||||
this.getProperties(obj.objectId));
|
||||
for (let i = 0; i < props.length; i++) {
|
||||
array[i] = props[i];
|
||||
}
|
||||
value = array;
|
||||
break;
|
||||
}
|
||||
case "undefined": {
|
||||
value = undefined;
|
||||
isUndefined = true;
|
||||
break;
|
||||
}
|
||||
case "string":
|
||||
case "number":
|
||||
case "boolean": {
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return { value : () => value,
|
||||
isUndefined : () => obj.type == "undefined"
|
||||
isUndefined : () => isUndefined
|
||||
};
|
||||
}
|
||||
|
||||
@ -575,6 +625,7 @@ class DebugWrapper {
|
||||
localCount : () => this.execStateFrameLocalCount(frame),
|
||||
localName : (ix) => this.execStateFrameLocalName(frame, ix),
|
||||
localValue: (ix) => this.execStateFrameLocalValue(frame, ix),
|
||||
receiver : () => this.evaluateOnCallFrame(frame, "this"),
|
||||
restart : () => this.execStateFrameRestart(frame),
|
||||
scopeCount : () => frame.scopeChain.length,
|
||||
scope : (index) => this.execStateScope(frame, index),
|
||||
@ -599,7 +650,7 @@ class DebugWrapper {
|
||||
|
||||
eventDataScriptSource(id) {
|
||||
const {msgid, msg} = this.createMessage(
|
||||
"Debugger.getScriptSource", { scriptId : id });
|
||||
"Debugger.getScriptSource", { scriptId : String(id) });
|
||||
this.sendMessage(msg);
|
||||
const reply = this.takeReplyChecked(msgid);
|
||||
return reply.result.scriptSource;
|
||||
@ -613,7 +664,7 @@ class DebugWrapper {
|
||||
}
|
||||
|
||||
eventDataScript(params) {
|
||||
const id = params.scriptId;
|
||||
const id = parseInt(params.scriptId);
|
||||
const name = params.url ? params.url : undefined;
|
||||
|
||||
return { id : () => id,
|
||||
|
@ -1,49 +0,0 @@
|
||||
// Copyright 2016 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;
|
||||
ScopeType = debug.ScopeType;
|
||||
var exception = null;
|
||||
var nested = false;
|
||||
|
||||
function bar() {
|
||||
let a = 1;
|
||||
(function foo() {
|
||||
let b = a;
|
||||
with (new Proxy({}, {})) {
|
||||
debugger;
|
||||
}
|
||||
})();
|
||||
}
|
||||
|
||||
function checkScopes(scopes, expectation) {
|
||||
assertEquals(scopes.map(s => s.scopeType()), expectation);
|
||||
}
|
||||
|
||||
function listener(event, exec_state, event_data, data) {
|
||||
if (event != Debug.DebugEvent.Break) return;
|
||||
try {
|
||||
if (!nested) {
|
||||
nested = true;
|
||||
checkScopes(exec_state.frame(0).allScopes(),
|
||||
[ ScopeType.With, ScopeType.Local, ScopeType.Closure,
|
||||
ScopeType.Script, ScopeType.Global ]);
|
||||
exec_state.frame(0).evaluate("debugger;");
|
||||
} else {
|
||||
checkScopes(exec_state.frame(0).allScopes(),
|
||||
[ ScopeType.Eval, ScopeType.With, ScopeType.Closure,
|
||||
ScopeType.Script, ScopeType.Global ]);
|
||||
}
|
||||
} catch (e) {
|
||||
exception = e;
|
||||
print(e + e.stack);
|
||||
}
|
||||
}
|
||||
|
||||
Debug.setListener(listener);
|
||||
bar();
|
||||
Debug.setListener(null);
|
||||
assertNull(exception);
|
@ -1,28 +0,0 @@
|
||||
// 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 --allow-natives-syntax
|
||||
|
||||
Debug = debug.Debug;
|
||||
|
||||
function f() { return %_DebugIsActive() != 0; }
|
||||
|
||||
assertFalse(f());
|
||||
assertFalse(f());
|
||||
Debug.setListener(function() {});
|
||||
assertTrue(f());
|
||||
Debug.setListener(null);
|
||||
assertFalse(f());
|
||||
|
||||
%OptimizeFunctionOnNextCall(f);
|
||||
assertFalse(f());
|
||||
assertOptimized(f);
|
||||
|
||||
Debug.setListener(function() {});
|
||||
assertTrue(f());
|
||||
assertOptimized(f);
|
||||
|
||||
Debug.setListener(null);
|
||||
assertFalse(f());
|
||||
assertOptimized(f);
|
@ -1,115 +0,0 @@
|
||||
// Copyright 2010 the V8 project authors. All rights reserved.
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following
|
||||
// disclaimer in the documentation and/or other materials provided
|
||||
// with the distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// 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.setListener(function(){});
|
||||
|
||||
var function_z_text =
|
||||
" function Z() {\n"
|
||||
+ " return 'Z';\n" // Breakpoint line ( #6 )
|
||||
+ " }\n";
|
||||
|
||||
eval(
|
||||
"function F25() {\n"
|
||||
+ " return 25;\n" // Breakpoint line ( #1 )
|
||||
+ "}\n"
|
||||
+ "function F26 () {\n"
|
||||
+ " var x = 20;\n"
|
||||
+ function_z_text // function takes exactly 3 lines
|
||||
// // Breakpoint line ( #6 )
|
||||
//
|
||||
+ " var y = 6;\n"
|
||||
+ " return x + y;\n"
|
||||
+ "}\n"
|
||||
+ "function Nested() {\n"
|
||||
+ " var a = 30;\n"
|
||||
+ " return function F27() {\n"
|
||||
+ " var b = 3;\n" // Breakpoint line ( #14 )
|
||||
+ " return a - b;\n"
|
||||
+ " }\n"
|
||||
+ "}\n"
|
||||
);
|
||||
|
||||
|
||||
assertEquals(25, F25());
|
||||
assertEquals(26, F26());
|
||||
|
||||
var script = Debug.findScript(F25);
|
||||
|
||||
assertEquals(0, Debug.scriptBreakPoints().length);
|
||||
|
||||
Debug.setScriptBreakPoint(Debug.ScriptBreakPointType.ScriptId, script.id, 1, 1, "true || false || false");
|
||||
Debug.setScriptBreakPoint(Debug.ScriptBreakPointType.ScriptId, script.id, 6, 1, "true || false || false");
|
||||
Debug.setScriptBreakPoint(Debug.ScriptBreakPointType.ScriptId, script.id, 14, 1, "true || false || false");
|
||||
|
||||
assertEquals(3, Debug.scriptBreakPoints().length);
|
||||
|
||||
var new_source = script.source.replace(function_z_text, "");
|
||||
print("new source: " + new_source);
|
||||
|
||||
var change_log = new Array();
|
||||
var result = Debug.LiveEdit.SetScriptSource(script, new_source, false, change_log);
|
||||
print("Result: " + JSON.stringify(result) + "\n");
|
||||
print("Change log: " + JSON.stringify(change_log) + "\n");
|
||||
|
||||
var breaks = Debug.scriptBreakPoints();
|
||||
|
||||
// One breakpoint gets duplicated in a old version of script.
|
||||
assertTrue(breaks.length > 3 + 1);
|
||||
|
||||
var breakpoints_in_script = 0;
|
||||
var break_position_map = {};
|
||||
for (var i = 0; i < breaks.length; i++) {
|
||||
if (breaks[i].script_id() == script.id) {
|
||||
break_position_map[breaks[i].line()] = true;
|
||||
breakpoints_in_script++;
|
||||
}
|
||||
}
|
||||
|
||||
assertEquals(3, breakpoints_in_script);
|
||||
|
||||
// Check 2 breakpoints. The one in deleted function should have been moved somewhere.
|
||||
assertTrue(break_position_map[1]);
|
||||
assertTrue(break_position_map[11]);
|
||||
|
||||
// Delete all breakpoints to make this test reentrant.
|
||||
var breaks = Debug.scriptBreakPoints();
|
||||
var breaks_ids = [];
|
||||
|
||||
for (var i = 0; i < breaks.length; i++) {
|
||||
breaks_ids.push(breaks[i].number());
|
||||
}
|
||||
|
||||
for (var i = 0; i < breaks_ids.length; i++) {
|
||||
Debug.clearBreakPoint(breaks_ids[i]);
|
||||
}
|
||||
|
||||
assertEquals(0, Debug.scriptBreakPoints().length);
|
||||
Debug.setListener(null);
|
@ -84,7 +84,6 @@ function TestStrict(receiver) {
|
||||
|
||||
listener_delegate = function(exec_state) {
|
||||
var receiver = exec_state.frame().receiver();
|
||||
assertTrue(!receiver.isObject());
|
||||
assertEquals(expected_receiver, receiver.value())
|
||||
}
|
||||
|
||||
@ -108,7 +107,6 @@ function TestNonStrict(receiver) {
|
||||
|
||||
listener_delegate = function(exec_state) {
|
||||
var receiver = exec_state.frame().receiver();
|
||||
assertTrue(receiver.isObject());
|
||||
assertEquals(expected_receiver, receiver.value());
|
||||
}
|
||||
|
||||
|
@ -1,67 +0,0 @@
|
||||
// Copyright 2012 the V8 project authors. All rights reserved.
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following
|
||||
// disclaimer in the documentation and/or other materials provided
|
||||
// with the distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// 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
|
||||
|
||||
// Simple debug event handler which just counts the number of break points hit.
|
||||
var break_point_hit_count = 0;
|
||||
|
||||
function listener(event, exec_state, event_data, data) {
|
||||
if (event == Debug.DebugEvent.Break) {
|
||||
break_point_hit_count++;
|
||||
}
|
||||
};
|
||||
|
||||
// Add the debug event listener.
|
||||
Debug.setListener(listener);
|
||||
|
||||
function makeClosure() {
|
||||
var x;
|
||||
return function() {
|
||||
return x; // Breakpoint line ( #47 )
|
||||
};
|
||||
}
|
||||
|
||||
// Create closure before break point is set.
|
||||
var closure = makeClosure();
|
||||
|
||||
// The debugger triggers re-compilation.
|
||||
assertEquals(0, Debug.scriptBreakPoints().length);
|
||||
var scr = Debug.findScript(makeClosure);
|
||||
var sbp = Debug.setScriptBreakPointById(scr.id, 47);
|
||||
assertEquals(1, Debug.scriptBreakPoints().length);
|
||||
|
||||
// Ensure the closure actually triggers a break point hit.
|
||||
closure();
|
||||
assertEquals(1, break_point_hit_count);
|
||||
|
||||
// Remove script break point.
|
||||
assertEquals(1, Debug.scriptBreakPoints().length);
|
||||
Debug.clearBreakPoint(sbp);
|
||||
assertEquals(0, Debug.scriptBreakPoints().length);
|
@ -1,82 +0,0 @@
|
||||
// Copyright 2012 the V8 project authors. All rights reserved.
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following
|
||||
// disclaimer in the documentation and/or other materials provided
|
||||
// with the distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// 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
|
||||
|
||||
// Simple debug event handler which just counts the number of break points hit.
|
||||
var break_point_hit_count = 0;
|
||||
|
||||
function listener(event, exec_state, event_data, data) {
|
||||
if (event == Debug.DebugEvent.Break) {
|
||||
break_point_hit_count++;
|
||||
}
|
||||
};
|
||||
|
||||
// Add the debug event listener.
|
||||
Debug.setListener(listener);
|
||||
|
||||
eval(
|
||||
"var inner;\n" +
|
||||
"function outer() {\n" + // Non-trivial outer closure.
|
||||
" var x = 5;\n" +
|
||||
" function a() {\n" +
|
||||
" var foo = 0, y = 7;\n" +
|
||||
" function b() {\n" +
|
||||
" var bar = 0, baz = 0, z = 11;\n" +
|
||||
" function c() {\n" +
|
||||
" return x + y + z;\n" + // Breakpoint line ( #8 )
|
||||
" }\n" +
|
||||
" inner = c;\n" +
|
||||
" return c();\n" +
|
||||
" }\n" +
|
||||
" return b();\n" +
|
||||
" }\n" +
|
||||
" return a();\n" +
|
||||
"}"
|
||||
);
|
||||
|
||||
var script = Debug.findScript(outer);
|
||||
|
||||
// The debugger triggers compilation of inner closures.
|
||||
assertEquals(0, Debug.scriptBreakPoints().length);
|
||||
var sbp = Debug.setScriptBreakPointById(script.id, 8);
|
||||
assertEquals(1, Debug.scriptBreakPoints().length);
|
||||
|
||||
// The compiled outer closure should behave correctly.
|
||||
assertEquals(23, outer());
|
||||
assertEquals(1, break_point_hit_count);
|
||||
|
||||
// The compiled inner closure should behave correctly.
|
||||
assertEquals(23, inner());
|
||||
assertEquals(2, break_point_hit_count);
|
||||
|
||||
// Remove script break point.
|
||||
assertEquals(1, Debug.scriptBreakPoints().length);
|
||||
Debug.clearBreakPoint(sbp);
|
||||
assertEquals(0, Debug.scriptBreakPoints().length);
|
@ -1,125 +0,0 @@
|
||||
// Copyright 2008 the V8 project authors. All rights reserved.
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following
|
||||
// disclaimer in the documentation and/or other materials provided
|
||||
// with the distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// 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.setListener(function(){});
|
||||
|
||||
var script_id;
|
||||
var script_name;
|
||||
|
||||
// Get current script id and name.
|
||||
var scripts = Debug.scripts();
|
||||
for (var i = 0; i < scripts.length; i++) {
|
||||
var name = scripts[i].name;
|
||||
var id = scripts[i].id;
|
||||
if (name !== undefined && name.includes("debug-script-breakpoints.js")) {
|
||||
script_id = id;
|
||||
script_name = name;
|
||||
break;
|
||||
}
|
||||
}
|
||||
assertTrue(script_id !== undefined);
|
||||
assertTrue(script_name !== undefined);
|
||||
print("#" + script_id + ": " + script_name);
|
||||
|
||||
|
||||
// Checks script name, line and column.
|
||||
var checkBreakPoint = function(id, line, column) {
|
||||
var breakpoint = Debug.scriptBreakPoints()[id];
|
||||
assertEquals(script_name, breakpoint.script_name());
|
||||
assertEquals(line, breakpoint.line());
|
||||
assertEquals(column, breakpoint.column());
|
||||
}
|
||||
|
||||
|
||||
// Set and remove a script break point for a named script.
|
||||
var sbp = Debug.setScriptBreakPointByName(script_name, 35, 5);
|
||||
assertEquals(1, Debug.scriptBreakPoints().length);
|
||||
checkBreakPoint(0, 35, 5);
|
||||
Debug.clearBreakPoint(sbp);
|
||||
assertEquals(0, Debug.scriptBreakPoints().length);
|
||||
|
||||
// Set three script break points for named scripts.
|
||||
var sbp1 = Debug.setScriptBreakPointByName(script_name, 36, 3);
|
||||
var sbp2 = Debug.setScriptBreakPointByName(script_name, 37, 4);
|
||||
var sbp3 = Debug.setScriptBreakPointByName(script_name, 38, 5);
|
||||
|
||||
// Check the content of the script break points.
|
||||
assertEquals(3, Debug.scriptBreakPoints().length);
|
||||
checkBreakPoint(0, 36, 3);
|
||||
checkBreakPoint(1, 37, 4);
|
||||
checkBreakPoint(2, 38, 5);
|
||||
|
||||
// Remove script break points (in another order than they where added).
|
||||
assertEquals(3, Debug.scriptBreakPoints().length);
|
||||
Debug.clearBreakPoint(sbp1);
|
||||
assertEquals(2, Debug.scriptBreakPoints().length);
|
||||
Debug.clearBreakPoint(sbp3);
|
||||
assertEquals(1, Debug.scriptBreakPoints().length);
|
||||
Debug.clearBreakPoint(sbp2);
|
||||
assertEquals(0, Debug.scriptBreakPoints().length);
|
||||
|
||||
|
||||
// Checks script id, line and column.
|
||||
var checkBreakPoint = function(id, line, column) {
|
||||
var breakpoint = Debug.scriptBreakPoints()[id];
|
||||
assertEquals(script_id, breakpoint.script_id());
|
||||
assertEquals(line, breakpoint.line());
|
||||
assertEquals(column, breakpoint.column());
|
||||
}
|
||||
|
||||
|
||||
// Set and remove a script break point for a script id.
|
||||
var sbp = Debug.setScriptBreakPointById(script_id, 40, 6);
|
||||
assertEquals(1, Debug.scriptBreakPoints().length);
|
||||
checkBreakPoint(0, 40, 6);
|
||||
Debug.clearBreakPoint(sbp);
|
||||
assertEquals(0, Debug.scriptBreakPoints().length);
|
||||
|
||||
// Set three script break points for script ids.
|
||||
var sbp1 = Debug.setScriptBreakPointById(script_id, 42, 3);
|
||||
var sbp2 = Debug.setScriptBreakPointById(script_id, 43, 4);
|
||||
var sbp3 = Debug.setScriptBreakPointById(script_id, 44, 5);
|
||||
|
||||
// Check the content of the script break points.
|
||||
assertEquals(3, Debug.scriptBreakPoints().length);
|
||||
checkBreakPoint(0, 42, 3);
|
||||
checkBreakPoint(1, 43, 4);
|
||||
checkBreakPoint(2, 44, 5);
|
||||
|
||||
// Remove script break points (in another order than they where added).
|
||||
assertEquals(3, Debug.scriptBreakPoints().length);
|
||||
Debug.clearBreakPoint(sbp1);
|
||||
assertEquals(2, Debug.scriptBreakPoints().length);
|
||||
Debug.clearBreakPoint(sbp3);
|
||||
assertEquals(1, Debug.scriptBreakPoints().length);
|
||||
Debug.clearBreakPoint(sbp2);
|
||||
assertEquals(0, Debug.scriptBreakPoints().length);
|
||||
|
||||
Debug.setListener(null);
|
@ -1,64 +0,0 @@
|
||||
// Copyright 2012 the V8 project authors. All rights reserved.
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following
|
||||
// disclaimer in the documentation and/or other materials provided
|
||||
// with the distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// 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
|
||||
|
||||
var script_number = 0;
|
||||
var script_names = [];
|
||||
var exception = null;
|
||||
|
||||
function listener(event, exec_state, event_data, data) {
|
||||
if (event == Debug.DebugEvent.BeforeCompile) {
|
||||
event_data.script().setSource(event_data.script().source() +
|
||||
" //# sourceURL=proper_location_" + (++script_number));
|
||||
} else if (event == Debug.DebugEvent.AfterCompile) {
|
||||
try {
|
||||
event_data.script().setSource("a=1 //# sourceURL=wrong_location");
|
||||
} catch(e) {
|
||||
exception = e;
|
||||
}
|
||||
script_names.push(event_data.script().name());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Add the debug event listener.
|
||||
Debug.setListener(listener);
|
||||
|
||||
// Compile different sources.
|
||||
eval('a=1');
|
||||
eval('(function(){})');
|
||||
|
||||
assertEquals(2, script_names.length);
|
||||
assertEquals("proper_location_1", script_names[0]);
|
||||
assertEquals("proper_location_2", script_names[1]);
|
||||
|
||||
assertEquals("illegal access", exception);
|
||||
|
||||
Debug.setListener(null);
|
@ -53,16 +53,6 @@
|
||||
# Issue 3784: setters-on-elements is flaky
|
||||
'setters-on-elements': [PASS, FAIL],
|
||||
|
||||
# Issue 3641: The new 'then' semantics suppress some exceptions.
|
||||
# These tests may be changed or removed when 'chain' is deprecated.
|
||||
'es6/debug-promises/reject-with-throw-in-reject': [FAIL],
|
||||
'es6/debug-promises/reject-with-undefined-reject': [FAIL],
|
||||
'es6/debug-promises/reject-with-invalid-reject': [FAIL],
|
||||
|
||||
# Issue 5587: The eval'ed code is piped through Ignition and fails when being
|
||||
# live edited. This needs investigation.
|
||||
'debug-liveedit-double-call': [SKIP],
|
||||
|
||||
##############################################################################
|
||||
# Too slow in debug mode with --stress-opt mode.
|
||||
'regress/regress-2318': [PASS, ['mode == debug', SKIP]],
|
||||
@ -513,9 +503,6 @@
|
||||
'math-floor-of-div-nosudiv': [PASS, ['mode == debug', SKIP]],
|
||||
'unicodelctest': [PASS, ['mode == debug', SKIP]],
|
||||
|
||||
# BUG(v8:3435)
|
||||
'debug-script-breakpoints': [PASS, FAIL],
|
||||
|
||||
# BUG(v8:4495).
|
||||
'es6/collections': [PASS, ['arch == ia32', FAST_VARIANTS]],
|
||||
}], # 'system == windows'
|
||||
@ -526,13 +513,6 @@
|
||||
'big-object-literal': [SKIP],
|
||||
}], # 'system == macos'
|
||||
|
||||
##############################################################################
|
||||
['arch == s390 or arch == s390x', {
|
||||
|
||||
# Stack manipulations in LiveEdit is not implemented for this arch.
|
||||
'debug-liveedit-double-call': [SKIP],
|
||||
}], # 'arch == s390 or arch == s390x'
|
||||
|
||||
##############################################################################
|
||||
['deopt_fuzzer == True', {
|
||||
|
||||
@ -613,9 +593,7 @@
|
||||
'es6/array-iterator-turbo': [SKIP],
|
||||
|
||||
# TODO(jarin/mstarzinger): Investigate debugger issues with TurboFan.
|
||||
'debug-evaluate-locals': [FAIL],
|
||||
'debug-set-variable-value': [FAIL],
|
||||
'debug-liveedit-double-call': [FAIL],
|
||||
|
||||
# TODO(jgruber): Fails in --turbo --always-opt mode.
|
||||
'regress/regress-105': [FAIL],
|
||||
@ -627,17 +605,8 @@
|
||||
|
||||
}], # variant == turbofan_opt
|
||||
|
||||
##############################################################################
|
||||
['variant == ignition or variant == ignition_staging', {
|
||||
# TODO(5587): fails to liveedit evaled code.
|
||||
'debug-liveedit-double-call': [FAIL],
|
||||
}], # variant == ignition
|
||||
|
||||
##############################################################################
|
||||
['variant == ignition_turbofan', {
|
||||
# TODO(5587): fails to liveedit evaled code.
|
||||
'debug-liveedit-double-call': [FAIL],
|
||||
|
||||
# TODO(rmcilroy,titzer): Times out after
|
||||
# https://codereview.chromium.org/1951013002 .
|
||||
'regress/regress-599717': [PASS, ['tsan', SKIP]],
|
||||
|
@ -1,48 +0,0 @@
|
||||
// Copyright 2013 the V8 project authors. All rights reserved.
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following
|
||||
// disclaimer in the documentation and/or other materials provided
|
||||
// with the distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// Flags: --expose-debug-as debug
|
||||
|
||||
Debug = debug.Debug;
|
||||
var listened = false;
|
||||
var recursion_depth = 0;
|
||||
|
||||
function listener(event, exec_state, event_data, data) {
|
||||
if (event == Debug.DebugEvent.Break) {
|
||||
recursion_depth++;
|
||||
var disable_break = (recursion_depth > 2);
|
||||
for (var i = 0; i < exec_state.frameCount(); i++) {
|
||||
exec_state.frame(i).evaluate("debugger", disable_break);
|
||||
}
|
||||
}
|
||||
listened = true;
|
||||
}
|
||||
|
||||
Debug.setListener(listener);
|
||||
eval("debugger");
|
||||
Debug.setListener(null);
|
||||
assertTrue(listened);
|
Loading…
Reference in New Issue
Block a user