Skip to content

Commit 9f282dd

Browse files
TimothyGuMylesBorins
authored andcommitted
deps: cherry-pick 1420e44db0 from upstream V8
Original commit message: [coverage] Correctly free DebugInfo in the absence of breakpoints It's quite possible for DebugInfos to exist without the presence of a bytecode array, since DebugInfos are created for all functions for which we have a CoverageInfo. Free such objects properly. Also move the corresponding deletion of CoverageInfos on unload up before the early exit. Bug: v8:6000 Change-Id: Idde45b222290aa8b6828b61ff2251918b8ed2aed Reviewed-on: https://chromium-review.googlesource.com/664811 Reviewed-by: Yang Guo <[email protected]> Commit-Queue: Jakob Gruber <[email protected]> Cr-Commit-Position: refs/heads/master@{#48024} Fixes crash when passing Profiler.startPreciseCoverage before Debug.paused is received. PR-URL: #17344 Refs: v8/v8@1420e44 Refs: bcoe/c8#6 (comment) Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
1 parent 6a7a59a commit 9f282dd

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

common.gypi

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
# Reset this number to 0 on major V8 upgrades.
2929
# Increment by one for each non-official patch applied to deps/v8.
30-
'v8_embedder_string': '-node.14',
30+
'v8_embedder_string': '-node.15',
3131

3232
# Enable disassembler for `--print-code` v8 options
3333
'v8_enable_disassembler': 1,

deps/v8/src/debug/debug.cc

+5-3
Original file line numberDiff line numberDiff line change
@@ -338,13 +338,12 @@ bool Debug::Load() {
338338
void Debug::Unload() {
339339
ClearAllBreakPoints();
340340
ClearStepping();
341+
if (FLAG_block_coverage) RemoveAllCoverageInfos();
341342
RemoveDebugDelegate();
342343

343344
// Return debugger is not loaded.
344345
if (!is_loaded()) return;
345346

346-
if (FLAG_block_coverage) RemoveAllCoverageInfos();
347-
348347
// Clear debugger context global handle.
349348
GlobalHandles::Destroy(Handle<Object>::cast(debug_context_).location());
350349
debug_context_ = Handle<Context>();
@@ -643,8 +642,11 @@ void Debug::ApplyBreakPoints(Handle<DebugInfo> debug_info) {
643642
}
644643

645644
void Debug::ClearBreakPoints(Handle<DebugInfo> debug_info) {
645+
// If we attempt to clear breakpoints but none exist, simply return. This can
646+
// happen e.g. CoverageInfos exit but no breakpoints are set.
647+
if (!debug_info->HasDebugBytecodeArray()) return;
648+
646649
DisallowHeapAllocation no_gc;
647-
DCHECK(debug_info->HasDebugBytecodeArray());
648650
for (BreakIterator it(debug_info); !it.Done(); it.Next()) {
649651
it.ClearDebugBreak();
650652
}

0 commit comments

Comments
 (0)