This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/37590] New: g++ should emit different debug info for variable's type
- From: "tromey at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 19 Sep 2008 17:58:53 -0000
- Subject: [Bug c++/37590] New: g++ should emit different debug info for variable's type
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Consider this code:
#include <string>
std::string s;
I compiled this with -g and examined the resulting dwarf.
's' is represented as:
<1><24e8>: Abbrev Number: 63 (DW_TAG_variable)
<24e9> DW_AT_name : s
<24eb> DW_AT_decl_file : 1
<24ec> DW_AT_decl_line : 3
<24ed> DW_AT_type : <24dd>
<24f1> DW_AT_external : 1
<24f2> DW_AT_location : 5 byte block: 3 0 0 0 0 (DW_OP_addr: 0)
The type of s is:
<1><24dd>: Abbrev Number: 3 (DW_TAG_typedef)
<24de> DW_AT_name : (indirect string, offset: 0xf4e): string
<24e2> DW_AT_decl_file : 17
<24e3> DW_AT_decl_line : 61
<24e4> DW_AT_type : <f51>
However, the declared type is not 'string', it is 'std::string'.
I think it would be better to always emit the declared type
as it appears in the source. That way, "whatis s" in gdb will give an
answer which is expected by the user, and which is a valid type name
at the point of declaration.
--
Summary: g++ should emit different debug info for variable's type
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: tromey at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37590