This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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: [RFA] symtab/11942: rewrite dwarf2read.c type_hash usage


On Mon, Aug 23, 2010 at 5:03 PM, Doug Evans <dje@google.com> wrote:
> Hi.
>
> This patch does two things.
> First, it fixes PR 11942. ?Second it does so in a way that improves
> the type_hash usage in dwarf2read.c.
>
> Since this is a significant change to the use of the type hashing
> in dwarf2read.c, I'd like another set of eyes to review it. ?Thanks.
>
> The basic idea here is that instead of having one type_hash per CU,
> we have one type_hash for dies from .debug_info and have another type_hash
> for dies from .debug_types. ?Types are hashed based on the associated
> die's offset and are not freed when a CUs dwarf2_cu structure is freed,
> thus I can't see a need for one type_hash per CU.
> Plus, when looking up a type for a given die, gdb first reads in the
> die at the given offset and then looks up the type for the die at that
> offset. ?Since we hash types based on die offsets, I can't see a reason
> why we don't just lookup the type for the die at the given offset first,
> and only if that fails read in the die (this is useful, e.g., when
> dies have been flushed because the CU has reached max-cache-age).
>
> Regression tested on amd64-linux (with a gcc that understands -gdwarf-4).
>
> Ok to check in?

Apologies for the follow-up.
Further testing revealed I messed up signatured type lookups in
lookup_die_type (old code that didn't get revisited in my final review
before submission).
Here's a new patch.

[for reference sake, I'd rather use a different name for the function
read_die_type, e.g. lookup_or_read_die_type, or some such.  I can make
that change if desired.]

2010-08-23  Doug Evans  <dje@google.com>

        PR symtab/11942
        * dwarf2read.c (dwarf2_per_objfile): New members debug_info_type_hash,
        debug_types_type_hash.
        (dwarf2_cu, dwarf2_per_cu_data): Delete member type_hash.
        All uses updated.
        (lookup_die_type): Renamed from tag_type_to_tag.  First look in
        appropriate type_hash table.  All callers updated.
        (allocate_signatured_type_table): Renamed from
        allocate_signatured_type_hash_table.  All callers updated.
        (create_signatured_type_table_from_index): Renamed from
        create_signatured_type_hash_from_index.  All callers updated.
        (read_die_type): Add comment.  Move actual reading to ...
        (read_die_type_1): ... here.  New function.
        (follow_die_ref_or_sig): Tweak comment.
        (set_die_type): Rewrite to use appropriate choice of
        debug_info_type_hash or debug_types_type_hash.
        (get_die_type_at_offset): New function.
        (get_die_type): Call it.

        testsuite/
        PR symtab/11942
        * gdb.dwarf2/dw4-sig-types.cc: New file.
        * gdb.dwarf2/dw4-sig-types.h: New file.
        * gdb.dwarf2/dw4-sig-types-b.cc: New file.
        * gdb.dwarf2/dw4-sig-types.exp: New file.

Attachment: gdb-100823-11942-2.patch.txt
Description: Text document


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