Skip to content

llvm-symbolizer failed to get inline functions with split dwarf in dwarf 5 #62941

@ZequanWu

Description

@ZequanWu

a.cpp:

extern "C" void __attribute__((noreturn)) abort();

void bar();

__attribute__((always_inline)) void func() {
    static volatile int gv_func;
    ++gv_func;
}
__attribute__((always_inline)) void foo() {
    static volatile int gv_foo;
    ++gv_foo;
    if (gv_foo)
        abort();
    bar();
}

void bar() {
    static volatile int gv_bar;
    ++gv_bar;
    func();
}


int main() {
    foo();
    return 0;
}

commands:

$ clang++ -fuse-ld=lld a.cpp -O2 -g -gsplit-dwarf -fdebug-compilation-dir=. -o a.split
$ llvm-dwarfdump a.split
0x00000014: DW_TAG_skeleton_unit
              DW_AT_stmt_list   (0x00000000)
              DW_AT_str_offsets_base    (0x00000008)
              DW_AT_comp_dir    (".")
              DW_AT_GNU_pubnames        (true)
              DW_AT_dwo_name    ("a.split-a.dwo")
              DW_AT_low_pc      (0x0000000000001760)
              DW_AT_high_pc     (0x00000000000017d4)
              DW_AT_addr_base   (0x00000008)
$ llvm-dwarfdump a.split-a.dwo
...
0x0000003b:   DW_TAG_subprogram
                DW_AT_ranges    (indexed (0x0) rangelist = 0x00000030
                   [0x0000000000000010, 0x0000000000000032))
                DW_AT_frame_base        (DW_OP_reg7 RSP)
                DW_AT_call_all_calls    (true)
                DW_AT_abstract_origin   (0x00000093 "_Z3foov")

0x00000043:     DW_TAG_variable
                  DW_AT_name    ("gv_foo")
                  DW_AT_type    (0x00000032 "volatile int")
                  DW_AT_decl_file       (0x00)
                  DW_AT_decl_line       (10)
                  DW_AT_location        (DW_OP_addrx 0x1)

0x0000004e:     DW_TAG_inlined_subroutine
                  DW_AT_abstract_origin (0x00000085 "_Z3barv")
                  DW_AT_ranges  (indexed (0x1) rangelist = 0x00000034
                     [0x000000000000001f, 0x000000000000002b))
                  DW_AT_call_file       (0x00)
                  DW_AT_call_line       (14)
                  DW_AT_call_column     (0x05)
...
$ llvm-symbolizer --obj=a.split -a 0x177f
0x177f
foo()
./a.cpp:19:5
$ lldb a.split -o "image lookup -a 0x177f" -o "exit"
...
(lldb) image lookup -a 0x177f
      Address: a.split[0x000000000000177f] (a.split.PT_LOAD[1]..text + 271)
      Summary: a.split`foo() + 15 [inlined] bar() at a.cpp:19:5
               a.split`foo() + 15 at a.cpp:14:5
...

Expected behaviour is that it should show inlined function bar.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions