[Lldb-commits] [lldb] [lldb] Assemble scalar DW_OP_bit_piece fragments into composites (PR #219383)

via lldb-commits lldb-commits at lists.llvm.org
Mon Nov 2 00:07:38 PST 2026


================
@@ -2056,19 +2155,46 @@ llvm::Expected<Value> DWARFExpression::Evaluate(
         eval_ctx.loc_desc_kind = Memory;
         const uint64_t piece_bit_size = op->getRawOperand(0);
         const uint64_t piece_bit_offset = op->getRawOperand(1);
+        if (piece_bit_size == 0) {
+          // Each piece's location expression is evaluated independently.
+          stack.clear();
+          break;
+        }
----------------
MrEven132 wrote:

Thanks for catching this. Zero-sized bit pieces now consume their source without contributing any bits to the composite.

I used `stack.clear()` for both zero-sized and non-empty scalar bit pieces, since each piece's location expression is evaluated independently. This also discards any temporary values below the source.

Added the requested regression test with a zero-sized bit piece followed by a non-empty one, plus a test for a trailing zero-sized bit piece with extra stack entries.

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


More information about the lldb-commits mailing list