Commit 1a82a10b authored by Clemens Backes's avatar Clemens Backes Committed by Commit Bot

[wasm][debug] Pass pointer for detected features

We currently hit a nullptr access when trying to update the detected
feature set. Instead of adding a check for nullptr there (which would be
unnecessary overhead in production code), we just pass a pointer when
compiling for debugging.

R=thibaudm@chromium.org

Bug: chromium:1092408
Change-Id: I7804edc3f67237bbf28d0ed2f5c58339d3a0f8f7
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2238080Reviewed-by: 's avatarThibaud Michaud <thibaudm@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68335}
parent d8a8612e
......@@ -415,9 +415,11 @@ class DebugInfoImpl {
ForDebugging for_debugging =
offsets.size() == 1 && offsets[0] == 0 ? kForStepping : kForDebugging;
Counters* counters = nullptr;
WasmFeatures unused_detected;
WasmCompilationResult result = ExecuteLiftoffCompilation(
native_module_->engine()->allocator(), &env, body, func_index,
for_debugging, nullptr, nullptr, offsets, &debug_sidetable,
for_debugging, counters, &unused_detected, offsets, &debug_sidetable,
extra_source_positions);
// Liftoff compilation failure is a FATAL error. We rely on complete Liftoff
// support for debugging.
......
......@@ -541,6 +541,39 @@ WASM_COMPILED_EXEC_TEST(WasmRemoveAllBreakPoint) {
CHECK_EQ(14, GetIntReturnValue(retval));
}
WASM_COMPILED_EXEC_TEST(WasmBreakInPostMVP) {
// This test checks that we don't fail if experimental / post-MVP opcodes are
// being used. There was a bug where we were trying to update the "detected"
// features set, but we were passing a nullptr when compiling with
// breakpoints.
EXPERIMENTAL_FLAG_SCOPE(mv);
WasmRunner<int> runner(execution_tier);
Isolate* isolate = runner.main_isolate();
// [] -> [i32, i32]
ValueType sig_types[] = {kWasmI32, kWasmI32};
FunctionSig sig{2, 0, sig_types};
uint8_t sig_idx = runner.builder().AddSignature(&sig);
constexpr int kReturn = 13;
constexpr int kIgnored = 23;
BUILD(runner,
WASM_BLOCK_X(sig_idx, WASM_I32V_1(kReturn), WASM_I32V_1(kIgnored)),
WASM_DROP);
Handle<JSFunction> main_fun_wrapper =
runner.builder().WrapCode(runner.function_index());
SetBreakpoint(&runner, runner.function_index(), 3, 3);
BreakHandler count_breaks(isolate, {{3, BreakHandler::Continue}});
Handle<Object> global(isolate->context().global_object(), isolate);
MaybeHandle<Object> retval =
Execution::Call(isolate, main_fun_wrapper, global, 0, nullptr);
CHECK_EQ(kReturn, GetIntReturnValue(retval));
}
} // namespace wasm
} // namespace internal
} // namespace v8
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