llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.05k stars 11.98k forks source link

Debug info for anonymous structs with linkage names #15134

Open dwblaikie opened 11 years ago

dwblaikie commented 11 years ago
Bugzilla Link 14762
Version unspecified
OS All
Blocks llvm/llvm-project#14702 llvm/llvm-bugzilla-archive#24345
CC @DougGregor

Extended Description

The debug info for types such as:

typedef struct { foo f; } bar;

in Clang does not include the name 'bar' in any of the debug info for the anonymous struct. GCC includes the MIPS_linkage_name for the anonymous struct as '3bar' as well as emitting the DW_AT_name of the ctor and dtor as "bar" and "~bar" respectively.

The latter (emitting the name of the ctor and dtor as bar/~bar) seems to be a bug ( http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47510 ) & instead should just be emitted as the linkage name, possibly (though I don't know if that'll resolve the test case).

This was found in the GDB 7.5 test suite (gdb.cp/anon-struct.exp).

llvmbot commented 2 years ago

mentioned in issue llvm/llvm-bugzilla-archive#24345

dwblaikie commented 11 years ago

Interestingly, when trying to "ptype bar::bar" (which should print the type of the default ctor - try this with a normal named type to see the comparison) GDB prints out:

Invalid anonymous type foo [in module /home/blaikie/Development/scratch/a.out], GCC PR debug/47510 bug?

I'm not sure just how "invalid" this is - whether that is just referring to the lack of a linkage name, or some other kind of invalidity we should be aware of/fixing.

dwblaikie commented 11 years ago

assigned to @dwblaikie

llvmbot commented 1 year ago

@llvm/issue-subscribers-debuginfo

Author: David Blaikie (dwblaikie)

| | | | --- | --- | | Bugzilla Link | [14762](https://llvm.org/bz14762) | | Version | unspecified | | OS | All | | Blocks | llvm/llvm-project#14702 llvm/llvm-bugzilla-archive#24345 | | CC | @DougGregor | ## Extended Description The debug info for types such as: typedef struct { foo f; } bar; in Clang does not include the name 'bar' in any of the debug info for the anonymous struct. GCC includes the MIPS_linkage_name for the anonymous struct as '3bar' as well as emitting the DW_AT_name of the ctor and dtor as "bar" and "~bar" respectively. The latter (emitting the name of the ctor and dtor as bar/~bar) seems to be a bug ( http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47510 ) & instead should just be emitted as the linkage name, possibly (though I don't know if that'll resolve the test case). This was found in the GDB 7.5 test suite (gdb.cp/anon-struct.exp).