[PATCH] D75036: [DebugInfo] Describe call site values for chains of expression producing instrs

David Stenberg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 25 06:39:35 PST 2020


dstenb marked 2 inline comments as done.
dstenb added inline comments.


================
Comment at: llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-expr-chain.mir:116
+# CHECK-NEXT: DW_AT_location (DW_OP_reg2 W2)
+# CHECK-NEXT: DW_AT_GNU_call_site_value (DW_OP_breg19 W19+700, DW_OP_plus_uconst 0x9, DW_OP_plus_uconst 0x50)
+
----------------
djtodoro wrote:
> Have you tried debugging this with GDB/LLDB? I'm wondering if debuggers are missing the support for that.
> 
> These expressions seems valid to me, but I'm not sure even GCC generate call values with "combined" expressions so far.
I unfortunately don't have an AArch64 setup I can run GDB on, so I have mostly been testing on our downstream target.

I now also tried this on x86-64 by using the following C code:

```
extern int call(int);

int foo = 1000;

int main() {
  int local = foo + 789;
  call(local);
  return local;
}
```

in which I changed the parameter setup code to the following (and described `ADD32ri` in `isAddImmediate()`):

```
    renamable $ebx = MOV32rm $rip, 1, $noreg, @foo, $noreg, debug-location !25 :: (dereferenceable load 4 from @foo, !tbaa !21)
    $edi = MOV32rr $ebx                                                                                                                                                                                                                                                                                                        
    renamable $edi = ADD32ri $edi, 700, implicit-def $eflags
    renamable $edi = ADD32ri $edi, 80, implicit-def $eflags
    renamable $edi = ADD32ri $edi, 9, implicit-def $eflags
```

resulting in the following expression:

```
                    DW_AT_location      (DW_OP_reg5 RDI)
                    DW_AT_GNU_call_site_value   (DW_OP_breg3 RBX+700, DW_OP_constu 0xffffffff, DW_OP_and, DW_OP_plus_uconst 0x50, DW_OP_plus_uconst 0x9)
```

which prints fine in LLDB trunk:

```
   3   	int call(int param) {
   4   	  side_effect = param;
   5   	  __asm volatile("" : : : "rdi"); // clobber register.
-> 6   	  return 0; // print param here.
   7   	}
(lldb) print param
(int) $0 = 1789
```

and GDB 8.2.1:

```
(gdb) bt
#0  call (param=param at entry=1789) at call.c:6
#1  0x000000000020110a in main () at main.c:7
```


================
Comment at: llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-expr-entry-value.mir:31
+
+  attributes #0 = { nounwind "disable-tail-calls"="false" "frame-pointer"="non-leaf" }
+  attributes #2 = { nounwind readnone speculatable willreturn }
----------------
djtodoro wrote:
> Can we delete these?
Ah, yes! I'll remove those.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D75036/new/

https://reviews.llvm.org/D75036





More information about the llvm-commits mailing list