@@ -109,7 +109,8 @@ fn export_type(
109109 Some ( float_die_uid)
110110 }
111111 TypeClass :: StructureTypeClass => {
112- let structure_die_uid = match t. get_structure ( ) . unwrap ( ) . structure_type ( ) {
112+ let ty_struct = t. get_structure ( ) . unwrap ( ) ;
113+ let structure_die_uid = match ty_struct. structure_type ( ) {
113114 StructureType :: ClassStructureType => {
114115 dwarf. unit . add ( root, constants:: DW_TAG_class_type )
115116 }
@@ -122,6 +123,30 @@ fn export_type(
122123 } ;
123124 defined_types. push ( ( t. to_owned ( ) , structure_die_uid) ) ;
124125
126+ for base_struct in ty_struct. base_structures ( ) {
127+ let inheritance_uid = dwarf. unit . add ( structure_die_uid, gimli:: DW_TAG_inheritance ) ;
128+ let base_struct_uid = export_type (
129+ base_struct. ty . name ( ) . to_string ( ) ,
130+ base_struct. ty . target ( bv) . unwrap ( ) . as_ref ( ) ,
131+ bv,
132+ defined_types,
133+ dwarf,
134+ )
135+ . unwrap ( ) ;
136+ dwarf
137+ . unit
138+ . get_mut ( inheritance_uid)
139+ . set ( gimli:: DW_AT_type , AttributeValue :: UnitRef ( base_struct_uid) ) ;
140+ dwarf. unit . get_mut ( inheritance_uid) . set (
141+ gimli:: DW_AT_data_member_location ,
142+ AttributeValue :: Data8 ( base_struct. offset ) ,
143+ ) ;
144+ dwarf. unit . get_mut ( inheritance_uid) . set (
145+ gimli:: DW_AT_accessibility ,
146+ AttributeValue :: Accessibility ( gimli:: DW_ACCESS_public ) ,
147+ ) ;
148+ }
149+
125150 dwarf. unit . get_mut ( structure_die_uid) . set (
126151 gimli:: DW_AT_name ,
127152 AttributeValue :: String ( name. as_bytes ( ) . to_vec ( ) ) ,
@@ -131,7 +156,7 @@ fn export_type(
131156 AttributeValue :: Data2 ( t. width ( ) as u16 ) ,
132157 ) ;
133158
134- for struct_member in t . get_structure ( ) . unwrap ( ) . members ( ) {
159+ for struct_member in ty_struct . members ( ) {
135160 let struct_member_die_uid =
136161 dwarf. unit . add ( structure_die_uid, constants:: DW_TAG_member ) ;
137162 dwarf. unit . get_mut ( struct_member_die_uid) . set (
0 commit comments