[Bug python/23545] gdb.Type.template_argument(n) sees arguments of aliased type
tromey at sourceware dot org
sourceware-bugzilla@sourceware.org
Fri Aug 17 18:53:00 GMT 2018
https://sourceware.org/bugzilla/show_bug.cgi?id=23545
Tom Tromey <tromey at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tromey at sourceware dot org
--- Comment #1 from Tom Tromey <tromey at sourceware dot org> ---
(In reply to Steve Fink from comment #0)
> First, if I do `ptype Container`, it shows the field 'o' as having type
> "OuterType". I would have expected "OuterType<float>".
This seems to be a compiler bug.
>From the DWARF:
<1><86>: Abbrev Number: 7 (DW_TAG_typedef)
<87> DW_AT_name : (indirect string, offset: 0x80): OuterType
<8b> DW_AT_decl_file : 1
<8c> DW_AT_decl_line : 8
<8d> DW_AT_decl_column : 38
<8e> DW_AT_type : <0x2d>
This is just a plain typedef with no indication it is a template instantiation.
It's a typedef for:
<1><2d>: Abbrev Number: 2 (DW_TAG_structure_type)
<2e> DW_AT_name : (indirect string, offset: 0x5a): InnerType<int,
float>
<32> DW_AT_byte_size : 8
<33> DW_AT_decl_file : 1
<34> DW_AT_decl_line : 2
<35> DW_AT_decl_column : 10
<36> DW_AT_sibling : <0x5f>
[...]
<2><50>: Abbrev Number: 4 (DW_TAG_template_type_param)
<51> DW_AT_name : T
<53> DW_AT_type : <0x5f>
<2><57>: Abbrev Number: 4 (DW_TAG_template_type_param)
<58> DW_AT_name : U
<5a> DW_AT_type : <0x66>
... which seems reasonable.
> t.template_argument(0) gives 'int', and template_argument(1) gives 'float', which are the template arguments of InnerType, not OuterType.
template_argument strips the typedefs from t before examining it. Maybe a
questionable decision.
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the Gdb-prs
mailing list