[llvm] [DebugInfo] Drop stale entry value-limitation for call site values (PR #172340)

David Stenberg via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 16 04:47:26 PST 2025


dstenb wrote:

> Can you please check if LLDB can parse these more complex expressions with entry values?
> 
> GDB does support it.

I built a fresh lldb from today, and tried it with the following example, and with that it seems to work fine.

```
__attribute__((noinline))
int call(int *p, int *q) {
  *p = 1; // Use of p.
  *q = 2; // Use of q.
  __asm volatile ("" : : : "rdi", "rsi"); // Clobber param regs.
  return 123; // Line 6.
}

int global[512];
int *global_p = global + 256;

__attribute__((noinline))
void entry_value (int *param) {
  call(param - 87, param + 50);
}

int main() {
  int *p = global_p;
  entry_value(p);
  return *p;
}
```

```
$ ./build/bin/clang foo.c -O1 -g
$ ./build/bin/llvm-dwarfdump a.out | grep -A3 call_site
0x0000008d:     DW_TAG_call_site
                  DW_AT_call_origin     (0x00000057 "call")
                  DW_AT_call_tail_call  (true)
                  DW_AT_call_pc (0x0000000000001161)
--
0x00000093:       DW_TAG_call_site_parameter
                    DW_AT_location      (DW_OP_reg4 RSI)
                    DW_AT_call_value    (DW_OP_entry_value(DW_OP_reg5 RDI), DW_OP_plus_uconst 0xc8)

0x0000009d:       DW_TAG_call_site_parameter
                    DW_AT_location      (DW_OP_reg5 RDI)
                    DW_AT_call_value    (DW_OP_entry_value(DW_OP_reg5 RDI), DW_OP_constu 0x15c, DW_OP_minus)

--
0x000000c2:     DW_TAG_call_site
                  DW_AT_call_origin     (0x00000079 "entry_value")
                  DW_AT_call_return_pc  (0x0000000000001180)

0x000000c8:       DW_TAG_call_site_parameter
                    DW_AT_location      (DW_OP_reg5 RDI)
                    DW_AT_call_value    (DW_OP_breg3 RBX+0)
```

```
(lldb) b 6
Breakpoint 1: where = a.out`call + 12 at foo.c:6:3, address = 0x000000000000113c
(lldb) run
Process 119204 launched: '/upstream/llvm-project/a.out' (x86_64)
Process 119204 stopped
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
    frame #0: 0x000055555555513c a.out`call(p=0x00005555555582e4, q=0x0000555555558508) at foo.c:6:3
   3      *p = 1; // Use of p.
   4      *q = 2; // Use of q.
   5      __asm volatile ("" : : : "rdi", "rsi"); // Clobber param regs.
-> 6      return 123; // Line 6.
   7    }
   8   
   9    int global[512];
(lldb) p p
(int *) 0x00005555555582e4
(lldb) p q
(int *) 0x0000555555558508
(lldb) p global + 256 - 87
(int *) 0x00005555555582e4
(lldb) p global + 256 + 50
(int *) 0x0000555555558508
```

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


More information about the llvm-commits mailing list