http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57006
Bug #: 57006 Summary: extend DWARF to indicate types coming from template parameters Classification: Unclassified Product: gcc Version: unknown Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: debug AssignedTo: unassig...@gcc.gnu.org ReportedBy: tro...@gcc.gnu.org Consider this source: template<typename T> struct Q { T field1; int field2; }; Q<int> q; If I compile it I see DWARF like this for the fields: <2><29>: Abbrev Number: 3 (DW_TAG_member) <2a> DW_AT_name : (indirect string, offset: 0x0): field1 <2e> DW_AT_decl_file : 1 <2f> DW_AT_decl_line : 4 <30> DW_AT_type : <0x49> <34> DW_AT_data_member_location: 0 <2><35>: Abbrev Number: 3 (DW_TAG_member) <36> DW_AT_name : (indirect string, offset: 0x7): field2 <3a> DW_AT_decl_file : 1 <3b> DW_AT_decl_line : 5 <3c> DW_AT_type : <0x49> <40> DW_AT_data_member_location: 4 That is, they have the same type. It would be nice if there were a way to differentiate these two types. This would make type pretty-printing in gdb give better output. (It isn't important in a trivial case like this, but I think it is more important in complicated real-world code.) One idea I had was to have the DW_AT_type of "field1" point to the DW_TAG_template_type_param field. This would be a small extension to DWARF, not requiring any new tags or attributes.