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]

Re: dwarflint versus linkage_name attributes


Mark Wielaard <mjw@redhat.com> writes:

> +  class check_linkage_external_die
> +    : public highlevel_check<check_linkage_external_die>

Hi there,

just a plug about writing future high-level checks.

As of last week, it's possible to use a different scheme for writing
high-level checks.  There's a new pass called check_die_tree, which uses
all_dies_iterator<dwarf> to loop through the dwarf file.  It doesn't do
any checking itself, instead on each DIE, it dispatches to a suite of
per-DIE checks.

These per-DIE checks are registered and written in a manner similar to
normal "full-fledged" checks, they are listed in --list-checks as usual,
can be scheduled with --check=blah as usual, can have options attached
to them, etc.  You can look at how check_duplicate_DW_tag_variable is
now written.

Note that since the per-DIE check gets the all_dies_iterator as an
argument, it's also easy to get hands on parental DIEs all they way up
to the CU DIE, and since requesting children is straightforward already,
making any sort of context-sensitive checks should be easy.  (Though
using some sort of graph language would be easier still.)

The per-DIE check is instantiated when check_die_tree is run, and
destroyed afterwards, so the lifetime of the per-DIE check is the same
as the lifetime of the file that is being checked.  So you can generally
do any sort of bookkeeping using instance variables.

It might still be necessary to write normal full-featured test, e.g. if
we need to iterate DIEs differently (e.g. we are chasing references), or
there's a lot of or complex book-keeping, or if what needs to be checked
is something else that the DIE tree.  So full-featured tests are not
going away.

PM

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