This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

dwarflint high-level check: suspicious presence of name


I've been noticing some instances of const_type and the like having a name
attribute.  (This comes up in the elfutils build on F-11/x86_64.)  At least
in C and C++, this is suspicious compiler behavior.  The various "modifier"
and "qualifier" sorts of DW_TAG_*_type never get their own names in C/C++
syntax.  

Only struct/class/union (DW_TAG_{structure,class,union}_type) have their
own names, or DW_TAG_base_type.  When you write "const foo" in C, it's
whatever DIE describes "foo" (sans const) that has a name, and then the
"const foo" DIE is just a <const_type type="#foo"/> with no other
attributes.  In these languages, the only way you associate a name with one
of these types is with typedef, but that is a named DW_TAG_typedef pointing
at the DIE that is const_type or whatever.

This applies to:

array_type
pointer_type
reference_type
ptr_to_member_type
const_type
volatile_type
restrict_type
rvalue_reference_type

and perhaps other *_type but I think the ones I omitted never appear in
C/C++.  I don't know the rules for other languages.  For these sorts of
high-level tests, dwarflint should be set up to categorize them by the
DW_AT_language code of the CU.  For now it is probably wisest to default
all languages to the C/C++ rules and we can hone it later after
encountering actual data for other languages.  But I'm suggesting that you
structure it as language-sensitive now, rather than just removing name from
the "expected optional" attributes for these tags generically.  I'd leave
the generic checks to match the DWARF spec reference tables, and then layer
on the more-specific per-language checks as well.

At least with gcc-4.4.1-2.fc11.x86_64 you should get a few hits for these
checks just on the elfutils build itself.


Thanks,
Roland

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]