Browse Source

+ generate DWARF debug info for WebAssembly locals

Nikolay Nikolov 1 year ago
parent
commit
fbcd90f286
1 changed files with 9 additions and 0 deletions
  1. 9 0
      compiler/dbgdwarf.pas

+ 9 - 0
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);