From: "Jan Vraný" <Jan.Vrany@labware.com>
To: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
"tom@tromey.com" <tom@tromey.com>
Subject: Re: [PATCH] gdb: care for dynamic objfiles in build_id_bfd_get ()
Date: Wed, 11 Jan 2023 12:50:25 +0000 [thread overview]
Message-ID: <75c26897ae68b971c31737e24aff80427b28d953.camel@labware.com> (raw)
In-Reply-To: <87eds28oiw.fsf@tromey.com>
On Tue, 2023-01-10 at 07:14 -0700, Tom Tromey wrote:
> > > > > > "Jan" == Jan Vrany via Gdb-patches <gdb-patches@sourceware.org> writes:
>
> Jan> Accessing gdb.Objfile.build_id caused GDB to crash when objfile is
> Jan> dynamic, that is created by JIT reader API. Similarly, invoking
> Jan> gdb.Symtab.fullname() caused a crash. Possibly there are other paths
> Jan> that may trigger the crash.
>
> Is there a patch already for the fullname bug?
Hmm, it's been a while I wrote that patch (when working on Python
alternative to JIT-reader API) and I believe I encountered a case
case where fullname() crashed since it (indirectly) called
build_id_bfd_get().
I tried to reproduce it now and could not, perhaps I can be reproduced
once other patches are in.
I'll remove that sentence from commit message to avoid confusion:
gdb: care for dynamic objfiles in build_id_bfd_get ()
Accessing gdb.Objfile.build_id caused GDB to crash when objfile is
dynamic, that is created by JIT reader API.
The issue was NULL-pointer dereferencing in build_id_bfd_get () because
dynamic objfiles have no underlaying BFD structure. This commit fixes
Jan
>
> Jan> + /* Dynamic objfiles such as ones created by JIT reader API
> Jan> + have no underlaying bfd structure (that is, objfile->obfd
> Jan> + is NULL). */
> Jan> + if (abfd == nullptr)
> Jan> + return NULL;
>
> Use 'nullptr' in new code. This is ok with this change.
>
> thank you,
> Tom
>
prev parent reply other threads:[~2023-01-11 12:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-09 21:19 Jan Vrany
2023-01-10 14:14 ` Tom Tromey
2023-01-11 12:50 ` Jan Vraný [this message]
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=75c26897ae68b971c31737e24aff80427b28d953.camel@labware.com \
--to=jan.vrany@labware.com \
--cc=gdb-patches@sourceware.org \
--cc=tom@tromey.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).