[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:
jgruber 2016-11-21 01:28:49 -08:00 committed by Commit bot
parent bd25a33129
commit 1834ab7246
31 changed files with 157 additions and 686 deletions

View File

@ -1815,6 +1815,22 @@ RUNTIME_FUNCTION(Runtime_ScriptPositionInfo) {
return *GetJSPositionInfo(script_handle, position, offset_flag, isolate); 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. // 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. // The parameter line is expected to include the script's line offset.
// TODO(5530): Remove once uses in debug.js are gone. // TODO(5530): Remove once uses in debug.js are gone.

View File

@ -190,6 +190,7 @@ namespace internal {
F(ScriptLocationFromLine, 4, 1) \ F(ScriptLocationFromLine, 4, 1) \
F(ScriptLocationFromLine2, 4, 1) \ F(ScriptLocationFromLine2, 4, 1) \
F(ScriptPositionInfo, 3, 1) \ F(ScriptPositionInfo, 3, 1) \
F(ScriptPositionInfo2, 3, 1) \
F(ScriptSourceLine, 2, 1) \ F(ScriptSourceLine, 2, 1) \
F(DebugPrepareStepInIfStepping, 1, 1) \ F(DebugPrepareStepInIfStepping, 1, 1) \
F(DebugPrepareStepInSuspendedGenerator, 0, 1) \ F(DebugPrepareStepInSuspendedGenerator, 0, 1) \

View File

@ -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
var Debug = debug.Debug; var Debug = debug.Debug;
@ -80,15 +79,12 @@ if (changed) {
assertEquals(0.5, r3); assertEquals(0.5, r3);
} }
var counter = 0;
var o = { toString : function() { counter++; return 100; } };
function listenerSetJToObject( function listenerSetJToObject(
event, exec_state, event_data, data) { event, exec_state, event_data, data) {
if (event == Debug.DebugEvent.Break) { if (event == Debug.DebugEvent.Break) {
var scope = exec_state.frame(1).scope(0); var scope = exec_state.frame(1).scope(0);
try { try {
scope.setVariableValue("j", o); scope.setVariableValue("j", 100);
changed = true; changed = true;
} catch(e) { } catch(e) {
changed = false; changed = false;
@ -113,7 +109,6 @@ function ChangeIntVarAndOsr() {
var r4 = ChangeIntVarAndOsr(); var r4 = ChangeIntVarAndOsr();
if (changed) { if (changed) {
assertEquals(101, r4); assertEquals(101, r4);
assertEquals(1, counter);
} else { } else {
assertEquals(5, r4); assertEquals(5, r4);
} }

View File

@ -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
listenerComplete = false; listenerComplete = false;
@ -65,14 +63,16 @@ function g() {
} }
function checkFrame1(frame) { 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(); var count = frame.localCount();
assertEquals(2, count); assertEquals(3, count);
for (var i = 0; i < count; ++i) { for (var i = 0; i < count; ++i) {
var name = frame.localName(i); var name = frame.localName(i);
var value = frame.localValue(i).value(); var value = frame.localValue(i).value();
if (name == 'a') { if (name == 'a') {
assertEquals(3, value); assertEquals(3, value);
} else if (name == 'b') {
assertEquals(4, value);
} else { } else {
assertEquals('arguments', name); 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(3, exec_state.frame(1).evaluate('a').value());
assertEquals(4, exec_state.frame(1).evaluate('b').value()); assertEquals(4, exec_state.frame(1).evaluate('b').value());
assertEquals("function", 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(5, exec_state.frame(2).evaluate('a').value());
assertEquals(6, exec_state.frame(2).evaluate('b').value()); assertEquals(6, exec_state.frame(2).evaluate('b').value());
assertEquals("function", assertEquals("function",
typeof exec_state.frame(2).evaluate('eval').value()); exec_state.frame(2).evaluate('typeof eval').value());
assertEquals("foo", assertEquals("foo",
exec_state.frame(0).evaluate('a = "foo"').value()); exec_state.frame(0).evaluate('a = "foo"').value());
assertEquals("bar", assertEquals("bar",

View File

@ -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

View File

@ -51,6 +51,7 @@ var named_native_count = 0;
var named_native_names = {}; var named_native_names = {};
var extension_count = 0; var extension_count = 0;
var normal_count = 0; var normal_count = 0;
var inspector_count = 0;
var scripts = Debug.scripts(); var scripts = Debug.scripts();
for (i = 0; i < scripts.length; i++) { for (i = 0; i < scripts.length; i++) {
if (scripts[i].type == Debug.ScriptType.Native) { if (scripts[i].type == Debug.ScriptType.Native) {
@ -66,6 +67,8 @@ for (i = 0; i < scripts.length; i++) {
extension_count++; extension_count++;
} else if (scripts[i].type == Debug.ScriptType.Normal) { } else if (scripts[i].type == Debug.ScriptType.Normal) {
normal_count++; normal_count++;
} else if (scripts[i].type == Debug.ScriptType.Inspector) {
inspector_count++;
} else { } else {
assertUnreachable('Unexpected type ' + scripts[i].type); assertUnreachable('Unexpected type ' + scripts[i].type);
} }
@ -75,9 +78,10 @@ for (i = 0; i < scripts.length; i++) {
assertEquals(%NativeScriptsCount(), named_native_count); assertEquals(%NativeScriptsCount(), named_native_count);
// The 'gc' extension and one or two extras scripts are loaded. // The 'gc' extension and one or two extras scripts are loaded.
assertTrue(extension_count == 2 || extension_count == 3); assertTrue(extension_count == 2 || extension_count == 3);
// This script and mjsunit.js has been loaded. If using d8, d8 loads // This script, test-api.js and mjsunit.js has been loaded. If using d8, d8
// a normal script during startup too. // loads a normal script during startup too.
assertTrue(normal_count == 2 || normal_count == 3); assertTrue(normal_count == 3 || normal_count == 4);
assertTrue(inspector_count == 1);
// Test a builtins script. // Test a builtins script.
var array_script = Debug.findScript('native array.js'); var array_script = Debug.findScript('native array.js');

View File

@ -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 a Promise is rejected, which is caught by a custom // 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 // promise, which has a number for reject closure. We expect an Exception debug

View File

@ -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 a Promise is rejected, which is caught by a // Test debug events when a Promise is rejected, which is caught by a
// custom promise, which throws a new exception in its reject handler. // custom promise, which throws a new exception in its reject handler.

View File

@ -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 a Promise is rejected, which is caught by a custom // 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 // promise, which has undefined for reject closure. We expect an Exception

View File

@ -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
// Test that the parameter initialization block scope set up for // Test that the parameter initialization block scope set up for
// sloppy eval is visible to the debugger. // sloppy eval is visible to the debugger.

View File

@ -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
var exception = null; var exception = null;

View File

@ -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
var o = { var o = {
f: function(x) { f: function(x) {
@ -20,11 +19,8 @@ Debug.setListener(function() {});
var script = Debug.findScript(sentinel); var script = Debug.findScript(sentinel);
// Used in Debug.setScriptBreakPointById. // 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 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) { function assertLocation(p, l, c) {
var location = script.locationFromPosition(p, false); var location = script.locationFromPosition(p, false);
@ -32,6 +28,5 @@ function assertLocation(p, l, c) {
assertEquals(c, location.column); assertEquals(c, location.column);
} }
assertLocation(p, 9, 0); assertLocation(p, 8, 0);
assertLocation(q, 9, 4); assertLocation(q, 8, 4);
assertLocation(r, 9, 4);

View File

@ -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
(function outer() { (function outer() {
var C = (function C_() { var C = (function C_() {

View File

@ -2,13 +2,12 @@
// 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: --noturbo-osr --noturbo-inlining --expose-debug-as debug // Flags: --noturbo-osr --noturbo-inlining
var stdlib = this; var stdlib = this;
var buffer = new ArrayBuffer(64 * 1024); var buffer = new ArrayBuffer(64 * 1024);
var foreign = { thrower: thrower, debugme: debugme } var foreign = { thrower: thrower, debugme: debugme }
// Get the Debug object exposed from the debug context global object.
Debug = debug.Debug; Debug = debug.Debug;
var listenerCalled = false; var listenerCalled = false;
@ -16,7 +15,7 @@ function listener(event, exec_state, event_data, data) {
try { try {
if (event == Debug.DebugEvent.Break) { if (event == Debug.DebugEvent.Break) {
var frame = exec_state.frame(1); var frame = exec_state.frame(1);
assertEquals(m.foo, frame.func().value()); assertEquals("foo", frame.func().name());
listenerCalled = true; listenerCalled = true;
} }
} catch (e) { } catch (e) {

View File

@ -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
var Debug = debug.Debug; var Debug = debug.Debug;
var receiver = null; var receiver = null;

View File

@ -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
var Debug = debug.Debug; var Debug = debug.Debug;
var receiver = null; var receiver = null;

View File

@ -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: --expose-debug-as debug // Flags: --min-preparse-length=10
var source = var source =
"var foo = function foo() {\n" + "var foo = function foo() {\n" +

View File

@ -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
var Debug = debug.Debug; var Debug = debug.Debug;
var expected = ["debugger;", var expected = ["debugger;",

View File

@ -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
var Debug = debug.Debug; var Debug = debug.Debug;
var steps = 0; var steps = 0;
@ -15,12 +14,12 @@ function listener(event, execState, eventData, data) {
debug.ScopeType.Script, debug.ScopeType.Script,
debug.ScopeType.Global], debug.ScopeType.Global],
execState.frame().allScopes().map(s => s.scopeType())); 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) { if (steps < 2) {
assertEquals(undefined, x_value); assertEquals("undefined", x_value);
execState.prepareStep(Debug.StepAction.StepIn); execState.prepareStep(Debug.StepAction.StepIn);
} else { } else {
assertEquals("l => l", x_value.toString()); assertEquals("l => l", x_value);
} }
steps++; steps++;
} catch (e) { } catch (e) {

View File

@ -7,6 +7,24 @@
# Issue 3660: Replacing activated TurboFan frames by unoptimized code does # Issue 3660: Replacing activated TurboFan frames by unoptimized code does
# not work, but we expect it to not crash. # not work, but we expect it to not crash.
'debug/debug-step-turbofan': [PASS, FAIL], '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 }], # ALWAYS
############################################################################## ##############################################################################
@ -30,9 +48,23 @@
# TODO(jarin/mstarzinger): Investigate debugger issues with TurboFan. # TODO(jarin/mstarzinger): Investigate debugger issues with TurboFan.
'debug/debug-evaluate-closure': [FAIL], 'debug/debug-evaluate-closure': [FAIL],
'debug/debug-evaluate-locals': [FAIL],
'debug/es6/debug-evaluate-blockscopes': [FAIL], 'debug/es6/debug-evaluate-blockscopes': [FAIL],
'debug/debug-liveedit-double-call': [FAIL],
}], # variant == turbofan_opt }], # 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', { ['gc_stress == True', {
# Async function tests taking too long # Async function tests taking too long
@ -57,6 +89,7 @@
# Stack manipulations in LiveEdit is not implemented for this arch. # Stack manipulations in LiveEdit is not implemented for this arch.
'debug/debug-liveedit-check-stack': [SKIP], 'debug/debug-liveedit-check-stack': [SKIP],
'debug/debug-liveedit-double-call': [SKIP],
'debug/debug-liveedit-stack-padding': [SKIP], 'debug/debug-liveedit-stack-padding': [SKIP],
'debug/debug-liveedit-restart-frame': [SKIP], 'debug/debug-liveedit-restart-frame': [SKIP],
}], # 'arch == s390 or arch == s390x' }], # 'arch == s390 or arch == s390x'

View File

@ -49,7 +49,9 @@ class DebugWrapper {
this.ScriptType = { Native: 0, this.ScriptType = { Native: 0,
Extension: 1, Extension: 1,
Normal: 2, Normal: 2,
Wasm: 3}; Wasm: 3,
Inspector: 4,
};
// A copy of the scope types from runtime-debug.cc. // A copy of the scope types from runtime-debug.cc.
// NOTE: these constants should be backward-compatible, so // NOTE: these constants should be backward-compatible, so
@ -160,8 +162,14 @@ class DebugWrapper {
return this.setBreakPointAtLocation(scriptid, loc, opt_condition); return this.setBreakPointAtLocation(scriptid, loc, opt_condition);
} }
clearBreakPoint(breakid) { setBreakPointByScriptIdAndPosition(scriptid, position) {
assertTrue(this.breakpoints.has(breakid)); 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( const {msgid, msg} = this.createMessage(
"Debugger.removeBreakpoint", { breakpointId : breakid }); "Debugger.removeBreakpoint", { breakpointId : breakid });
this.sendMessage(msg); this.sendMessage(msg);
@ -170,8 +178,8 @@ class DebugWrapper {
} }
clearAllBreakPoints() { clearAllBreakPoints() {
for (let breakid of this.breakpoints) { for (let breakpoint of this.breakpoints) {
this.clearBreakPoint(breakid); this.clearBreakPoint(breakpoint);
} }
this.breakpoints.clear(); this.breakpoints.clear();
} }
@ -347,13 +355,21 @@ class DebugWrapper {
this.sendMessage(msg); this.sendMessage(msg);
const reply = this.takeReplyChecked(msgid); const reply = this.takeReplyChecked(msgid);
assertTrue(reply.result !== undefined); const result = reply.result;
const breakid = reply.result.breakpointId; assertTrue(result !== undefined);
const breakid = result.breakpointId;
assertTrue(breakid !== undefined); 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) { execStatePrepareStep(action) {
@ -418,7 +434,10 @@ class DebugWrapper {
newValue : { value : value } newValue : { value : value }
}); });
this.sendMessage(msg); 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) { execStateScope(frame, scope_index) {
@ -455,7 +474,7 @@ class DebugWrapper {
getProperties(objectId) { getProperties(objectId) {
const {msgid, msg} = this.createMessage( const {msgid, msg} = this.createMessage(
"Runtime.getProperties", { objectId : objectId }); "Runtime.getProperties", { objectId : objectId, ownProperties: true });
this.sendMessage(msg); this.sendMessage(msg);
const reply = this.takeReplyChecked(msgid); const reply = this.takeReplyChecked(msgid);
return reply.result.result; return reply.result.result;
@ -501,31 +520,62 @@ class DebugWrapper {
reconstructRemoteObject(obj) { reconstructRemoteObject(obj) {
let value = obj.value; let value = obj.value;
if (obj.type == "object") { let isUndefined = false;
if (obj.subtype == "error") {
const desc = obj.description; switch (obj.type) {
switch (obj.className) { case "object": {
case "EvalError": throw new EvalError(desc); switch (obj.subtype) {
case "RangeError": throw new RangeError(desc); case "error": {
case "ReferenceError": throw new ReferenceError(desc); const desc = obj.description;
case "SyntaxError": throw new SyntaxError(desc); switch (obj.className) {
case "TypeError": throw new TypeError(desc); case "EvalError": throw new EvalError(desc);
case "URIError": throw new URIError(desc); case "RangeError": throw new RangeError(desc);
default: throw new Error(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") { break;
const array = []; }
const props = this.propertiesToObject( case "undefined": {
this.getProperties(obj.objectId)); value = undefined;
for (let i = 0; i < props.length; i++) { isUndefined = true;
array[i] = props[i]; break;
} }
value = array; case "string":
case "number":
case "boolean": {
break;
}
default: {
break;
} }
} }
return { value : () => value, return { value : () => value,
isUndefined : () => obj.type == "undefined" isUndefined : () => isUndefined
}; };
} }
@ -575,6 +625,7 @@ class DebugWrapper {
localCount : () => this.execStateFrameLocalCount(frame), localCount : () => this.execStateFrameLocalCount(frame),
localName : (ix) => this.execStateFrameLocalName(frame, ix), localName : (ix) => this.execStateFrameLocalName(frame, ix),
localValue: (ix) => this.execStateFrameLocalValue(frame, ix), localValue: (ix) => this.execStateFrameLocalValue(frame, ix),
receiver : () => this.evaluateOnCallFrame(frame, "this"),
restart : () => this.execStateFrameRestart(frame), restart : () => this.execStateFrameRestart(frame),
scopeCount : () => frame.scopeChain.length, scopeCount : () => frame.scopeChain.length,
scope : (index) => this.execStateScope(frame, index), scope : (index) => this.execStateScope(frame, index),
@ -599,7 +650,7 @@ class DebugWrapper {
eventDataScriptSource(id) { eventDataScriptSource(id) {
const {msgid, msg} = this.createMessage( const {msgid, msg} = this.createMessage(
"Debugger.getScriptSource", { scriptId : id }); "Debugger.getScriptSource", { scriptId : String(id) });
this.sendMessage(msg); this.sendMessage(msg);
const reply = this.takeReplyChecked(msgid); const reply = this.takeReplyChecked(msgid);
return reply.result.scriptSource; return reply.result.scriptSource;
@ -613,7 +664,7 @@ class DebugWrapper {
} }
eventDataScript(params) { eventDataScript(params) {
const id = params.scriptId; const id = parseInt(params.scriptId);
const name = params.url ? params.url : undefined; const name = params.url ? params.url : undefined;
return { id : () => id, return { id : () => id,

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -84,7 +84,6 @@ function TestStrict(receiver) {
listener_delegate = function(exec_state) { listener_delegate = function(exec_state) {
var receiver = exec_state.frame().receiver(); var receiver = exec_state.frame().receiver();
assertTrue(!receiver.isObject());
assertEquals(expected_receiver, receiver.value()) assertEquals(expected_receiver, receiver.value())
} }
@ -108,7 +107,6 @@ function TestNonStrict(receiver) {
listener_delegate = function(exec_state) { listener_delegate = function(exec_state) {
var receiver = exec_state.frame().receiver(); var receiver = exec_state.frame().receiver();
assertTrue(receiver.isObject());
assertEquals(expected_receiver, receiver.value()); assertEquals(expected_receiver, receiver.value());
} }

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -53,16 +53,6 @@
# Issue 3784: setters-on-elements is flaky # Issue 3784: setters-on-elements is flaky
'setters-on-elements': [PASS, FAIL], '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. # Too slow in debug mode with --stress-opt mode.
'regress/regress-2318': [PASS, ['mode == debug', SKIP]], 'regress/regress-2318': [PASS, ['mode == debug', SKIP]],
@ -513,9 +503,6 @@
'math-floor-of-div-nosudiv': [PASS, ['mode == debug', SKIP]], 'math-floor-of-div-nosudiv': [PASS, ['mode == debug', SKIP]],
'unicodelctest': [PASS, ['mode == debug', SKIP]], 'unicodelctest': [PASS, ['mode == debug', SKIP]],
# BUG(v8:3435)
'debug-script-breakpoints': [PASS, FAIL],
# BUG(v8:4495). # BUG(v8:4495).
'es6/collections': [PASS, ['arch == ia32', FAST_VARIANTS]], 'es6/collections': [PASS, ['arch == ia32', FAST_VARIANTS]],
}], # 'system == windows' }], # 'system == windows'
@ -526,13 +513,6 @@
'big-object-literal': [SKIP], 'big-object-literal': [SKIP],
}], # 'system == macos' }], # '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', { ['deopt_fuzzer == True', {
@ -613,9 +593,7 @@
'es6/array-iterator-turbo': [SKIP], 'es6/array-iterator-turbo': [SKIP],
# TODO(jarin/mstarzinger): Investigate debugger issues with TurboFan. # TODO(jarin/mstarzinger): Investigate debugger issues with TurboFan.
'debug-evaluate-locals': [FAIL],
'debug-set-variable-value': [FAIL], 'debug-set-variable-value': [FAIL],
'debug-liveedit-double-call': [FAIL],
# TODO(jgruber): Fails in --turbo --always-opt mode. # TODO(jgruber): Fails in --turbo --always-opt mode.
'regress/regress-105': [FAIL], 'regress/regress-105': [FAIL],
@ -627,17 +605,8 @@
}], # variant == turbofan_opt }], # 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', { ['variant == ignition_turbofan', {
# TODO(5587): fails to liveedit evaled code.
'debug-liveedit-double-call': [FAIL],
# TODO(rmcilroy,titzer): Times out after # TODO(rmcilroy,titzer): Times out after
# https://codereview.chromium.org/1951013002 . # https://codereview.chromium.org/1951013002 .
'regress/regress-599717': [PASS, ['tsan', SKIP]], 'regress/regress-599717': [PASS, ['tsan', SKIP]],

View File

@ -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);