public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Simon Marchi via Gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH v2] gdb/dwarf: disable per-BFD resource sharing for -readnow objfiles
Date: Tue, 30 Mar 2021 10:13:42 -0600	[thread overview]
Message-ID: <87a6qkvcuh.fsf@tromey.com> (raw)
In-Reply-To: <20210330154336.1676067-1-simon.marchi@polymtl.ca> (Simon Marchi via Gdb-patches's message of "Tue, 30 Mar 2021 11:43:36 -0400")

Simon> I think the most sensible fix would be to not share a dwarf2_per_bfd
Simon> between two objfiles loaded with different methods.  That means that two
Simon> objfiles sharing the same BFD and loaded the same way would share a
Simon> dwarf2_per_bfd.  Two objfiles sharing the same BFD but loaded with
Simon> different methods would use two different dwarf2_per_bfd structures.

It seems to me that -readnow is a funny situation, because it is
intended to do something unusual.

For all other kinds of possible sharing, I think that deferring to
whatever was already done and recorded in the per-BFD object should work fine.
The idea here is just to bypass the reading step when possible.
So IMO it's fine to ignore the index cache if the psymtabs have already
been scanned -- reading from the cache won't give any benefits relative
to reusing the per-BFD object.

This seems like it would mainly be an issue for the ordering of checks
in dwarf2_initialize_objfile.  When I look there, it seems correct
already though -- the existing per-BFD is checked before trying to do
any scan or reading from the index cache.

Simon> 	* dwarf2/read.c (dwarf2_has_info): Don't share dwarf2_per_bfd
Simon> 	with objfiles using READNOW.

Thank you.  This looks good to me.  Thanks especially for the test case.

I think the ChangeLog entry should probably mention the PR though.

Tom

  reply	other threads:[~2021-03-30 16:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-15 20:03 [PATCH gdb-10-branch candidate] gdb/dwarf: disable per-BFD resource sharing Simon Marchi
2021-03-30 15:43 ` [PATCH v2] gdb/dwarf: disable per-BFD resource sharing for -readnow objfiles Simon Marchi
2021-03-30 16:13   ` Tom Tromey [this message]
2021-03-30 17:33     ` Simon Marchi
2021-03-30 19:55       ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a6qkvcuh.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).