Skip to content

Commit 8385bea

Browse files
authored
Adjust hints about using WASMTIME_BACKTRACE_DETAILS (#10498)
This commit updates some infrastructure to hint that `WASMTIME_BACKTRACE_DETAILS` can be used to show more detail in backtraces. Notably this warning is suppressed if `feature = "std"` is turned off or if `feature = "addr2line"` is turned off since both are required.
1 parent b152712 commit 8385bea

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

crates/wasmtime/src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,9 +491,9 @@ impl Config {
491491
WasmBacktraceDetails::Enable => Some(true),
492492
WasmBacktraceDetails::Disable => Some(false),
493493
WasmBacktraceDetails::Environment => {
494-
self.wasm_backtrace_details_env_used = true;
495494
#[cfg(feature = "std")]
496495
{
496+
self.wasm_backtrace_details_env_used = true;
497497
std::env::var("WASMTIME_BACKTRACE_DETAILS")
498498
.map(|s| Some(s == "1"))
499499
.unwrap_or(Some(false))

crates/wasmtime/src/runtime/trap.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,10 @@ impl WasmBacktrace {
323323
// `Display` to indicate that more detailed information
324324
// in a trap may be available.
325325
let has_unparsed_debuginfo = module.compiled_module().has_unparsed_debuginfo();
326-
if has_unparsed_debuginfo && wasm_backtrace_details_env_used {
326+
if has_unparsed_debuginfo
327+
&& wasm_backtrace_details_env_used
328+
&& cfg!(feature = "addr2line")
329+
{
327330
hint_wasm_backtrace_details_env = true;
328331
}
329332
}

0 commit comments

Comments
 (0)