Expose Runtime.setAsyncCallStackDepth API for async stack collection.
Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel Change-Id: I4a29336a585bb690f915c876b3b07eb2601d027b Reviewed-on: https://chromium-review.googlesource.com/1080225 Commit-Queue: Hidy Han <hidyhan@chromium.org> Reviewed-by: Pavel Feldman <pfeldman@chromium.org> Reviewed-by: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org> Cr-Commit-Position: refs/heads/master@{#53466}
This commit is contained in:
parent
60a858deb1
commit
f69527ee49
@ -2858,6 +2858,18 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "setAsyncCallStackDepth",
|
||||
"description": "Enables or disables async call stacks tracking.",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "maxDepth",
|
||||
"description": "Maximum depth of async call stacks. Setting to `0` will effectively disable collecting async\ncall stacks (default).",
|
||||
"type": "integer"
|
||||
}
|
||||
],
|
||||
"redirect": "Debugger"
|
||||
},
|
||||
{
|
||||
"name": "setCustomObjectFormatterEnabled",
|
||||
"experimental": true,
|
||||
@ -3093,4 +3105,4 @@
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -1314,6 +1314,14 @@ domain Runtime
|
||||
# Exception details.
|
||||
optional ExceptionDetails exceptionDetails
|
||||
|
||||
# Enables or disables async call stacks tracking.
|
||||
command setAsyncCallStackDepth
|
||||
redirect Debugger
|
||||
parameters
|
||||
# Maximum depth of async call stacks. Setting to `0` will effectively disable collecting async
|
||||
# call stacks (default).
|
||||
integer maxDepth
|
||||
|
||||
experimental command setCustomObjectFormatterEnabled
|
||||
parameters
|
||||
boolean enabled
|
||||
|
@ -1213,7 +1213,9 @@ Response V8DebuggerAgentImpl::setReturnValue(
|
||||
}
|
||||
|
||||
Response V8DebuggerAgentImpl::setAsyncCallStackDepth(int depth) {
|
||||
if (!enabled()) return Response::Error(kDebuggerNotEnabled);
|
||||
if (!enabled() && !m_session->runtimeAgent()->enabled()) {
|
||||
return Response::Error(kDebuggerNotEnabled);
|
||||
}
|
||||
m_state->setInteger(DebuggerAgentState::asyncCallStackDepth, depth);
|
||||
m_debugger->setAsyncCallStackDepth(this, depth);
|
||||
return Response::OK();
|
||||
|
@ -760,6 +760,9 @@ Response V8RuntimeAgentImpl::disable() {
|
||||
reset();
|
||||
m_inspector->client()->endEnsureAllContextsInGroup(
|
||||
m_session->contextGroupId());
|
||||
if (m_session->debuggerAgent() && !m_session->debuggerAgent()->enabled()) {
|
||||
m_session->debuggerAgent()->setAsyncCallStackDepth(0);
|
||||
}
|
||||
return Response::OK();
|
||||
}
|
||||
|
||||
@ -816,5 +819,4 @@ bool V8RuntimeAgentImpl::reportMessage(V8ConsoleMessage* message,
|
||||
m_frontend.flush();
|
||||
return m_inspector->hasConsoleMessageStorage(m_session->contextGroupId());
|
||||
}
|
||||
|
||||
} // namespace v8_inspector
|
||||
|
31
test/inspector/runtime/enable-async-stack-expected.txt
Normal file
31
test/inspector/runtime/enable-async-stack-expected.txt
Normal file
@ -0,0 +1,31 @@
|
||||
Checks that async stack is captured when Runtime.setAsyncCallStackDepth is called with an argument greater than zero.
|
||||
{
|
||||
callFrames : [
|
||||
[0] : {
|
||||
columnNumber : 8
|
||||
functionName :
|
||||
lineNumber : 0
|
||||
scriptId : <scriptId>
|
||||
url :
|
||||
}
|
||||
]
|
||||
parent : {
|
||||
callFrames : [
|
||||
[0] : {
|
||||
columnNumber : 2
|
||||
functionName : test
|
||||
lineNumber : 2
|
||||
scriptId : <scriptId>
|
||||
url : test.js
|
||||
}
|
||||
[1] : {
|
||||
columnNumber : 0
|
||||
functionName :
|
||||
lineNumber : 0
|
||||
scriptId : <scriptId>
|
||||
url : expr.js
|
||||
}
|
||||
]
|
||||
description : setTimeout
|
||||
}
|
||||
}
|
19
test/inspector/runtime/enable-async-stack.js
Normal file
19
test/inspector/runtime/enable-async-stack.js
Normal file
@ -0,0 +1,19 @@
|
||||
// Copyright 2018 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('Checks that async stack is captured when Runtime.setAsyncCallStackDepth is called with an argument greater than zero.');
|
||||
|
||||
Protocol.Runtime.enable();
|
||||
Protocol.Runtime.onConsoleAPICalled(
|
||||
message => InspectorTest.logMessage(message.params.stackTrace));
|
||||
|
||||
contextGroup.addScript(`
|
||||
async function test() {
|
||||
setTimeout('console.log("async")', 0);
|
||||
}
|
||||
//# sourceURL=test.js`);
|
||||
|
||||
Protocol.Runtime.setAsyncCallStackDepth({maxDepth: 10});
|
||||
Protocol.Runtime.evaluate({ expression: 'test()//# sourceURL=expr.js'})
|
||||
.then(InspectorTest.completeTest);
|
Loading…
Reference in New Issue
Block a user