Commit f61facfd authored by kozyatinskiy's avatar kozyatinskiy Committed by Commit bot

[inspector] use creation stack trace as parent for async call chains

Creation stack trace points to the place where callback was actually chained, scheduled points where parent promise was resolved.
For async tasks without creation stack (e.g. setTimeout) we continue to use scheduled as creation since usually they are the same.

BUG=v8:6189
R=dgozman@chromium.org

Review-Url: https://codereview.chromium.org/2868493002
Cr-Original-Commit-Position: refs/heads/master@{#45198}
Committed: https://chromium.googlesource.com/v8/v8/+/e118462f18a862df81a04486e13dd62997cbfc5a
Review-Url: https://codereview.chromium.org/2868493002
Cr-Commit-Position: refs/heads/master@{#45266}
parent 28f3bf1a
...@@ -683,12 +683,15 @@ void V8Debugger::PromiseEventOccurred(v8::debug::PromiseDebugActionType type, ...@@ -683,12 +683,15 @@ void V8Debugger::PromiseEventOccurred(v8::debug::PromiseDebugActionType type,
} }
std::shared_ptr<AsyncStackTrace> V8Debugger::currentAsyncParent() { std::shared_ptr<AsyncStackTrace> V8Debugger::currentAsyncParent() {
// TODO(kozyatinskiy): implement creation chain as parent without hack.
if (!m_currentAsyncCreation.empty() && m_currentAsyncCreation.back()) {
return m_currentAsyncCreation.back();
}
return m_currentAsyncParent.empty() ? nullptr : m_currentAsyncParent.back(); return m_currentAsyncParent.empty() ? nullptr : m_currentAsyncParent.back();
} }
std::shared_ptr<AsyncStackTrace> V8Debugger::currentAsyncCreation() { std::shared_ptr<AsyncStackTrace> V8Debugger::currentAsyncCreation() {
return m_currentAsyncCreation.empty() ? nullptr return nullptr;
: m_currentAsyncCreation.back();
} }
void V8Debugger::compileDebuggerScript() { void V8Debugger::compileDebuggerScript() {
...@@ -856,7 +859,8 @@ void V8Debugger::asyncTaskCreatedForStack(void* task, void* parentTask) { ...@@ -856,7 +859,8 @@ void V8Debugger::asyncTaskCreatedForStack(void* task, void* parentTask) {
if (parentTask) m_parentTask[task] = parentTask; if (parentTask) m_parentTask[task] = parentTask;
v8::HandleScope scope(m_isolate); v8::HandleScope scope(m_isolate);
std::shared_ptr<AsyncStackTrace> asyncCreation = std::shared_ptr<AsyncStackTrace> asyncCreation =
AsyncStackTrace::capture(this, currentContextGroupId(), String16(), 1); AsyncStackTrace::capture(this, currentContextGroupId(), String16(),
V8StackTraceImpl::maxCallStackSizeToCapture);
// Passing one as maxStackSize forces no async chain for the new stack. // Passing one as maxStackSize forces no async chain for the new stack.
if (asyncCreation && !asyncCreation->isEmpty()) { if (asyncCreation && !asyncCreation->isEmpty()) {
m_asyncTaskCreationStacks[task] = asyncCreation; m_asyncTaskCreationStacks[task] = asyncCreation;
...@@ -932,6 +936,12 @@ void V8Debugger::asyncTaskStartedForStack(void* task) { ...@@ -932,6 +936,12 @@ void V8Debugger::asyncTaskStartedForStack(void* task) {
auto itCreation = m_asyncTaskCreationStacks.find(task); auto itCreation = m_asyncTaskCreationStacks.find(task);
if (itCreation != m_asyncTaskCreationStacks.end()) { if (itCreation != m_asyncTaskCreationStacks.end()) {
m_currentAsyncCreation.push_back(itCreation->second.lock()); m_currentAsyncCreation.push_back(itCreation->second.lock());
// TODO(kozyatinskiy): implement it without hack.
if (m_currentAsyncParent.back()) {
m_currentAsyncCreation.back()->setDescription(
m_currentAsyncParent.back()->description());
m_currentAsyncParent.back().reset();
}
} else { } else {
m_currentAsyncCreation.emplace_back(); m_currentAsyncCreation.emplace_back();
} }
......
...@@ -298,14 +298,9 @@ AsyncStackTrace::AsyncStackTrace( ...@@ -298,14 +298,9 @@ AsyncStackTrace::AsyncStackTrace(
std::unique_ptr<protocol::Runtime::StackTrace> std::unique_ptr<protocol::Runtime::StackTrace>
AsyncStackTrace::buildInspectorObject(AsyncStackTrace* asyncCreation, AsyncStackTrace::buildInspectorObject(AsyncStackTrace* asyncCreation,
int maxAsyncDepth) const { int maxAsyncDepth) const {
std::unique_ptr<protocol::Runtime::StackTrace> stackTrace = return buildInspectorObjectCommon(m_frames, m_description,
buildInspectorObjectCommon(m_frames, m_description, m_asyncParent.lock(), m_asyncParent.lock(),
m_asyncCreation.lock(), maxAsyncDepth); m_asyncCreation.lock(), maxAsyncDepth);
if (asyncCreation && !asyncCreation->isEmpty()) {
stackTrace->setPromiseCreationFrame(
asyncCreation->m_frames[0]->buildInspectorObject());
}
return stackTrace;
} }
int AsyncStackTrace::contextGroupId() const { return m_contextGroupId; } int AsyncStackTrace::contextGroupId() const { return m_contextGroupId; }
......
...@@ -102,6 +102,11 @@ class AsyncStackTrace { ...@@ -102,6 +102,11 @@ class AsyncStackTrace {
std::weak_ptr<AsyncStackTrace> creation() const; std::weak_ptr<AsyncStackTrace> creation() const;
bool isEmpty() const; bool isEmpty() const;
void setDescription(const String16& description) {
// TODO(kozyatinskiy): implement it without hack.
m_description = description;
}
private: private:
AsyncStackTrace(int contextGroupId, const String16& description, AsyncStackTrace(int contextGroupId, const String16& description,
std::vector<std::shared_ptr<StackFrame>> frames, std::vector<std::shared_ptr<StackFrame>> frames,
......
Checks that async chains for for-await-of are correct. Checks that async chains for for-await-of are correct.
Running test: testBasic Running test: testBasic
Debugger (test.js:10:2) Debugger (test.js:12:2)
Basic (test.js:48:4) Basic (test.js:50:4)
-- async function (test.js:46:20)-- -- async function --
Basic (test.js:46:20) Basic (test.js:48:20)
(anonymous) (testBasic.js:0:0) (anonymous) (testBasic.js:0:0)
Running test: testUncaughtReject Running test: testUncaughtReject
Debugger (test.js:10:2) Debugger (test.js:12:2)
-- async function (test.js:52:29)-- -- async function --
UncaughtReject (test.js:52:29) UncaughtReject (test.js:54:29)
(anonymous) (testUncaughtReject.js:0:0) (anonymous) (testUncaughtReject.js:0:0)
Running test: testUncaughtThrow Running test: testUncaughtThrow
Debugger (test.js:10:2) Debugger (test.js:12:2)
-- async function (test.js:61:28)-- -- async function --
UncaughtThrow (test.js:61:28) UncaughtThrow (test.js:63:28)
(anonymous) (testUncaughtThrow.js:0:0) (anonymous) (testUncaughtThrow.js:0:0)
Running test: testCaughtReject Running test: testCaughtReject
Debugger (test.js:10:2) Debugger (test.js:12:2)
CaughtReject (test.js:76:4) CaughtReject (test.js:78:4)
-- async function (test.js:70:27)-- -- async function --
CaughtReject (test.js:70:27) CaughtReject (test.js:72:27)
(anonymous) (testCaughtReject.js:0:0) (anonymous) (testCaughtReject.js:0:0)
Running test: testCaughtThrow Running test: testCaughtThrow
Debugger (test.js:10:2) Debugger (test.js:12:2)
CaughtThrow (test.js:86:4) CaughtThrow (test.js:88:4)
-- async function (test.js:80:26)-- -- async function --
CaughtThrow (test.js:80:26) CaughtThrow (test.js:82:26)
(anonymous) (testCaughtThrow.js:0:0) (anonymous) (testCaughtThrow.js:0:0)
Running test: testUncaughtRejectOnBreak Running test: testUncaughtRejectOnBreak
Running test: testUncaughtThrowOnBreak Running test: testUncaughtThrowOnBreak
Debugger (test.js:10:2) Debugger (test.js:12:2)
-- async function (test.js:99:35)-- -- async function --
UncaughtThrowOnBreak (test.js:99:35) UncaughtThrowOnBreak (test.js:101:35)
(anonymous) (testUncaughtThrowOnBreak.js:0:0) (anonymous) (testUncaughtThrowOnBreak.js:0:0)
Running test: testCaughtRejectOnBreak Running test: testCaughtRejectOnBreak
Running test: testCaughtThrowOnBreak Running test: testCaughtThrowOnBreak
Debugger (test.js:10:2) Debugger (test.js:12:2)
CaughtThrowOnBreak (test.js:124:4) CaughtThrowOnBreak (test.js:126:4)
-- async function (test.js:118:33)-- -- async function --
CaughtThrowOnBreak (test.js:118:33) CaughtThrowOnBreak (test.js:120:33)
(anonymous) (testCaughtThrowOnBreak.js:0:0) (anonymous) (testCaughtThrowOnBreak.js:0:0)
\ No newline at end of file
...@@ -50,7 +50,7 @@ async function Basic() { ...@@ -50,7 +50,7 @@ async function Basic() {
Debugger(); Debugger();
} }
} }
// TODO(kozyatinskiy): this stack trace is suspicious.
async function UncaughtReject() { async function UncaughtReject() {
async function loop() { async function loop() {
for await (let x of [Reject(new Error("boop"))]) { for await (let x of [Reject(new Error("boop"))]) {
...@@ -59,7 +59,7 @@ async function UncaughtReject() { ...@@ -59,7 +59,7 @@ async function UncaughtReject() {
} }
return loop().catch(Debugger); return loop().catch(Debugger);
} }
// TODO(kozyatinskiy): this stack trace is suspicious.
async function UncaughtThrow() { async function UncaughtThrow() {
async function loop() { async function loop() {
for await (let x of [Throw(new Error("boop"))]) { for await (let x of [Throw(new Error("boop"))]) {
...@@ -88,7 +88,7 @@ async function CaughtThrow() { ...@@ -88,7 +88,7 @@ async function CaughtThrow() {
Debugger(e); Debugger(e);
} }
} }
// TODO(kozyatinskiy): this stack trace is suspicious.
async function UncaughtRejectOnBreak() { async function UncaughtRejectOnBreak() {
async function loop() { async function loop() {
for await (let x of RejectOnReturn(["0", "1"])) { for await (let x of RejectOnReturn(["0", "1"])) {
...@@ -97,7 +97,7 @@ async function UncaughtRejectOnBreak() { ...@@ -97,7 +97,7 @@ async function UncaughtRejectOnBreak() {
} }
return loop().catch(Debugger); return loop().catch(Debugger);
} }
// TODO(kozyatinskiy): this stack trace is suspicious.
async function UncaughtThrowOnBreak() { async function UncaughtThrowOnBreak() {
async function loop() { async function loop() {
for await (let x of ThrowOnReturn(["0", "1"])) { for await (let x of ThrowOnReturn(["0", "1"])) {
...@@ -106,7 +106,7 @@ async function UncaughtThrowOnBreak() { ...@@ -106,7 +106,7 @@ async function UncaughtThrowOnBreak() {
} }
return loop().catch(Debugger); return loop().catch(Debugger);
} }
// TODO(kozyatinskiy): this stack trace is suspicious.
async function CaughtRejectOnBreak() { async function CaughtRejectOnBreak() {
try { try {
for await (let x of RejectOnReturn(["0", "1"])) { for await (let x of RejectOnReturn(["0", "1"])) {
...@@ -126,7 +126,7 @@ async function CaughtThrowOnBreak() { ...@@ -126,7 +126,7 @@ async function CaughtThrowOnBreak() {
Debugger(e); Debugger(e);
} }
} }
//# sourceURL=test.js`, 7, 129); //# sourceURL=test.js`, 9, 26);
InspectorTest.setupScriptMap(); InspectorTest.setupScriptMap();
Protocol.Debugger.onPaused(message => { Protocol.Debugger.onPaused(message => {
......
...@@ -9,12 +9,12 @@ test (test.js:21:2) ...@@ -9,12 +9,12 @@ test (test.js:21:2)
foo (test.js:10:2) foo (test.js:10:2)
-- Promise.resolve -- -- Promise.resolve --
test (test.js:20:2) test (test.js:19:14)
(anonymous) (expr1.js:0:0) (anonymous) (expr1.js:0:0)
foo (test.js:12:2) foo (test.js:12:2)
-- Promise.resolve -- -- Promise.resolve --
test (test.js:20:2) test (test.js:19:14)
(anonymous) (expr1.js:0:0) (anonymous) (expr1.js:0:0)
......
Checks async stack for late .then handlers with gc Checks async stack for late .then handlers with gc
foo1 (test.js:11:2) foo1 (test.js:11:2)
-- Promise.resolve -- -- Promise.resolve --
test (test.js:20:2) test (test.js:18:14)
(anonymous) (expr.js:0:0) (anonymous) (expr.js:0:0)
foo1 (test.js:11:2) foo1 (test.js:11:2)
-- Promise.resolve -- -- Promise.resolve --
test (test.js:20:2) test (test.js:22:14)
(anonymous) (expr.js:0:0) (anonymous) (expr.js:0:0)
foo1 (test.js:11:2) foo1 (test.js:11:2)
-- Promise.resolve -- -- Promise.resolve --
test (test.js:20:2) test (test.js:24:14)
(anonymous) (expr.js:0:0) (anonymous) (expr.js:0:0)
Checks that async stacks works for async/await Checks that async stacks works for async/await
foo2 (test.js:15:2) foo2 (test.js:15:2)
-- async function --
foo2 (test.js:13:19) foo2 (test.js:13:19)
test (test.js:24:8) test (test.js:24:8)
(anonymous) (expr.js:0:0) (anonymous) (expr.js:0:0)
foo2 (test.js:17:2) foo2 (test.js:17:2)
-- async function --
foo2 (test.js:13:19) foo2 (test.js:13:19)
test (test.js:24:8) test (test.js:24:8)
(anonymous) (expr.js:0:0) (anonymous) (expr.js:0:0)
foo1 (test.js:9:2) foo1 (test.js:9:2)
foo2 (test.js:18:8) foo2 (test.js:18:8)
-- async function --
foo2 (test.js:13:19) foo2 (test.js:13:19)
test (test.js:24:8) test (test.js:24:8)
(anonymous) (expr.js:0:0) (anonymous) (expr.js:0:0)
foo1 (test.js:9:2) foo1 (test.js:9:2)
(anonymous) (expr.js:0:0) -- Promise.resolve --
foo2 (test.js:19:43)
foo1 (test.js:9:2) -- async function --
-- Promise.resolve (test.js:19:43)--
foo2 (test.js:13:19) foo2 (test.js:13:19)
test (test.js:24:8) test (test.js:24:8)
(anonymous) (expr.js:0:0) (anonymous) (expr.js:0:0)
foo2 (test.js:20:2) foo2 (test.js:20:2)
-- async function --
foo2 (test.js:13:19) foo2 (test.js:13:19)
test (test.js:24:8) test (test.js:24:8)
(anonymous) (expr.js:0:0) (anonymous) (expr.js:0:0)
......
...@@ -2,88 +2,79 @@ Checks created frame for async call chain ...@@ -2,88 +2,79 @@ Checks created frame for async call chain
Running test: testPromise Running test: testPromise
foo1 (test.js:10:2) foo1 (test.js:10:2)
-- Promise.resolve (test.js:20:14)-- -- Promise.resolve --
promise (test.js:21:2) promise (test.js:20:14)
(anonymous) (expr.js:0:0) (anonymous) (expr.js:0:0)
Running test: testPromiseThen Running test: testPromiseThen
foo1 (test.js:10:2) foo1 (test.js:10:2)
-- Promise.resolve (test.js:28:14)-- -- Promise.resolve --
promiseThen (test.js:30:2) promiseThen (test.js:28:14)
(anonymous) (expr.js:0:0) (anonymous) (expr.js:0:0)
foo2 (test.js:14:2) foo2 (test.js:14:2)
-- Promise.resolve (test.js:29:14)-- -- Promise.resolve --
-- Promise.resolve (test.js:28:14)-- promiseThen (test.js:29:14)
promiseThen (test.js:30:2)
(anonymous) (expr.js:0:0) (anonymous) (expr.js:0:0)
Running test: testPromiseThenThen Running test: testPromiseThenThen
foo1 (test.js:10:2) foo1 (test.js:10:2)
-- Promise.resolve (test.js:37:14)-- -- Promise.resolve --
promiseThenThen (test.js:39:2) promiseThenThen (test.js:37:14)
(anonymous) (expr.js:0:0) (anonymous) (expr.js:0:0)
foo1 (test.js:10:2) foo1 (test.js:10:2)
-- Promise.resolve (test.js:38:14)-- -- Promise.resolve --
promiseThenThen (test.js:39:2) promiseThenThen (test.js:38:14)
(anonymous) (expr.js:0:0) (anonymous) (expr.js:0:0)
foo2 (test.js:14:2) foo2 (test.js:14:2)
-- Promise.resolve (test.js:37:25)-- -- Promise.resolve --
-- Promise.resolve (test.js:37:14)-- promiseThenThen (test.js:37:25)
promiseThenThen (test.js:39:2)
(anonymous) (expr.js:0:0) (anonymous) (expr.js:0:0)
Running test: testPromiseResolve Running test: testPromiseResolve
foo1 (test.js:10:2) foo1 (test.js:10:2)
-- Promise.resolve (test.js:44:27)-- -- Promise.resolve --
promiseResolve (test.js:44:17) promiseResolve (test.js:44:27)
(anonymous) (expr.js:0:0) (anonymous) (expr.js:0:0)
Running test: testPromiseReject Running test: testPromiseReject
foo1 (test.js:10:2) foo1 (test.js:10:2)
-- Promise.reject (test.js:48:31)-- -- Promise.reject --
promiseReject (test.js:48:17) promiseReject (test.js:48:31)
(anonymous) (expr.js:0:0) (anonymous) (expr.js:0:0)
Running test: testPromiseAll Running test: testPromiseAll
foo1 (test.js:10:2) foo1 (test.js:10:2)
-- Promise.resolve (test.js:52:44)-- -- Promise.resolve --
-- Promise.resolve (test.js:52:17)-- promiseAll (test.js:52:44)
promiseAll (test.js:52:31)
(anonymous) (expr.js:0:0) (anonymous) (expr.js:0:0)
Running test: testPromiseRace Running test: testPromiseRace
foo1 (test.js:10:2) foo1 (test.js:10:2)
-- Promise.resolve (test.js:56:45)-- -- Promise.resolve --
-- Promise.resolve (test.js:56:17)-- promiseRace (test.js:56:45)
promiseRace (test.js:56:32)
(anonymous) (expr.js:0:0) (anonymous) (expr.js:0:0)
Running test: testThenableJob1 Running test: testThenableJob1
foo1 (test.js:10:2) foo1 (test.js:10:2)
-- Promise.resolve (test.js:60:72)-- -- Promise.resolve --
-- Promise.resolve (test.js:60:56)-- thenableJob1 (test.js:60:72)
Promise.resolve.then (test.js:60:46)
-- Promise.resolve (test.js:60:27)--
thenableJob1 (test.js:60:17)
(anonymous) (expr.js:0:0) (anonymous) (expr.js:0:0)
Running test: testThenableJob2 Running test: testThenableJob2
foo1 (test.js:10:2) foo1 (test.js:10:2)
-- Promise.resolve (test.js:64:57)-- -- Promise.resolve --
Promise.resolve.then (test.js:64:46) thenableJob2 (test.js:64:57)
-- Promise.resolve (test.js:64:27)--
thenableJob2 (test.js:64:17)
(anonymous) (expr.js:0:0) (anonymous) (expr.js:0:0)
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// TODO(kozyatinskiy): fix this test.
InspectorTest.log('Checks created frame for async call chain'); InspectorTest.log('Checks created frame for async call chain');
InspectorTest.addScript( InspectorTest.addScript(
......
...@@ -2,173 +2,118 @@ Checks that async chains for promises are correct. ...@@ -2,173 +2,118 @@ Checks that async chains for promises are correct.
Running test: testPromise Running test: testPromise
foo1 (test.js:9:2) foo1 (test.js:9:2)
-- Promise.resolve (test.js:19:14)-- -- Promise.resolve --
promise (test.js:20:2) promise (test.js:19:14)
(anonymous) (testPromise.js:0:0) (anonymous) (testPromise.js:0:0)
Running test: testPromiseResolvedBySetTimeout Running test: testPromiseResolvedBySetTimeout
foo1 (test.js:9:2) foo1 (test.js:9:2)
-- Promise.resolve (test.js:27:14)-- -- Promise.resolve --
-- setTimeout -- promiseResolvedBySetTimeout (test.js:27:14)
promiseResolvedBySetTimeout (test.js:28:2)
(anonymous) (testPromiseResolvedBySetTimeout.js:0:0) (anonymous) (testPromiseResolvedBySetTimeout.js:0:0)
Running test: testPromiseAll Running test: testPromiseAll
foo1 (test.js:9:2) foo1 (test.js:9:2)
-- Promise.resolve (test.js:37:35)-- -- Promise.resolve --
-- Promise.resolve (test.js:37:19)-- promiseAll (test.js:37:35)
promiseAll (test.js:39:2)
(anonymous) (testPromiseAll.js:0:0) (anonymous) (testPromiseAll.js:0:0)
Running test: testPromiseAllReverseOrder Running test: testPromiseAllReverseOrder
foo1 (test.js:9:2) foo1 (test.js:9:2)
-- Promise.resolve (test.js:48:35)-- -- Promise.resolve --
-- Promise.resolve (test.js:48:19)-- promiseAllReverseOrder (test.js:48:35)
promiseAllReverseOrder (test.js:50:2)
(anonymous) (testPromiseAllReverseOrder.js:0:0) (anonymous) (testPromiseAllReverseOrder.js:0:0)
Running test: testPromiseRace Running test: testPromiseRace
foo1 (test.js:9:2) foo1 (test.js:9:2)
-- Promise.resolve (test.js:59:36)-- -- Promise.resolve --
-- Promise.resolve (test.js:59:19)-- promiseRace (test.js:59:36)
promiseRace (test.js:60:2)
(anonymous) (testPromiseRace.js:0:0) (anonymous) (testPromiseRace.js:0:0)
Running test: testTwoChainedCallbacks Running test: testTwoChainedCallbacks
foo1 (test.js:9:2) foo1 (test.js:9:2)
-- Promise.resolve (test.js:68:14)-- -- Promise.resolve --
twoChainedCallbacks (test.js:69:2) twoChainedCallbacks (test.js:68:14)
(anonymous) (testTwoChainedCallbacks.js:0:0) (anonymous) (testTwoChainedCallbacks.js:0:0)
foo2 (test.js:13:2) foo2 (test.js:13:2)
-- Promise.resolve (test.js:68:25)-- -- Promise.resolve --
-- Promise.resolve (test.js:68:14)-- twoChainedCallbacks (test.js:68:25)
twoChainedCallbacks (test.js:69:2)
(anonymous) (testTwoChainedCallbacks.js:0:0) (anonymous) (testTwoChainedCallbacks.js:0:0)
Running test: testPromiseResolve Running test: testPromiseResolve
foo1 (test.js:9:2) foo1 (test.js:9:2)
-- Promise.resolve (test.js:74:27)-- -- Promise.resolve --
promiseResolve (test.js:74:17) promiseResolve (test.js:74:27)
(anonymous) (testPromiseResolve.js:0:0) (anonymous) (testPromiseResolve.js:0:0)
foo2 (test.js:13:2) foo2 (test.js:13:2)
-- Promise.resolve (test.js:74:38)-- -- Promise.resolve --
-- Promise.resolve (test.js:74:27)-- promiseResolve (test.js:74:38)
promiseResolve (test.js:74:17)
(anonymous) (testPromiseResolve.js:0:0) (anonymous) (testPromiseResolve.js:0:0)
Running test: testThenableJobResolvedInSetTimeout Running test: testThenableJobResolvedInSetTimeout
foo1 (test.js:9:2) foo1 (test.js:9:2)
-- Promise.resolve (test.js:86:40)-- -- Promise.resolve --
-- setTimeout -- thenableJobResolvedInSetTimeout (test.js:86:40)
thenableJob (test.js:81:4)
p1.then (test.js:86:25)
-- Promise.resolve (test.js:86:14)--
thenableJobResolvedInSetTimeout (test.js:87:2)
(anonymous) (testThenableJobResolvedInSetTimeout.js:0:0) (anonymous) (testThenableJobResolvedInSetTimeout.js:0:0)
Running test: testThenableJobResolvedInSetTimeoutWithStack Running test: testThenableJobResolvedInSetTimeoutWithStack
foo1 (test.js:9:2) foo1 (test.js:9:2)
-- Promise.resolve (test.js:104:40)-- -- Promise.resolve --
inner (test.js:94:6) thenableJobResolvedInSetTimeoutWithStack (test.js:104:40)
-- setTimeout --
thenableJob (test.js:99:4)
p1.then (test.js:104:25)
-- Promise.resolve (test.js:104:14)--
thenableJobResolvedInSetTimeoutWithStack (test.js:105:2)
(anonymous) (testThenableJobResolvedInSetTimeoutWithStack.js:0:0) (anonymous) (testThenableJobResolvedInSetTimeoutWithStack.js:0:0)
Running test: testThenableJobResolvedByPromise Running test: testThenableJobResolvedByPromise
foo1 (test.js:9:2) foo1 (test.js:9:2)
-- Promise.resolve (test.js:118:40)-- -- Promise.resolve --
-- Promise.resolve (test.js:113:22)-- thenableJobResolvedByPromise (test.js:118:40)
thenableJob (test.js:113:12)
p1.then (test.js:118:25)
-- Promise.resolve (test.js:118:14)--
thenableJobResolvedByPromise (test.js:119:2)
(anonymous) (testThenableJobResolvedByPromise.js:0:0) (anonymous) (testThenableJobResolvedByPromise.js:0:0)
Running test: testThenableJobResolvedByPromiseWithStack Running test: testThenableJobResolvedByPromiseWithStack
foo1 (test.js:9:2) foo1 (test.js:9:2)
-- Promise.resolve (test.js:136:40)-- -- Promise.resolve --
inner (test.js:126:6) thenableJobResolvedByPromiseWithStack (test.js:136:40)
-- Promise.resolve (test.js:131:22)--
thenableJob (test.js:131:12)
p1.then (test.js:136:25)
-- Promise.resolve (test.js:136:14)--
thenableJobResolvedByPromiseWithStack (test.js:137:2)
(anonymous) (testThenableJobResolvedByPromiseWithStack.js:0:0) (anonymous) (testThenableJobResolvedByPromiseWithStack.js:0:0)
Running test: testLateThenCallback Running test: testLateThenCallback
foo1 (test.js:9:2) foo1 (test.js:9:2)
-- Promise.resolve (test.js:145:12)-- -- Promise.resolve --
lateThenCallback (test.js:144:2) lateThenCallback (test.js:145:12)
(anonymous) (testLateThenCallback.js:0:0) (anonymous) (testLateThenCallback.js:0:0)
Running test: testComplex Running test: testComplex
inner1 (test.js:154:6) inner1 (test.js:154:6)
foo1 (test.js:156:4) foo1 (test.js:156:4)
-- Promise.resolve (test.js:202:5)-- -- Promise.resolve --
inner2 (test.js:162:6) complex (test.js:202:5)
-- Promise.resolve (test.js:165:22)--
foo2 (test.js:165:12)
-- Promise.resolve (test.js:201:5)--
inner3 (test.js:172:6)
-- setTimeout --
foo3 (test.js:175:4)
-- Promise.resolve (test.js:200:5)--
-- Promise.resolve (test.js:199:5)--
-- Promise.resolve (test.js:188:7)--
-- Promise.resolve (test.js:187:19)--
foo5 (test.js:187:52)
-- Promise.resolve (test.js:198:5)--
-- Promise.resolve (test.js:193:7)--
-- Promise.resolve (test.js:192:19)--
foo6 (test.js:192:34)
-- Promise.resolve (test.js:197:5)--
complex (test.js:196:18)
(anonymous) (testComplex.js:0:0) (anonymous) (testComplex.js:0:0)
p.then (test.js:207:8) p.then (test.js:207:8)
-- Promise.resolve (test.js:206:8)-- -- Promise.resolve --
-- Promise.resolve (test.js:202:5)-- p.then (test.js:206:8)
inner2 (test.js:162:6) -- Promise.resolve --
-- Promise.resolve (test.js:165:22)-- setTimeout (test.js:205:6)
foo2 (test.js:165:12)
-- Promise.resolve (test.js:201:5)--
inner3 (test.js:172:6)
-- setTimeout -- -- setTimeout --
foo3 (test.js:175:4) complex (test.js:204:2)
-- Promise.resolve (test.js:200:5)--
-- Promise.resolve (test.js:199:5)--
-- Promise.resolve (test.js:188:7)--
-- Promise.resolve (test.js:187:19)--
foo5 (test.js:187:52)
-- Promise.resolve (test.js:198:5)--
-- Promise.resolve (test.js:193:7)--
-- Promise.resolve (test.js:192:19)--
foo6 (test.js:192:34)
-- Promise.resolve (test.js:197:5)--
complex (test.js:196:18)
(anonymous) (testComplex.js:0:0) (anonymous) (testComplex.js:0:0)
Running test: testReject Running test: testReject
foo1 (test.js:9:2) foo1 (test.js:9:2)
-- Promise.reject (test.js:217:31)-- -- Promise.reject --
reject (test.js:217:17) reject (test.js:217:31)
(anonymous) (testReject.js:0:0) (anonymous) (testReject.js:0:0)
...@@ -7,11 +7,11 @@ actual async chain len: 1 ...@@ -7,11 +7,11 @@ actual async chain len: 1
inspector.setMaxAsyncTaskStacks(1024) inspector.setMaxAsyncTaskStacks(1024)
Run expression 'console.trace(42)' with async chain len: 2 Run expression 'console.trace(42)' with async chain len: 2
actual async chain len: 2 actual async chain len: 1
inspector.setMaxAsyncTaskStacks(1024) inspector.setMaxAsyncTaskStacks(1024)
Run expression 'console.trace(42)' with async chain len: 5 Run expression 'console.trace(42)' with async chain len: 5
actual async chain len: 5 actual async chain len: 1
inspector.setMaxAsyncTaskStacks(1024) inspector.setMaxAsyncTaskStacks(1024)
Run expression 'console.trace(42)' with async chain len: 1 Run expression 'console.trace(42)' with async chain len: 1
...@@ -47,11 +47,11 @@ actual async chain len: 0 ...@@ -47,11 +47,11 @@ actual async chain len: 0
Running test: testOneLimit Running test: testOneLimit
inspector.setMaxAsyncTaskStacks(1) inspector.setMaxAsyncTaskStacks(1)
Run expression 'console.trace(42)' with async chain len: 1 Run expression 'console.trace(42)' with async chain len: 1
actual async chain len: 0 actual async chain len: 1
inspector.setMaxAsyncTaskStacks(1) inspector.setMaxAsyncTaskStacks(1)
Run expression 'console.trace(42)' with async chain len: 2 Run expression 'console.trace(42)' with async chain len: 2
actual async chain len: 0 actual async chain len: 1
inspector.setMaxAsyncTaskStacks(1) inspector.setMaxAsyncTaskStacks(1)
Run expression 'console.trace(42)' with async chain len: 1 Run expression 'console.trace(42)' with async chain len: 1
...@@ -65,7 +65,7 @@ actual async chain len: 1 ...@@ -65,7 +65,7 @@ actual async chain len: 1
Running test: testTwoLimit Running test: testTwoLimit
inspector.setMaxAsyncTaskStacks(2) inspector.setMaxAsyncTaskStacks(2)
Run expression 'console.trace(42)' with async chain len: 1 Run expression 'console.trace(42)' with async chain len: 1
actual async chain len: 0 actual async chain len: 1
inspector.setMaxAsyncTaskStacks(2) inspector.setMaxAsyncTaskStacks(2)
Run expression 'console.trace(42)' with async chain len: 2 Run expression 'console.trace(42)' with async chain len: 2
...@@ -73,7 +73,7 @@ actual async chain len: 0 ...@@ -73,7 +73,7 @@ actual async chain len: 0
inspector.setMaxAsyncTaskStacks(2) inspector.setMaxAsyncTaskStacks(2)
Run expression 'console.trace(42)' with async chain len: 3 Run expression 'console.trace(42)' with async chain len: 3
actual async chain len: 0 actual async chain len: 1
inspector.setMaxAsyncTaskStacks(2) inspector.setMaxAsyncTaskStacks(2)
Run expression 'console.trace(42)' with async chain len: 1 Run expression 'console.trace(42)' with async chain len: 1
...@@ -99,7 +99,7 @@ actual async chain len: 1 ...@@ -99,7 +99,7 @@ actual async chain len: 1
inspector.setMaxAsyncTaskStacks(3) inspector.setMaxAsyncTaskStacks(3)
Run expression 'console.trace(42)' with async chain len: 3 Run expression 'console.trace(42)' with async chain len: 3
actual async chain len: 0 actual async chain len: 1
inspector.setMaxAsyncTaskStacks(3) inspector.setMaxAsyncTaskStacks(3)
Run expression 'console.trace(42)' with async chain len: 1 Run expression 'console.trace(42)' with async chain len: 1
...@@ -143,11 +143,11 @@ actual async chain len: 1 ...@@ -143,11 +143,11 @@ actual async chain len: 1
inspector.setMaxAsyncTaskStacks(5) inspector.setMaxAsyncTaskStacks(5)
Run expression 'console.trace(42)' with async chain len: 2 Run expression 'console.trace(42)' with async chain len: 2
actual async chain len: 2 actual async chain len: 1
inspector.setMaxAsyncTaskStacks(5) inspector.setMaxAsyncTaskStacks(5)
Run expression 'console.trace(42)' with async chain len: 3 Run expression 'console.trace(42)' with async chain len: 3
actual async chain len: 2 actual async chain len: 1
inspector.setMaxAsyncTaskStacks(5) inspector.setMaxAsyncTaskStacks(5)
Run expression 'console.trace(42)' with async chain len: 1 Run expression 'console.trace(42)' with async chain len: 1
...@@ -167,7 +167,7 @@ actual async chain len: 1 ...@@ -167,7 +167,7 @@ actual async chain len: 1
inspector.setMaxAsyncTaskStacks(6) inspector.setMaxAsyncTaskStacks(6)
Run expression 'console.trace(42)' with async chain len: 2 Run expression 'console.trace(42)' with async chain len: 2
actual async chain len: 2 actual async chain len: 1
inspector.setMaxAsyncTaskStacks(6) inspector.setMaxAsyncTaskStacks(6)
Run expression 'console.trace(42)' with async chain len: 3 Run expression 'console.trace(42)' with async chain len: 3
...@@ -191,11 +191,11 @@ actual async chain len: 1 ...@@ -191,11 +191,11 @@ actual async chain len: 1
inspector.setMaxAsyncTaskStacks(7) inspector.setMaxAsyncTaskStacks(7)
Run expression 'console.trace(42)' with async chain len: 2 Run expression 'console.trace(42)' with async chain len: 2
actual async chain len: 2 actual async chain len: 1
inspector.setMaxAsyncTaskStacks(7) inspector.setMaxAsyncTaskStacks(7)
Run expression 'console.trace(42)' with async chain len: 3 Run expression 'console.trace(42)' with async chain len: 3
actual async chain len: 3 actual async chain len: 1
inspector.setMaxAsyncTaskStacks(7) inspector.setMaxAsyncTaskStacks(7)
Run expression 'console.trace(42)' with async chain len: 1 Run expression 'console.trace(42)' with async chain len: 1
......
...@@ -3,23 +3,23 @@ set async chain depth to 8 ...@@ -3,23 +3,23 @@ set async chain depth to 8
Running test: testDebuggerPaused Running test: testDebuggerPaused
Run expression 'debugger;' with async chain len: 4 Run expression 'debugger;' with async chain len: 4
actual async chain len: 4 actual async chain len: 1
Run expression 'debugger;' with async chain len: 8 Run expression 'debugger;' with async chain len: 8
actual async chain len: 8 actual async chain len: 1
Run expression 'debugger;' with async chain len: 9 Run expression 'debugger;' with async chain len: 9
actual async chain len: 8 actual async chain len: 1
Run expression 'debugger;' with async chain len: 32 Run expression 'debugger;' with async chain len: 32
actual async chain len: 8 actual async chain len: 1
Running test: testConsoleTrace Running test: testConsoleTrace
Run expression 'console.trace(42);' with async chain len: 4 Run expression 'console.trace(42);' with async chain len: 4
actual async chain len: 4 actual async chain len: 1
Run expression 'console.trace(42);' with async chain len: 8 Run expression 'console.trace(42);' with async chain len: 8
actual async chain len: 8 actual async chain len: 1
Run expression 'console.trace(42);' with async chain len: 9 Run expression 'console.trace(42);' with async chain len: 9
actual async chain len: 8 actual async chain len: 1
Run expression 'console.trace(42);' with async chain len: 32 Run expression 'console.trace(42);' with async chain len: 32
actual async chain len: 8 actual async chain len: 1
Running test: testDebuggerPausedSetTimeout Running test: testDebuggerPausedSetTimeout
Run expression 'debugger;' with async chain len: 4 Run expression 'debugger;' with async chain len: 4
...@@ -54,56 +54,37 @@ Running test: testConsoleTraceWithEmptySync ...@@ -54,56 +54,37 @@ Running test: testConsoleTraceWithEmptySync
] ]
parent : { parent : {
callFrames : [ callFrames : [
[0] : {
columnNumber : 47
functionName :
lineNumber : 0
scriptId : <scriptId>
url :
}
] ]
description : Promise.resolve description : Promise.resolve
parent : {
callFrames : [
[0] : {
columnNumber : 23
functionName : resolve
lineNumber : 0
scriptId : <scriptId>
url :
}
[1] : {
columnNumber : 0
functionName :
lineNumber : 0
scriptId : <scriptId>
url :
}
]
description : setTimeout
}
promiseCreationFrame : {
columnNumber : 47
functionName :
lineNumber : 0
scriptId : <scriptId>
url :
}
} }
} }
Running test: testDebuggerPausedThenableJob Running test: testDebuggerPausedThenableJob
Run expression 'debugger;' with async chain len: 4 Run expression 'debugger;' with async chain len: 4
actual async chain len: 4 actual async chain len: 1
Run expression 'debugger;' with async chain len: 8 Run expression 'debugger;' with async chain len: 8
actual async chain len: 8 actual async chain len: 1
Run expression 'debugger;' with async chain len: 9 Run expression 'debugger;' with async chain len: 9
actual async chain len: 8 actual async chain len: 1
Run expression 'debugger;' with async chain len: 32 Run expression 'debugger;' with async chain len: 32
actual async chain len: 8 actual async chain len: 1
Running test: testConsoleTraceThenableJob Running test: testConsoleTraceThenableJob
Run expression 'console.trace(42);' with async chain len: 4 Run expression 'console.trace(42);' with async chain len: 4
actual async chain len: 4 actual async chain len: 1
Run expression 'console.trace(42);' with async chain len: 8 Run expression 'console.trace(42);' with async chain len: 8
actual async chain len: 8 actual async chain len: 1
Run expression 'console.trace(42);' with async chain len: 9 Run expression 'console.trace(42);' with async chain len: 9
actual async chain len: 8 actual async chain len: 1
Run expression 'console.trace(42);' with async chain len: 32 Run expression 'console.trace(42);' with async chain len: 32
actual async chain len: 8 actual async chain len: 1
Running test: twoConsoleAssert Running test: twoConsoleAssert
actual async chain len: 1 actual async chain len: 1
......
// Copyright 2017 the V8 project authors. All rights reserved. // Copyright 2017 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// TODO(kozyatinskiy): fix or remove it later.
InspectorTest.log('Checks that we trim async call chains correctly.'); InspectorTest.log('Checks that we trim async call chains correctly.');
Protocol.Debugger.enable(); Protocol.Debugger.enable();
......
...@@ -21,6 +21,17 @@ Run expression 'console.trace()' with async chain len: 3 ...@@ -21,6 +21,17 @@ Run expression 'console.trace()' with async chain len: 3
url : url :
} }
] ]
parent : {
callFrames : [
[0] : {
columnNumber : 46
functionName :
lineNumber : 0
scriptId : <scriptId>
url :
}
]
}
} }
timestamp : <timestamp> timestamp : <timestamp>
type : trace type : trace
...@@ -50,15 +61,15 @@ Run expression 'console.trace()' with async chain len: 3 ...@@ -50,15 +61,15 @@ Run expression 'console.trace()' with async chain len: 3
] ]
parent : { parent : {
callFrames : [ callFrames : [
[0] : {
columnNumber : 46
functionName :
lineNumber : 0
scriptId : <scriptId>
url :
}
] ]
description : Promise.resolve description : Promise.resolve
promiseCreationFrame : {
columnNumber : 46
functionName :
lineNumber : 0
scriptId : <scriptId>
url :
}
} }
} }
timestamp : <timestamp> timestamp : <timestamp>
...@@ -89,27 +100,15 @@ Run expression 'console.trace()' with async chain len: 3 ...@@ -89,27 +100,15 @@ Run expression 'console.trace()' with async chain len: 3
] ]
parent : { parent : {
callFrames : [ callFrames : [
] [0] : {
description : Promise.resolve columnNumber : 46
parent : {
callFrames : [
]
description : Promise.resolve
promiseCreationFrame : {
columnNumber : 32
functionName : functionName :
lineNumber : 0 lineNumber : 0
scriptId : <scriptId> scriptId : <scriptId>
url : url :
} }
} ]
promiseCreationFrame : { description : Promise.resolve
columnNumber : 46
functionName :
lineNumber : 0
scriptId : <scriptId>
url :
}
} }
} }
timestamp : <timestamp> timestamp : <timestamp>
...@@ -140,15 +139,15 @@ Run expression 'console.trace()' with async chain len: 3 ...@@ -140,15 +139,15 @@ Run expression 'console.trace()' with async chain len: 3
] ]
parent : { parent : {
callFrames : [ callFrames : [
[0] : {
columnNumber : 46
functionName :
lineNumber : 0
scriptId : <scriptId>
url :
}
] ]
description : Promise.resolve description : Promise.resolve
promiseCreationFrame : {
columnNumber : 46
functionName :
lineNumber : 0
scriptId : <scriptId>
url :
}
} }
} }
timestamp : <timestamp> timestamp : <timestamp>
...@@ -179,46 +178,15 @@ Run expression 'console.trace()' with async chain len: 3 ...@@ -179,46 +178,15 @@ Run expression 'console.trace()' with async chain len: 3
] ]
parent : { parent : {
callFrames : [ callFrames : [
] [0] : {
description : Promise.resolve columnNumber : 46
parent : {
callFrames : [
]
description : Promise.resolve
parent : {
callFrames : [
[0] : {
columnNumber : 8
functionName :
lineNumber : 0
scriptId : <scriptId>
url :
}
]
description : Promise.resolve
promiseCreationFrame : {
columnNumber : 18
functionName :
lineNumber : 0
scriptId : <scriptId>
url :
}
}
promiseCreationFrame : {
columnNumber : 32
functionName : functionName :
lineNumber : 0 lineNumber : 0
scriptId : <scriptId> scriptId : <scriptId>
url : url :
} }
} ]
promiseCreationFrame : { description : Promise.resolve
columnNumber : 46
functionName :
lineNumber : 0
scriptId : <scriptId>
url :
}
} }
} }
timestamp : <timestamp> timestamp : <timestamp>
...@@ -249,46 +217,15 @@ Run expression 'console.trace()' with async chain len: 3 ...@@ -249,46 +217,15 @@ Run expression 'console.trace()' with async chain len: 3
] ]
parent : { parent : {
callFrames : [ callFrames : [
] [0] : {
description : Promise.resolve columnNumber : 46
parent : {
callFrames : [
]
description : Promise.resolve
parent : {
callFrames : [
[0] : {
columnNumber : 8
functionName :
lineNumber : 0
scriptId : <scriptId>
url :
}
]
description : Promise.resolve
promiseCreationFrame : {
columnNumber : 18
functionName :
lineNumber : 0
scriptId : <scriptId>
url :
}
}
promiseCreationFrame : {
columnNumber : 32
functionName : functionName :
lineNumber : 0 lineNumber : 0
scriptId : <scriptId> scriptId : <scriptId>
url : url :
} }
} ]
promiseCreationFrame : { description : Promise.resolve
columnNumber : 46
functionName :
lineNumber : 0
scriptId : <scriptId>
url :
}
} }
} }
timestamp : <timestamp> timestamp : <timestamp>
......
// Copyright 2017 the V8 project authors. All rights reserved. // Copyright 2017 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// TODO(kozyatinskiy): fix or remove it later.
(async function test(){ (async function test(){
InspectorTest.log('Checks correctness of promise chains when limit hit'); InspectorTest.log('Checks correctness of promise chains when limit hit');
await Protocol.Runtime.enable(); await Protocol.Runtime.enable();
......
...@@ -3,15 +3,15 @@ Checks that we report not more then maxDepth call chains. ...@@ -3,15 +3,15 @@ Checks that we report not more then maxDepth call chains.
Running test: testPaused Running test: testPaused
Actual call chain length: 8 Actual call chain length: 8
setAsyncCallStackDepth(maxDepth): 16 setAsyncCallStackDepth(maxDepth): 16
reported: 8 reported: 1
Actual call chain length: 8 Actual call chain length: 8
setAsyncCallStackDepth(maxDepth): 8 setAsyncCallStackDepth(maxDepth): 8
reported: 8 reported: 1
Actual call chain length: 8 Actual call chain length: 8
setAsyncCallStackDepth(maxDepth): 7 setAsyncCallStackDepth(maxDepth): 7
reported: 7 reported: 1
Actual call chain length: 8 Actual call chain length: 8
setAsyncCallStackDepth(maxDepth): 0 setAsyncCallStackDepth(maxDepth): 0
...@@ -21,15 +21,15 @@ reported: 0 ...@@ -21,15 +21,15 @@ reported: 0
Running test: testConsoleTrace Running test: testConsoleTrace
Actual call chain length: 8 Actual call chain length: 8
setAsyncCallStackDepth(maxDepth): 16 setAsyncCallStackDepth(maxDepth): 16
reported: 8 reported: 1
Actual call chain length: 8 Actual call chain length: 8
setAsyncCallStackDepth(maxDepth): 8 setAsyncCallStackDepth(maxDepth): 8
reported: 8 reported: 1
Actual call chain length: 8 Actual call chain length: 8
setAsyncCallStackDepth(maxDepth): 7 setAsyncCallStackDepth(maxDepth): 7
reported: 7 reported: 1
Actual call chain length: 8 Actual call chain length: 8
setAsyncCallStackDepth(maxDepth): 0 setAsyncCallStackDepth(maxDepth): 0
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// TODO(kozyatinskiy): fix or remove it later with new stack traces it's almost
// imposible to hit limit.
InspectorTest.log('Checks that we report not more then maxDepth call chains.'); InspectorTest.log('Checks that we report not more then maxDepth call chains.');
InspectorTest.addScript(` InspectorTest.addScript(`
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment