v8/test/inspector/debugger/async-stack-load-more.js
Alexey Kozyatinskiy 48c1cb9746 [inspector] introduce way to get full stored async stack
If async stack is longer then max depth, we add externalParent as id,
client can fetch next max depth async stacks by Debugger.getStackTrace.

R=dgozman@chromium.org

Bug: chromium:778796
Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I89d461e672251f03fb239f4f16ae3b0374fce766
Reviewed-on: https://chromium-review.googlesource.com/776242
Commit-Queue: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49595}
2017-11-23 00:22:40 +00:00

45 lines
1.5 KiB
JavaScript

// Copyright 2017 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.
let {session, contextGroup, Protocol} = InspectorTest.start('Tests super long async stacks.');
contextGroup.addScript(`
function callWithAsyncStack(f, depth) {
if (depth === 0) {
f();
return;
}
wrapper = eval('(function call' + depth + '() { callWithAsyncStack(f, depth - 1) }) //# sourceURL=wrapper.js');
Promise.resolve().then(wrapper);
}
//# sourceURL=utils.js`);
(async function test() {
Protocol.Debugger.enable();
Protocol.Debugger.setAsyncCallStackDepth({maxDepth: 4});
Protocol.Runtime.evaluate({
expression: 'callWithAsyncStack(() => {debugger}, 12)//# sourceURL=expr.js'
});
let {params} = await Protocol.Debugger.oncePaused();
let {callFrames, asyncStackTrace, externalAsyncStackTrace} = params;
while (true) {
session.logCallFrames(callFrames);
if (externalAsyncStackTrace) {
InspectorTest.log('(fetch parent..)');
asyncStackTrace = (await Protocol.Debugger.getStackTrace({
stackTraceId: externalAsyncStackTrace
})).result.stackTrace;
}
if (asyncStackTrace) {
InspectorTest.log('--' + asyncStackTrace.description + '--');
callFrames = asyncStackTrace.callFrames;
externalAsyncStackTrace = asyncStackTrace.parentId;
asyncStackTrace = asyncStackTrace.parent;
} else {
break;
}
}
InspectorTest.completeTest();
})()