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>
Cc: Simon Marchi <simon.marchi@efficios.com>
Subject: Re: [PATCH 4/4] gdb: remove objfile parameter from get_objfile_bfd_data
Date: Thu, 01 Apr 2021 11:52:17 -0600	[thread overview]
Message-ID: <875z15q4dq.fsf@tromey.com> (raw)
In-Reply-To: <20210322193417.2376788-5-simon.marchi@efficios.com> (Simon Marchi via Gdb-patches's message of "Mon, 22 Mar 2021 15:34:17 -0400")

>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:

Simon> But if the BFD requires relocation, get_objfile_bfd_data returns a newly
Simon> allocated object that isn't kept anywhere else (and isn't shared).  So
Simon> the objfile becomes the owner of the objfile_per_bfd_storage object.  In
Simon> objfile::~objfile, we have this:

Simon>     if (obfd)
Simon>       gdb_bfd_unref (obfd);
Simon>     else
Simon>       delete per_bfd;

Simon> I'm thinking that obfd could be non-nullptr, and it could require
Simon> relocation.  In that case, it would never be freed.  Anyway, that's not
Simon> really connected to this patch.

Yes, this seems like a bug.  Probably objfile should just have an
explicit "owns_per_bfd" boolean somewhere.

Simon> gdb/ChangeLog:

Simon> 	* objfiles.c (get_objfile_bfd_data): Remove objfile parameter,
Simon> 	adjust callers.

This looks good to me.  Thank you.

Tom

  reply	other threads:[~2021-04-01 17:52 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-22 19:34 [PATCH 0/4] Small Misc psymtabs / objfile cleanups Simon Marchi
2021-03-22 19:34 ` [PATCH 1/4] gdb: add intern method to objfile_per_bfd_storage Simon Marchi
2021-03-23 14:47   ` Christian Biesinger
2021-03-23 15:48     ` Simon Marchi
2021-03-23 15:53       ` Christian Biesinger
2021-03-23 16:08         ` Simon Marchi
2021-04-01 17:44       ` Tom Tromey
2021-04-02 15:38         ` Simon Marchi
2021-03-22 19:34 ` [PATCH 2/4] gdb: use std::string in partial_symtab::partial_symtab / allocate_symtab Simon Marchi
2021-04-01 17:43   ` Tom Tromey
2021-03-22 19:34 ` [PATCH 3/4] gdb: pass objfile_per_bfd_storage instead of objfile to partial_symtab Simon Marchi
2021-04-01 17:47   ` Tom Tromey
2021-04-02 15:42     ` Simon Marchi
2021-03-22 19:34 ` [PATCH 4/4] gdb: remove objfile parameter from get_objfile_bfd_data Simon Marchi
2021-04-01 17:52   ` Tom Tromey [this message]
2021-04-02 15:52     ` Simon Marchi

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=875z15q4dq.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@efficios.com \
    /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).