[lldb-dev] [Bug 45653] New: DWP_OP(_GNU)_entry_value not used correctly to display clobbered parameter value (in dwarf4 and dwarf5)

via lldb-dev lldb-dev at lists.llvm.org
Thu Apr 23 15:37:32 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=45653

            Bug ID: 45653
           Summary: DWP_OP(_GNU)_entry_value not used correctly to display
                    clobbered parameter value (in dwarf4 and dwarf5)
           Product: lldb
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: All Bugs
          Assignee: lldb-dev at lists.llvm.org
          Reporter: tbosch1009 at gmail.com
                CC: jdevlieghere at apple.com, llvm-bugs at lists.llvm.org

The code below when compiled with -O3 produces DW_TAG_GNU_call_site +
DW_OP_GNU_entry_value (dwarf4) / DW_TAG_call_site  + DW_OP_entry_value (dwarf5)
debug information. LLDB should use that to show the parameter value even when
the corresponding register was clobbered.

However, this doesn't work neither in dwarf4 nor dwarf5:
- In dwarf4, lldb does show a value for the parameter, but shows the clobbered
value.
- In dwarf5, lldb claims the parameter value as "<unavailable>"

Code
----

__attribute__((noinline))
int fn1 (int z) {
      int l = z * z;
      return l + 1;
}

int main(void) {
      return fn1(2);
}


DWARF4 (clang -O3 -g)
---

0x0000002a:   DW_TAG_subprogram
                DW_AT_name      ("fn1")

0x00000047:     DW_TAG_formal_parameter
                  DW_AT_location        (0x00000000:
                     [0x0000000000401110, 0x0000000000401113): DW_OP_reg5 RDI
                     [0x0000000000401113, 0x0000000000401117):
DW_OP_GNU_entry_value(DW_OP_reg5 RDI), DW_OP_stack_value)
                  DW_AT_name    ("z")

0x00000066:   DW_TAG_subprogram
                DW_AT_name      ("main")

0x0000007f:     DW_TAG_GNU_call_site

0x0000008c:       DW_TAG_GNU_call_site_parameter
                    DW_AT_location      (DW_OP_reg5 RDI)
                    DW_AT_GNU_call_site_value   (DW_OP_lit2)

Process 55759 stopped
* thread #1, name = 'test_llvm', stop reason = step in
    frame #0: 0x0000000000401113 test_llvm`fn1(z=4) at test.cc:4:16
   1    __attribute__((noinline))
   2    int fn1 (int z) {
   3          int l = z * z;
-> 4          return l + 1;
   5    }
   6
   7    int main(void) {


DWARF5 (clang -O3 -gdwarf-5)
----

0x00000027:   DW_TAG_subprogram
                DW_AT_name      ("fn1")

0x00000037:     DW_TAG_formal_parameter
                  DW_AT_location        (indexed (0x0) loclist = 0x00000014:
                     [0x0000000000401110, 0x0000000000401113): DW_OP_reg5 RDI
                     [0x0000000000401113, 0x0000000000401117):
DW_OP_entry_value(DW_OP_reg5 RDI), DW_OP_stack_value)
                  DW_AT_name    ("z")

0x0000004a:   DW_TAG_subprogram
                DW_AT_name      ("main")

0x00000059:     DW_TAG_call_site

0x0000005f:       DW_TAG_call_site_parameter
                    DW_AT_location      (DW_OP_reg5 RDI)
                    DW_AT_call_value    (DW_OP_lit2)

Process 50149 stopped
* thread #1, name = 'test_llvm', stop reason = step in
    frame #0: 0x0000000000401113 test_llvm`fn1(z=<unavailable>) at test.cc:4:16
   1    __attribute__((noinline))
   2    int fn1 (int z) {
   3          int l = z * z;
-> 4          return l + 1;
   5    }
   6
   7    int main(void) {

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20200423/7ae1172e/attachment.html>


More information about the lldb-dev mailing list