From: Tom Tromey <tom@tromey.com>
To: Bruno Larsen via Gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH] Improve GDB's baseclass detection with typedefs
Date: Thu, 29 Sep 2022 11:54:01 -0600 [thread overview]
Message-ID: <87bkqyxe12.fsf@tromey.com> (raw)
In-Reply-To: <20220929071418.2621404-1-blarsen@redhat.com> (Bruno Larsen via Gdb-patches's message of "Thu, 29 Sep 2022 09:14:18 +0200")
>>>>> "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.
Tom
next prev parent reply other threads:[~2022-09-29 17:54 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 [this message]
2022-10-03 8:10 ` Bruno Larsen
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=87bkqyxe12.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).