Commit 8f8839b5 authored by Thibaud Michaud's avatar Thibaud Michaud Committed by Commit Bot

[debug] Fix wrong offset in RemoveBreakpoint

DebugInfo::RemoveBreakpoint did not remove the correct breakpoint
because of a confusion between offsets relative to the function and
offsets relative to the module. This is not visible in the tests, as
removed breakpoints are already skipped by the runtime function.

Drive-by: replace a return which should have been a continue in OSR.

R=clemensb@chromium.org

Change-Id: I574c474139e969bd91217cfa7adc806d43db3c99
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2120589
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66891}
parent da409929
......@@ -312,7 +312,14 @@ class LiftoffCompiler {
next_breakpoint_ptr_(breakpoints.begin()),
next_breakpoint_end_(breakpoints.end()),
next_extra_source_pos_ptr_(extra_source_pos.begin()),
next_extra_source_pos_end_(extra_source_pos.end()) {}
next_extra_source_pos_end_(extra_source_pos.end()) {
if (breakpoints.empty()) {
next_breakpoint_ptr_ = next_breakpoint_end_ = nullptr;
}
if (extra_source_pos.empty()) {
next_extra_source_pos_ptr_ = next_extra_source_pos_end_ = nullptr;
}
}
bool did_bailout() const { return bailout_reason_ != kSuccess; }
LiftoffBailoutReason bailout_reason() const { return bailout_reason_; }
......
......@@ -791,8 +791,11 @@ class DebugInfoImpl {
(last_step_action == StepIn && stepping_frame_ != NO_ID);
}
void RemoveBreakpoint(int func_index, int offset, Isolate* current_isolate) {
void RemoveBreakpoint(int func_index, int position,
Isolate* current_isolate) {
base::MutexGuard guard(&mutex_);
const auto& function = native_module_->module()->functions[func_index];
int offset = position - function.code.offset();
std::vector<int>& breakpoints = breakpoints_per_function_[func_index];
DCHECK_LT(0, offset);
......@@ -918,7 +921,7 @@ class DebugInfoImpl {
if (frame->native_module() != new_code->native_module()) continue;
if (frame->function_index() != new_code->index()) continue;
WasmCode* old_code = frame->wasm_code();
if (!old_code->is_liftoff()) return;
if (!old_code->is_liftoff()) continue;
int pc_offset =
static_cast<int>(frame->pc() - old_code->instruction_start());
int position = frame->position();
......
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