[Bug debug/54734] New: Debug info for C++ and LTO misses types
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Sep 28 10:37:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54734
Bug #: 54734
Summary: Debug info for C++ and LTO misses types
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Keywords: lto
Severity: normal
Priority: P3
Component: debug
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: rguenth@gcc.gnu.org
Consider the following reduced testcase (from standard library use):
template <class T> class basic_string;
typedef basic_string<char> sstring;
template <class T>
class basic_string
{
public:
typedef T type;
};
extern template class basic_string<char>;
int main()
{
sstring s;
return sstring::type (0);
}
without LTO we have
<1><130>: Abbrev Number: 2 (DW_TAG_typedef)
<131> DW_AT_name : (indirect string, offset: 0x98): sstring
<135> DW_AT_decl_file : 1
<136> DW_AT_decl_line : 2
<137> DW_AT_type : <0x13b>
<1><13b>: Abbrev Number: 3 (DW_TAG_class_type)
<13c> DW_AT_name : (indirect string, offset: 0xa0):
basic_string<char>
<140> DW_AT_byte_size : 1
<141> DW_AT_decl_file : 1
<142> DW_AT_decl_line : 5
<143> DW_AT_sibling : <0x15a>
<2><147>: Abbrev Number: 2 (DW_TAG_typedef)
<148> DW_AT_name : (indirect string, offset: 0x8e): type
<14c> DW_AT_decl_file : 1
<14d> DW_AT_decl_line : 8
<14e> DW_AT_type : <0x15a>
while with LTO we get only
<1><137>: Abbrev Number: 3 (DW_TAG_typedef)
<138> DW_AT_name : (indirect string, offset: 0xf8): sstring
<13c> DW_AT_decl_file : 1
<13d> DW_AT_decl_line : 11
<13e> DW_AT_type : <0x142>
<1><142>: Abbrev Number: 4 (DW_TAG_structure_type)
<143> DW_AT_name : (indirect string, offset: 0xeb): basic_string
<147> DW_AT_declaration : 1
which results from gen_struct_or_union_type_die on the type seeing
a TYPE_STUB_DECL with TYPE_DECL_SUPPRESS_DEBUG set.
Somehow the C++ frontend "manually" outputs the desired info and then for
later processing directs dwarf2out.c to not output anything?
This probably all boils down to LTO "ignoring" debug-hook calls from the
frontend, but is there a way to recover from that? For example by
clearing TYPE_DECL_SUPPRESS_DEBUG for LTO? Or is that used in "meaningful"
ways as well?
More information about the Gcc-bugs
mailing list