Commit 24ee7ed5 authored by Simon Zünd's avatar Simon Zünd Committed by V8 LUCI CQ

[debug] Fix DCHECK when looking for the closest breakpoint

This CL adjusts a DCHECK that verifies a bytecode offset when looking
for the closest breakpoint given that offset. When we pause on
function entry via interrupt, then the offset is
kFunctionEntryBytecodeOffset (-1), which is still a valid offset.

R=jarin@chromium.org

Fixed: chromium:1357554
Change-Id: I5b25b58f02be0e605191c38e9d1d93e334664c63
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3862265
Commit-Queue: Simon Zünd <szuend@chromium.org>
Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Cr-Commit-Position: refs/heads/main@{#82805}
parent 87ba2e2e
......@@ -187,7 +187,8 @@ int BreakLocation::BreakIndexFromCodeOffset(Handle<DebugInfo> debug_info,
// Run through all break points to locate the one closest to the address.
int closest_break = 0;
int distance = kMaxInt;
DCHECK(0 <= offset && offset < abstract_code->Size());
DCHECK(kFunctionEntryBytecodeOffset <= offset &&
offset < abstract_code->Size());
for (BreakIterator it(debug_info); !it.Done(); it.Next()) {
// Check if this break point is closer that what was previously found.
if (it.code_offset() <= offset && offset - it.code_offset() < distance) {
......
// Copyright 2022 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.
// TODO(crbug.com/1357554): Enable for Sparkplug once we can step into a
// a sparkplug function paused during the sparkplug prolog builtin.
// Flags: --no-sparkplug
var Debug = debug.Debug;
Debug.setListener(function (event, exec_state, event_data, data) {
if (event == Debug.DebugEvent.Break) {
Debug.setListener(null);
Debug.stepInto();
}
});
%ScheduleBreak();
(function foo() {
return 5;
})();
......@@ -154,4 +154,11 @@
'regress/regress-crbug-507070': [SKIP],
}], # third_party_heap
################################################################################
['variant == sparkplug or variant == always_sparkplug', {
# https://crbug.com/1357554: Enable for Sparkplug once we can step into a
# a sparkplug function paused during the sparkplug prolog builtin.
'debug/regress/regress-crbug-1357554': [SKIP],
}], # variant == sparkplug or variant == always_sparkplug
]
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