From fbcd90f2860903ed0bd7fcac0fe51f7202156a14 Mon Sep 17 00:00:00 2001 From: Nikolay Nikolov Date: Mon, 8 Jan 2024 01:18:06 +0200 Subject: [PATCH] + generate DWARF debug info for WebAssembly locals --- compiler/dbgdwarf.pas | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/compiler/dbgdwarf.pas b/compiler/dbgdwarf.pas index 4d4bbfb530..2e64b3371f 100644 --- a/compiler/dbgdwarf.pas +++ b/compiler/dbgdwarf.pas @@ -2422,6 +2422,15 @@ implementation templist.concat(tai_const.create_sleb128bit(sym.localloc.reference.offset+offset)); blocksize:=1+Lengthsleb128(sym.localloc.reference.offset+offset); end +{$ifdef wasm} + else if sym.localloc.reference.base=NR_LOCAL_STACK_POINTER_REG then + begin + templist.concat(tai_const.create_8bit(ord(DW_OP_WASM_location))); + templist.concat(tai_const.create_8bit(0)); { 0 = WebAssembly Local } + templist.concat(tai_const.create_uleb128bit(sym.localloc.reference.offset+offset)); + blocksize:=2+Lengthuleb128(sym.localloc.reference.offset+offset); + end +{$endif wasm} else begin dreg:=dwarf_reg(sym.localloc.reference.base);