Skip to content

Clang emits debug info for multiple (at least D/C1 and D/C2) dtor/ctor functions #14982

Open
@dwblaikie

Description

@dwblaikie
Bugzilla Link 14610
Version trunk
OS Linux
Blocks #14702 llvm/llvm-bugzilla-archive#24345
CC @DougGregor,@echristo

Extended Description

Reduced from the GDB 7.5 test gdb.cp/mb-ctor.cc:

#include
struct Base {
~Base() {
printf("~Base\n");
}
};

struct Derived : virtual Base {
~Derived();
};

Derived::~Derived() {
printf("~Derived\n");
}

int main() {
Derived d;
}

breaking on "Derived::~Derived()" in GDB with Clang debug info causes this program to break twice. With GCC's debug info the program only breaks once.

From the DWARF dump it looks like Clang is emitting debug info (DW_TAG_subprogram and line table entries) for both the D1 and D2 version of the function, both with a DW_AT_specification of the DW_TAG_subprogram named "~Derived". I assume this is why GDB breaks twice.

I can't quite do a direct comparison to GCC & see which function it's emitted debug info for because it seems to have inlined the dtor call, even at -O0, so I can't match it to a particular exported symbol.

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