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

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Tue Feb 20 22:11:15 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
----------------
clayborg wrote:

I see `WasmVirtualRegisterKinds` below, but we seem to be adjusting the values all around the code for some reason by adding 1 or subtracting 1. I would suggest to define this enum correct and never adjust the values all throughout the code. Make `WasmVirtualRegisterKinds` have the correct values in the enum definition and just use these enums everywhere without adjusting?


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


More information about the lldb-commits mailing list