[debug] Fix removing instrumentation breakpoint on pause

Bug: chromium:1354043
Change-Id: Ib30aaa6e799eb3cda611e1ec63cd8e049befc75f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4100485
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Jaroslav Sevcik <jarin@chromium.org>
Cr-Commit-Position: refs/heads/main@{#84799}
This commit is contained in:
Jaroslav Sevcik 2022-12-13 08:00:54 +01:00 committed by V8 LUCI CQ
parent f8ca14b769
commit 00c8f93df1
3 changed files with 34 additions and 2 deletions

View File

@ -204,7 +204,10 @@ int BreakLocation::BreakIndexFromCodeOffset(Handle<DebugInfo> debug_info,
bool BreakLocation::HasBreakPoint(Isolate* isolate,
Handle<DebugInfo> debug_info) const {
// First check whether there is a break point with the same source position.
if (!debug_info->HasBreakPoint(isolate, position_)) return false;
if (!debug_info->HasBreakInfo() ||
!debug_info->HasBreakPoint(isolate, position_)) {
return false;
}
if (debug_info->CanBreakAtEntry()) {
DCHECK_EQ(Debug::kBreakAtEntryPosition, position_);
return debug_info->BreakAtEntry();

View File

@ -8,3 +8,9 @@ Resumed.
Paused at foo.js with reason "other".
Resumed.
Done.
Running test: testInstrumentationRemoveDuringInstrumentationPause
Paused at with reason "instrumentation".
Removed instrumentation breakpoint
Resumed
Evaluation result: 42

View File

@ -53,4 +53,27 @@ async function testPauseDuringInstrumentationPause() {
await Protocol.Debugger.disable();
}
InspectorTest.runAsyncTestSuite([testPauseDuringInstrumentationPause]);
async function testInstrumentationRemoveDuringInstrumentationPause() {
await Protocol.Runtime.enable();
await Protocol.Debugger.enable();
const {result: {breakpointId}} =
await Protocol.Debugger.setInstrumentationBreakpoint(
{instrumentation: 'beforeScriptExecution'});
const pause = Protocol.Debugger.oncePaused();
Protocol.Runtime.evaluate({expression: 'console.log(\'Hi\')'});
logPause(await pause);
await Protocol.Debugger.removeBreakpoint({breakpointId});
InspectorTest.log('Removed instrumentation breakpoint');
await Protocol.Debugger.resume();
InspectorTest.log('Resumed');
const {result: {result: {value}}} =
await Protocol.Runtime.evaluate({expression: '42'});
InspectorTest.log(`Evaluation result: ${value}`);
}
InspectorTest.runAsyncTestSuite([
testPauseDuringInstrumentationPause,
testInstrumentationRemoveDuringInstrumentationPause
]);