v8/test/debugger/debug/es8/async-debug-step-next-constant.js
Alexey Kozyatinskiy 6f69e3ceca [inspector] removed break location right before suspension in async function
In current implementation in expressions like await foo() we have break location right after foo call and before actual await.
And we additionally have a lot of other statement locations because of do scope.

Let's move async debugging closer to sync debugging and introduce only one break location for await - before awaited function call.

Bug: v8:6425,v8:6162
Change-Id: I7568767856022c49101e7f3b7e39a2e401d21644
Reviewed-on: https://chromium-review.googlesource.com/514046
Reviewed-by: Marja Hölttä <marja@chromium.org>
Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
Commit-Queue: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#45625}
2017-05-31 12:15:09 +00:00

38 lines
949 B
JavaScript

// 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.
var Debug = debug.Debug;
var step_count = 0;
function listener(event, execState, eventData, data) {
if (event != Debug.DebugEvent.Break) return;
try {
var line = execState.frame(0).sourceLineText();
print(line);
var [match, expected_count, step] = /\/\/ B(\d) (\w+)$/.exec(line);
assertEquals(step_count++, parseInt(expected_count));
if (step != "Continue") execState.prepareStep(Debug.StepAction[step]);
} catch (e) {
print(e, e.stack);
quit(1);
}
}
Debug.setListener(listener);
async function f() {
var a = 1;
debugger; // B0 StepNext
a += // B1 StepNext
await
5;
return a; // B2 StepNext
} // B3 Continue
f();
%RunMicrotasks();
assertEquals(4, step_count);