[inspector] Add test for getPossibleBreakpoints on embedded code
This tests calling Debugger.getPossibleBreakpoints on a user function embedded into the startup snapshot. Currently, this fails because inspector does not know how to handle scripts without an associated context. The test should be updated once we have a fix. Bug: v8:9029 Change-Id: Id2391a2df203fa7f119f39ea1c34da6a7c54206f Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1581643 Reviewed-by: Peter Marshall <petermarshall@chromium.org> Commit-Queue: Jakob Gruber <jgruber@chromium.org> Cr-Commit-Position: refs/heads/master@{#61063}
This commit is contained in:
parent
dd8e820cc7
commit
ba081a32d2
@ -0,0 +1,28 @@
|
||||
Embedding script 'function f() { return 42; }'
|
||||
Tests that getPossibleBreakpoints works on a snapshotted function
|
||||
scriptParsed
|
||||
{
|
||||
scriptSource : function f() { return 42; }
|
||||
}
|
||||
{
|
||||
endColumn : 27
|
||||
endLine : 0
|
||||
executionContextId : <executionContextId>
|
||||
hasSourceURL : false
|
||||
hash : 05296308743b1ae80b7cf865a54ed2d12b19b77f
|
||||
isLiveEdit : false
|
||||
isModule : false
|
||||
length : 27
|
||||
scriptId : <scriptId>
|
||||
sourceMapURL :
|
||||
startColumn : 0
|
||||
startLine : 0
|
||||
url : <embedded>
|
||||
}
|
||||
{
|
||||
error : {
|
||||
code : -32000
|
||||
message : Cannot retrive script context
|
||||
}
|
||||
id : <messageId>
|
||||
}
|
39
test/inspector/debugger/script-on-after-compile-snapshot.js
Normal file
39
test/inspector/debugger/script-on-after-compile-snapshot.js
Normal file
@ -0,0 +1,39 @@
|
||||
// Copyright 2019 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.
|
||||
|
||||
// Embed a user function in the snapshot and listen for scriptParsed events.
|
||||
|
||||
// Flags: --embed 'function f() { return 42; }; f();'
|
||||
// Flags: --no-turbo-rewrite-far-jumps
|
||||
|
||||
let {session, contextGroup, Protocol} = InspectorTest.start(
|
||||
'Tests that getPossibleBreakpoints works on a snapshotted function');
|
||||
session.setupScriptMap();
|
||||
|
||||
Protocol.Debugger.onScriptParsed(requestSourceAndDump);
|
||||
|
||||
Protocol.Debugger.enable()
|
||||
.then(InspectorTest.waitForPendingTasks)
|
||||
.then(InspectorTest.completeTest);
|
||||
|
||||
function requestSourceAndDump(scriptParsedMessage) {
|
||||
const scriptId = scriptParsedMessage.params.scriptId;
|
||||
Protocol.Debugger.getScriptSource({ scriptId: scriptId })
|
||||
.then((sourceMessage) => dumpScriptParsed(
|
||||
scriptParsedMessage, sourceMessage))
|
||||
.then(() => Protocol.Debugger.getPossibleBreakpoints({
|
||||
start: { lineNumber: 0, columnNumber: 0, scriptId: scriptId },
|
||||
end: { lineNumber: 0, columnNumber: 1, scriptId: scriptId },
|
||||
restrictToFunction: false
|
||||
}))
|
||||
.then(InspectorTest.logMessage);
|
||||
}
|
||||
|
||||
function dumpScriptParsed(scriptParsedMessage, sourceMessage) {
|
||||
var sourceResult = sourceMessage.result;
|
||||
sourceResult.scriptSource = sourceResult.scriptSource.replace(/\n/g, "<nl>");
|
||||
InspectorTest.log("scriptParsed");
|
||||
InspectorTest.logObject(sourceResult);
|
||||
InspectorTest.logMessage(scriptParsedMessage.params);
|
||||
}
|
@ -14,6 +14,9 @@
|
||||
|
||||
# Bad OOM timing on noembed builds (https://crbug.com/v8/8494).
|
||||
'debugger/pause-on-oom': [PASS, ['embedded_builtins == False', SKIP]],
|
||||
|
||||
# https://crbug.com/v8/9029
|
||||
'debugger/script-on-after-compile-snapshot': [SKIP],
|
||||
}], # ALWAYS
|
||||
|
||||
##############################################################################
|
||||
|
Loading…
Reference in New Issue
Block a user