Re: [PATCH 13/20] Change how reprocessing is done

Simon Marchi
2020-03-30T15:46:21Z

On 2020-03-28 3:22 p.m., Tom Tromey wrote:
> Currently gdb keeps a vector of attributes that require reprocessing.
> However, now that there is a reprocessing flag in the attribute, we
> can remove the vector and instead simply loop over attributes a second
> time. Normally there are not many attributes, so this should be
> reasonably cheap.

That sounds reasonable, it simplifies the code.

>
> gdb/ChangeLog
> 2020-03-28 Tom Tromey <tom@tromey.com>
>
> * dwarf2/read.c (skip_one_die): Update.
> (read_full_die_1): Change how reprocessing is done.
> (partial_die_info::read): Update.
> (read_attribute_value): Remove need_reprocess parameter.
> (read_attribute): Likewise.
> * dwarf2/attribute.h (struct attribute) <reprocessing_p>: New
> method.
> ---
> gdb/ChangeLog | 10 +++++++++
> gdb/dwarf2/attribute.h | 6 ++++++
> gdb/dwarf2/read.c | 48 +++++++++++++++++++-----------------------
> 3 files changed, 38 insertions(+), 26 deletions(-)
>
> diff --git a/gdb/dwarf2/attribute.h b/gdb/dwarf2/attribute.h
> index 972beef9825..9b387e5df05 100644
> --- a/gdb/dwarf2/attribute.h
> +++ b/gdb/dwarf2/attribute.h
> @@ -214,6 +214,12 @@ struct attribute
> requires_reprocessing = 0;
> }
>
> + /* True if this attribute requires reprocessing. */
> + bool reprocessing_p () const
> + {
> + return requires_reprocessing;
> + }

Nitpicking on names again: the method name sounds like we inquire whether
the attribute is currently reprocessing (as if it was a lengthy operation).

So I'd name it requires_reprocessing_p. Or just requires_reprocessing (I still
find those _p suffixes for predicates odd).

Simon