[Lldb-commits] [lldb] [lldb] Skip local variable declarations at start of Wasm function (PR #190093)
David Spickett via lldb-commits
lldb-commits at lists.llvm.org
Thu Apr 2 01:45:22 PDT 2026
================
@@ -1355,6 +1355,25 @@ size_t Disassembler::AppendInstructions(Target &target, Address start,
start = ResolveAddress(target, start);
+ // WebAssembly functions begin with local variable declarations that are part
+ // of the binary format but are not executable instructions. Skip past them
+ // so the disassembler doesn't try to decode non-instruction bytes.
+ if (m_arch.GetTriple().getArch() == llvm::Triple::wasm32 ||
+ m_arch.GetTriple().getArch() == llvm::Triple::wasm64) {
+ if (ModuleSP module_sp = start.GetModule()) {
+ SymbolContext sc;
+ module_sp->ResolveSymbolContextForAddress(start, eSymbolContextSymbol,
+ sc);
+ if (sc.symbol && sc.symbol->GetAddress() == start) {
+ if (uint32_t skip = sc.symbol->GetPrologueByteSize()) {
+ start.Slide(skip);
+ if (limit.kind == Limit::Bytes && limit.value > skip)
+ limit.value -= skip;
----------------
DavidSpickett wrote:
Comment the intent here. I'm struggling to work out whether you:
* Do not count the skipped bytes towards the limit
* Do count the skipped bytes towards the limit
Or something else involving offsetting the limit now and letting the existing code below deal with it.
https://github.com/llvm/llvm-project/pull/190093
More information about the lldb-commits
mailing list