[Lldb-commits] [lldb] [lldb] Skip the prologue before reading `this` when stepping into std::function (PR #209629)

Felipe de Azevedo Piovezan via lldb-commits lldb-commits at lists.llvm.org
Wed Jul 15 01:12:04 PDT 2026


felipepiovezan wrote:

Are you saying that this line:

```
     ValueObjectSP value_sp = frame->FindVariable(g_this);
```

Doesn't work if we are stopped at the prologue? Function arguments (also `this`) should be available at any address, including the first instruction. (assuming O0)

```
   1 │ struct Blah {
   2 │   int x;
   3 │   double d;
   4 │
   5 │   double do_something(int x) {
   6 │     return x + this->x;
   7 │   }
   8 │ };
   9 │
  10 │
  11 │ void foo() {
  12 │   Blah x{1, 2.0};
  13 │   x.do_something(10);
  14 │ }
```

We get:

```
clang++ test.cpp -g -O0 -c -o - | dwarfdump - --name do_something -c

0x00000077: DW_TAG_subprogram
              DW_AT_low_pc      (0x0000000000000034)
              DW_AT_high_pc     (0x000000000000005c)
              DW_AT_APPLE_omit_frame_ptr        (true)
              DW_AT_frame_base  (DW_OP_reg31 WSP)
              DW_AT_object_pointer      (0x00000087)
              DW_AT_specification       (0x00000055 "_ZN4Blah12do_somethingEi")

0x00000087:   DW_TAG_formal_parameter
                DW_AT_location  (DW_OP_fbreg +8)
                DW_AT_name      ("this")
                DW_AT_type      (0x0000009c "Blah *")
                DW_AT_artificial        (true)
```


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


More information about the lldb-commits mailing list