@@ -208,9 +208,14 @@ static void process_fqn(struct die *cache, Dwarf_Die *die)
208208 value); \
209209 }
210210
211+ DEFINE_PROCESS_UDATA_ATTRIBUTE (accessibility )
211212DEFINE_PROCESS_UDATA_ATTRIBUTE (alignment )
213+ DEFINE_PROCESS_UDATA_ATTRIBUTE (bit_size )
212214DEFINE_PROCESS_UDATA_ATTRIBUTE (byte_size )
213215DEFINE_PROCESS_UDATA_ATTRIBUTE (encoding )
216+ DEFINE_PROCESS_UDATA_ATTRIBUTE (data_bit_offset )
217+ DEFINE_PROCESS_UDATA_ATTRIBUTE (data_member_location )
218+ DEFINE_PROCESS_UDATA_ATTRIBUTE (discr_value )
214219
215220/* Match functions -- die_match_callback_t */
216221#define DEFINE_MATCH (type ) \
@@ -219,7 +224,9 @@ DEFINE_PROCESS_UDATA_ATTRIBUTE(encoding)
219224 return dwarf_tag(die) == DW_TAG_##type##_type; \
220225 }
221226
227+ DEFINE_MATCH (enumerator )
222228DEFINE_MATCH (formal_parameter )
229+ DEFINE_MATCH (member )
223230DEFINE_MATCH (subrange )
224231
225232bool match_all (Dwarf_Die * die )
@@ -298,6 +305,10 @@ static void __process_list_type(struct state *state, struct die *cache,
298305 process (cache , " " );
299306 process (cache , name );
300307 }
308+ process_accessibility_attr (cache , die );
309+ process_bit_size_attr (cache , die );
310+ process_data_bit_offset_attr (cache , die );
311+ process_data_member_location_attr (cache , die );
301312}
302313
303314#define DEFINE_PROCESS_LIST_TYPE (type ) \
@@ -308,6 +319,7 @@ static void __process_list_type(struct state *state, struct die *cache,
308319 }
309320
310321DEFINE_PROCESS_LIST_TYPE (formal_parameter )
322+ DEFINE_PROCESS_LIST_TYPE (member )
311323
312324/* Container types with DW_AT_type */
313325static void __process_type (struct state * state , struct die * cache ,
@@ -340,6 +352,7 @@ DEFINE_PROCESS_TYPE(reference)
340352DEFINE_PROCESS_TYPE (restrict )
341353DEFINE_PROCESS_TYPE (rvalue_reference )
342354DEFINE_PROCESS_TYPE (shared )
355+ DEFINE_PROCESS_TYPE (template_type_parameter )
343356DEFINE_PROCESS_TYPE (volatile )
344357DEFINE_PROCESS_TYPE (typedef )
345358
@@ -393,6 +406,107 @@ static void process_subroutine_type(struct state *state, struct die *cache,
393406 __process_subroutine_type (state , cache , die , "subroutine_type" );
394407}
395408
409+ static void process_variant_type (struct state * state , struct die * cache ,
410+ Dwarf_Die * die )
411+ {
412+ process_list_comma (state , cache );
413+ process (cache , "variant {" );
414+ process_linebreak (cache , 1 );
415+ check (process_die_container (state , cache , die , process_type ,
416+ match_member_type ));
417+ process_linebreak (cache , -1 );
418+ process (cache , "}" );
419+ process_discr_value_attr (cache , die );
420+ }
421+
422+ static void process_variant_part_type (struct state * state , struct die * cache ,
423+ Dwarf_Die * die )
424+ {
425+ process_list_comma (state , cache );
426+ process (cache , "variant_part {" );
427+ process_linebreak (cache , 1 );
428+ check (process_die_container (state , cache , die , process_type ,
429+ match_all ));
430+ process_linebreak (cache , -1 );
431+ process (cache , "}" );
432+ }
433+
434+ static int ___process_structure_type (struct state * state , struct die * cache ,
435+ Dwarf_Die * die )
436+ {
437+ switch (dwarf_tag (die )) {
438+ case DW_TAG_member :
439+ case DW_TAG_variant_part :
440+ return check (process_type (state , cache , die ));
441+ case DW_TAG_class_type :
442+ case DW_TAG_enumeration_type :
443+ case DW_TAG_structure_type :
444+ case DW_TAG_template_type_parameter :
445+ case DW_TAG_union_type :
446+ case DW_TAG_subprogram :
447+ /* Skip non-member types, including member functions */
448+ return 0 ;
449+ default :
450+ error ("unexpected structure_type child: %x" , dwarf_tag (die ));
451+ }
452+ }
453+
454+ static void __process_structure_type (struct state * state , struct die * cache ,
455+ Dwarf_Die * die , const char * type ,
456+ die_callback_t process_func ,
457+ die_match_callback_t match_func )
458+ {
459+ process (cache , type );
460+ process_fqn (cache , die );
461+ process (cache , " {" );
462+ process_linebreak (cache , 1 );
463+
464+ check (process_die_container (state , cache , die , process_func ,
465+ match_func ));
466+
467+ process_linebreak (cache , -1 );
468+ process (cache , "}" );
469+
470+ process_byte_size_attr (cache , die );
471+ process_alignment_attr (cache , die );
472+ }
473+
474+ #define DEFINE_PROCESS_STRUCTURE_TYPE (structure ) \
475+ static void process_##structure##_type( \
476+ struct state *state, struct die *cache, Dwarf_Die *die) \
477+ { \
478+ __process_structure_type(state, cache, die, \
479+ #structure "_type", \
480+ ___process_structure_type, \
481+ match_all); \
482+ }
483+
484+ DEFINE_PROCESS_STRUCTURE_TYPE (class )
485+ DEFINE_PROCESS_STRUCTURE_TYPE (structure )
486+ DEFINE_PROCESS_STRUCTURE_TYPE (union )
487+
488+ static void process_enumerator_type (struct state * state , struct die * cache ,
489+ Dwarf_Die * die )
490+ {
491+ Dwarf_Word value ;
492+
493+ process_list_comma (state , cache );
494+ process (cache , "enumerator" );
495+ process_fqn (cache , die );
496+
497+ if (get_udata_attr (die , DW_AT_const_value , & value )) {
498+ process (cache , " = " );
499+ process_fmt (cache , "%" PRIu64 , value );
500+ }
501+ }
502+
503+ static void process_enumeration_type (struct state * state , struct die * cache ,
504+ Dwarf_Die * die )
505+ {
506+ __process_structure_type (state , cache , die , "enumeration_type" ,
507+ process_type , match_enumerator_type );
508+ }
509+
396510static void process_base_type (struct state * state , struct die * cache ,
397511 Dwarf_Die * die )
398512{
@@ -403,6 +517,16 @@ static void process_base_type(struct state *state, struct die *cache,
403517 process_alignment_attr (cache , die );
404518}
405519
520+ static void process_unspecified_type (struct state * state , struct die * cache ,
521+ Dwarf_Die * die )
522+ {
523+ /*
524+ * These can be emitted for stand-alone assembly code, which means we
525+ * might run into them in vmlinux.o.
526+ */
527+ process (cache , "unspecified_type" );
528+ }
529+
406530static void process_cached (struct state * state , struct die * cache ,
407531 Dwarf_Die * die )
408532{
@@ -463,17 +587,27 @@ static int process_type(struct state *state, struct die *parent, Dwarf_Die *die)
463587 PROCESS_TYPE (rvalue_reference )
464588 PROCESS_TYPE (shared )
465589 PROCESS_TYPE (volatile )
590+ /* Container types */
591+ PROCESS_TYPE (class )
592+ PROCESS_TYPE (structure )
593+ PROCESS_TYPE (union )
594+ PROCESS_TYPE (enumeration )
466595 /* Subtypes */
596+ PROCESS_TYPE (enumerator )
467597 PROCESS_TYPE (formal_parameter )
598+ PROCESS_TYPE (member )
468599 PROCESS_TYPE (subrange )
600+ PROCESS_TYPE (template_type_parameter )
601+ PROCESS_TYPE (variant )
602+ PROCESS_TYPE (variant_part )
469603 /* Other types */
470604 PROCESS_TYPE (array )
471605 PROCESS_TYPE (base )
472606 PROCESS_TYPE (subroutine )
473607 PROCESS_TYPE (typedef )
608+ PROCESS_TYPE (unspecified )
474609 default :
475- debug ("unimplemented type : %x ", tag );
476- break ;
610+ error ("unexpected type : %x ", tag );
477611 }
478612
479613 /* Update cache state and append to the parent (if any) */
0 commit comments