[Lldb-commits] [lldb] [lldb] Implement WebAssembly debugging (PR #77949)

Paolo Severini via lldb-commits lldb-commits at lists.llvm.org
Thu Feb 22 09:27:21 PST 2024


================
@@ -2595,6 +2604,37 @@ bool DWARFExpression::Evaluate(
       break;
     }
 
+    case DW_OP_WASM_location: {
+      uint8_t wasm_op = opcodes.GetU8(&offset);
+      uint32_t index;
+
+      /* LLDB doesn't have an address space to represents WebAssembly locals,
+       * globals and operand stacks.
+       * We encode these elements into virtual registers:
+       *   | tag: 2 bits | index: 30 bits |
+       *   where tag is:
+       *    0: Not a WebAssembly location
+       *    1: Local
+       *    2: Global
+       *    3: Operand stack value
----------------
paolosevMSFT wrote:

It is better to keep the tag '0' to represent normal (non-Wasm-location) registers like PC, so I would keep the values like this. But for readability we can add a static function `WasmVirtualRegisterKinds WasmVirtualRegisterInfo::VirtualRegisterKindFromDWARFLocation(DWARFWasmLocation dwarf_location)` that does this conversion from the DWARF representation into the virtual register tag.

https://github.com/llvm/llvm-project/pull/77949


More information about the lldb-commits mailing list