v8/test/mjsunit/debug-step-end-of-script.js
yangguo fd781bcc84 [debugger] correctly find source position of implicit return statement.
The parser reads one character beyond EOF to have an additional source
position that the rewriter can use to insert the implicit return
statement at the end of a script. If we break at that return statement,
we need to be able to translate the source position to line and
column number.

R=jkummerow@chromium.org
BUG=chromium:569514
LOG=N

Committed: https://crrev.com/0b1076a68e1eadba260cec8afc5acec618561c28
Cr-Commit-Position: refs/heads/master@{#32825}

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

Cr-Commit-Position: refs/heads/master@{#32835}
2015-12-14 13:25:06 +00:00

22 lines
639 B
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: --expose-debug-as debug --allow-natives-syntax
var Debug = debug.Debug;
var expected = ["debugger;", "", "debugger;"];
function listener(event, exec_state, event_data, data) {
if (event != Debug.DebugEvent.Break) return;
try {
assertEquals(expected.shift(), exec_state.frame(0).sourceLineText());
exec_state.prepareStep(Debug.StepAction.StepNext, 1);
} catch (e) {
%AbortJS(e + "\n" + e.stack);
}
}
Debug.setListener(listener);
debugger;