HomePhabricator

[lldb] Fix DW_TAG_GNU_call_site-DW_AT_low_pc as produced by GCC

Authored by jankratochvil on Jun 9 2020, 4:41 AM.

Description

[lldb] Fix DW_TAG_GNU_call_site-DW_AT_low_pc as produced by GCC

D80519 https://reviews.llvm.org/D80519
added support for DW_TAG_GNU_call_site but
Bug 45886 https://bugs.llvm.org/show_bug.cgi?id=45886
found one case did not work.

There is:

0x000000b1:     DW_TAG_GNU_call_site
                  DW_AT_low_pc  (0x000000000040111e)
                  DW_AT_abstract_origin (0x000000cc "a")
...
0x000000cc:   DW_TAG_subprogram
                DW_AT_name      ("a")
                DW_AT_prototyped        (true)
                DW_AT_low_pc    (0x0000000000401109)
                ^^^^^^^^^^^^ - here it did overwrite the 'low_pc' variable containing value 0x40111e we wanted
                DW_AT_high_pc   (0x0000000000401114)
                DW_AT_frame_base        (DW_OP_call_frame_cfa)
                DW_AT_GNU_all_call_sites        (true)

DW_TAG_GNU_call_site attributes order as produced by GCC:
0x000000b1: DW_TAG_GNU_call_site

DW_AT_low_pc  (0x000000000040111e)
DW_AT_abstract_origin (0x000000cc "a")

clang produces the attributes in opposite order:
0x00000064: DW_TAG_GNU_call_site

DW_AT_abstract_origin (0x0000002a "a")
DW_AT_low_pc  (0x0000000000401146)

Differential Revision: https://reviews.llvm.org/D81334