From: Bruno Larsen <blarsen@redhat.com>
To: Tom Tromey <tom@tromey.com>,
Bruno Larsen via Gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH] Improve GDB's baseclass detection with typedefs
Date: Mon, 3 Oct 2022 10:10:14 +0200 [thread overview]
Message-ID: <b4ef8de9-1c4c-12e0-0354-7022ddfbbecf@redhat.com> (raw)
In-Reply-To: <87bkqyxe12.fsf@tromey.com>
On 29/09/2022 19:54, Tom Tromey wrote:
>>>>>> "Bruno" == Bruno Larsen via Gdb-patches <gdb-patches@sourceware.org> writes:
> Bruno> When a class inherits from a typedef'd baseclass, GDB may be unable to
> Bruno> find the baseclass if the user is not using the typedef'd name, as is
> Bruno> tested on gdb.cp/virtbase2.exp; the reason that test case is working
> Bruno> under gcc is that the dwarf generated by gcc links the class to the
> Bruno> original definition of the baseclass, not to the typedef. If the
> Bruno> inheritance is linked to the typedef, such as how clang does it,
> Bruno> gdb.cp/virtbase2.exp starts failing.
>
> Bruno> This can also be seen in gdb.cp/impl-this.exp, when attempting to print
> Bruno> D::Bint::i, and GDB not being able to find the baseclass Bint.
>
> Bruno> This happens because searching for baseclasses only uses the macro
> Bruno> TYPE_BASECLASS_NAME, which returns the typedef'd name. However, we can't
> Bruno> switch that macro to checking for typedefs, otherwise we wouldn't be
> Bruno> able to find the typedef'd name anymore. This is fixed by searching for
> Bruno> members or baseclasses by name, we check both the saved name and the
> Bruno> name after checking for typedefs.
>
> Bruno> This also fixes said long-standing bug in gdb.cp/impl-this.exp when the
> Bruno> compiler adds information about typedefs in the debuginfo.
>
> Thank you for the patch. This is ok.
Thanks, pushed!
Cheers,
Bruno
>
> Tom
>
prev parent reply other threads:[~2022-10-03 8:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-29 7:14 Bruno Larsen
2022-09-29 17:54 ` Tom Tromey
2022-10-03 8:10 ` Bruno Larsen [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=b4ef8de9-1c4c-12e0-0354-7022ddfbbecf@redhat.com \
--to=blarsen@redhat.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).