[Lldb-commits] [lldb] [lldb] Fix crash when evaluating expressions in Wasm targets (PR #192893)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Sun Apr 19 21:30:58 PDT 2026


https://github.com/JDevlieghere created https://github.com/llvm/llvm-project/pull/192893

LLDB crashes with "LLVM ERROR: Incompatible object format!" when evaluating expressions while debugging WebAssembly because ProcessWasm never disables JIT. RuntimeDyld only supports ELF, MachO, and COFF object formats, so attempting to JIT-compile an expression for a Wasm target produces the aforementioned fatal error.

This PR avoids the crash by calling `SetCanJIT(false)` in the `ProcessWasm` ctor. Simple expressions will still work via the IR interpreter, while expression requiring the JIT now show a proper error message instead of crashing.

Fixes #179915

>From 3bb944ae8c5e3b7f87d106b8a9b2751650038b60 Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere <jonas at devlieghere.com>
Date: Sun, 19 Apr 2026 21:24:40 -0700
Subject: [PATCH] [lldb] Fix crash when evaluating expressions in Wasm targets

LLDB crashes with "LLVM ERROR: Incompatible object format!" when
evaluating expressions while debugging WebAssembly because ProcessWasm
never disables JIT. RuntimeDyld only supports ELF, MachO, and COFF
object formats, so attempting to JIT-compile an expression for a Wasm
target hits a fatal error.

This PR avoids the crash by calling SetCanJIT(false) in the ProcessWasm
constructor. Simple expressions will still work via the IR interpreter,
while expression requiring the JIT now show a proper error message.

Fixes #179915
---
 lldb/source/Plugins/Process/wasm/ProcessWasm.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lldb/source/Plugins/Process/wasm/ProcessWasm.cpp b/lldb/source/Plugins/Process/wasm/ProcessWasm.cpp
index 02eb0da5632c6..b378a772b324f 100644
--- a/lldb/source/Plugins/Process/wasm/ProcessWasm.cpp
+++ b/lldb/source/Plugins/Process/wasm/ProcessWasm.cpp
@@ -28,6 +28,9 @@ ProcessWasm::ProcessWasm(lldb::TargetSP target_sp, ListenerSP listener_sp)
   // Wasm doesn't have any Unix-like signals as a platform concept, but pretend
   // like it does to appease LLDB.
   m_unix_signals_sp = UnixSignals::Create(target_sp->GetArchitecture());
+  // FIXME: LLVM's RuntimeDyld doesn't support the Wasm object format, so we
+  // can't JIT expressions for this target.
+  SetCanJIT(false);
 }
 
 void ProcessWasm::Initialize() {



More information about the lldb-commits mailing list