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] Default to 16 dups


Mark Wielaard <mjw@redhat.com> writes:

> Since we still have a lot of warnings/errors by default and most of them
> are duplicated a lot of times for larger object it makes sense to me to
> default the printing of duplicate messages to something like 16. The
> attached patch does this. Do you think this is a good idea?

Yes.  I don't like the threshold message very much (I'd like it to be
printed _after_ the message in question, but that's not easily done with
C++ streams), but it's not that bad, and the feature is useful.

Note that there are a couple things one needs to do to support the
duplication filtering.

The message counting is keyed by the address of the first string sent to
the stream and counted.  That means that non-unique strings that are
merged by GCC are not considered separate messages, and that dynamically
generated strings are not filtered at all.  This can be mended by
stating the key explicitly like so:

    wr_message (wh, mc_error).id (msgid) << "blah" //...

There's currently no standard way to obtain msgids.  It's simply a void*
as of now.  I'm using check descriptor in a couple places as the id,
with the downside that all messages in one check get one counter.  I
guess "this" might be used, or instance variable addresses, etc., but
really it's all a bit too ad-hoc at the moment.  Eventually, I hope to
have some sort of assignment of message IDs akin to how command line
options are handled now.

Another thing, when several messages are related, we want them to be
filtered consistently.  There's a bit of code in there to support this:

    bool shown = false;
    wr_message (wh, mc_error).id (descriptor (), shown)
      << "attribute `" << dwarf::attributes::name ((*at).first) //...
    // this can repeat a couple times, e.g. in a loop
    wr_message (wh_parent, mc_error).when (shown)
      << "in this context: " << cov::format_ranges (cov) // ...

The "shown" flag is set to true when the message is displayed and is
untouched otherwise, so it can later be used to decide whether the final
context message should be printed or not.

In DIE checks, one might use this to throw check_base::unscheduled to
turn off the check when the sole message is not displayed anymore, but I
don't think that's too important.

Hope this all makes some sort of sense.

Thanks,
PM

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