1834ab7246
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}
55 lines
1.3 KiB
JavaScript
55 lines
1.3 KiB
JavaScript
// Copyright 2015 the V8 project authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
// Flags: --noturbo-osr --noturbo-inlining
|
|
|
|
var stdlib = this;
|
|
var buffer = new ArrayBuffer(64 * 1024);
|
|
var foreign = { thrower: thrower, debugme: debugme }
|
|
|
|
Debug = debug.Debug;
|
|
|
|
var listenerCalled = false;
|
|
function listener(event, exec_state, event_data, data) {
|
|
try {
|
|
if (event == Debug.DebugEvent.Break) {
|
|
var frame = exec_state.frame(1);
|
|
assertEquals("foo", frame.func().name());
|
|
listenerCalled = true;
|
|
}
|
|
} catch (e) {
|
|
print("Caught: " + e + " " + e.stack);
|
|
};
|
|
}
|
|
|
|
function thrower() { throw "boom"; }
|
|
function debugme() { Debug.setListener(listener); debugger; }
|
|
|
|
function Module(stdlib, foreign, heap) {
|
|
"use asm";
|
|
var thrower = foreign.thrower;
|
|
var debugme = foreign.debugme;
|
|
function foo(i) {
|
|
i = i|0;
|
|
var a = 101; // Local variables exist ...
|
|
var b = 102; // ... to make the debugger ...
|
|
var c = 103; // ... inspect them during break.
|
|
if (i > 0) {
|
|
debugme();
|
|
i = 23;
|
|
} else {
|
|
thrower();
|
|
i = 42;
|
|
}
|
|
return i|0;
|
|
}
|
|
return { foo: foo };
|
|
}
|
|
|
|
var m = Module(stdlib, foreign, buffer);
|
|
|
|
assertThrows("m.foo(0)");
|
|
assertEquals(23, m.foo(1));
|
|
assertTrue(listenerCalled);
|