Sent from my iPhone
On Sep 19, 2008, at 10:58 AM, "tromey at gcc dot gnu dot org" <[EMAIL PROTECTED]
> wrote:
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'.
No it is string inside the namespace of std.
This typedef should be a sibling of a namespace. If it is, then it is
the job of the debugger to show the correct thing.
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