From: Tom Tromey <tom@tromey.com>
To: Andrew Burgess <andrew.burgess@embecosm.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] gdb: Reinitialize objfile::section_offsets during objfile reload
Date: Sun, 26 Jan 2020 16:33:00 -0000 [thread overview]
Message-ID: <875zgy6vo5.fsf@tromey.com> (raw)
In-Reply-To: <20200125225555.16846-1-andrew.burgess@embecosm.com> (Andrew Burgess's message of "Sat, 25 Jan 2020 22:55:55 +0000")
>>>>> "Andrew" == Andrew Burgess <andrew.burgess@embecosm.com> writes:
Andrew> When building and testing with '-D_GLIBCXX_DEBUG=1' I noticed that the
Andrew> test gdb.base/reload.exp was failing. This turns out to be because
Andrew> the objfile::section_offsets vector is not reinitialilzed during the
Andrew> objfile reload process, and in this particular test, GDB ends up
Andrew> indexing outside the bounds of the vector.
Thanks for catching this.
Andrew> One thing I did wonder about while looking at this fix is whether it
Andrew> would be possible to combine at least parts of syms_from_objfile_1
Andrew> with the core of reread_symbols. I did have a go at doing this but
Andrew> gave up in the end due to the subtle differences between the two.
Andrew> Still, I think that with some more effort this might be possible, and
Andrew> this could be a nice clean up.
A long time ago, Jan had a patch along these lines.
I believe what his did was just throw away the logic in reread_symbols
in favor of simply creating a new objfile. I wonder if it's too late to
do this now, since objfiles are exposed to Python.
Anyway, IMO, if there are subtle differences, they are probably bugs of
some sort; and unifying these code paths seems like clearly the right
thing to do.
Andrew> + /* In syms_from_objfile_1 after calling objfile_set_sym_fns we
Andrew> + handle the possibility that objfile->sf might be NULL, which
Andrew> + can happen for some obscure objfile formats. We've never
Andrew> + handled the NULL case here before, but */
This looks like it got cut off.
Andrew> + /* Setup the section offsets structure for this objfile. We use
Andrew> + zero section address information here, though it's not clear
Andrew> + this will always be correct. If the user originally loaded
Andrew> + this objfile with non-zero address information then we're
Andrew> + going to loose that here. */
s/loose/lose/
I don't know what else would make sense in this case.
Warn the user?
The patch seems otherwise reasonable to me.
Tom
next prev parent reply other threads:[~2020-01-26 16:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-26 11:31 Andrew Burgess
2020-01-26 16:33 ` Tom Tromey [this message]
2020-01-26 21:51 ` Tom Tromey
2020-01-27 20:32 ` Pedro Alves
2020-01-27 19:07 ` Pedro Alves
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=875zgy6vo5.fsf@tromey.com \
--to=tom@tromey.com \
--cc=andrew.burgess@embecosm.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