From: Abhay Kandpal <abhay@linux.ibm.com>
To: gdb-patches@sourceware.org
Cc: Ulrich.Weigand@de.ibm.com, tdevries@suse.de, cel@linux.ibm.com,
abhay.k@ibm.com, Abhay Kandpal <abhay@linux.ibm.com>
Subject: [PATCH v2] PowerPC: Skip base type RTTI tests before inferior start
Date: Tue, 25 Nov 2025 00:50:19 -0600 [thread overview]
Message-ID: <20251125065019.2316402-1-abhay@linux.ibm.com> (raw)
On PowerPC targets, RTTI typeinfo objects for simple base types such as
`int`, `char*`, and `const char*` may not be emitted until the inferior
has been started. As a result, the `gdb.cp/typeid.exp` test fails when
checking typeid results before program execution begins.
This patch extends the existing Clang-specific logic that skips base type
RTTI checks before the inferior starts, to also apply on PowerPC. This
ensures consistent test behavior across compilers and targets.
gdb/testsuite/
* gdb.cp/typeid.exp (do_typeid_tests): Skip base type RTTI tests
before inferior start on PowerPC.
---
This patch is reg tested.
Change from v1 -> v2
<Change the logic to skip base type RTTI test>
<Modified commit log>
gdb/testsuite/gdb.cp/typeid.exp | 22 ++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)
diff --git a/gdb/testsuite/gdb.cp/typeid.exp b/gdb/testsuite/gdb.cp/typeid.exp
index bd97b26c6e4..cce6a294dd5 100644
--- a/gdb/testsuite/gdb.cp/typeid.exp
+++ b/gdb/testsuite/gdb.cp/typeid.exp
@@ -28,14 +28,24 @@ proc do_typeid_tests {started} {
set type_re "(std::type_info|gdb_gnu_v3_type_info)"
set var {ca b}
- if {$started || ![test_compiler_info clang-*-* c++]} {
- # Clang doesn't place type information for the base types in
- # the executable, and relies on this being linked in from the
- # standard library. As a result, type information for these
- # variables is only available once the inferior is started.
+ set have_base_types 1
+ if {!$started} {
+ if {[test_compiler_info clang-*-* c++]} {
+ # Note that we test pointer equality rather than object
+ # Clang doesn't place type information for the base types in
+ # the executable, and relies on this being linked in from the
+ # standard library. As a result, type information for these
+ # variables is only available once the inferior is started.
+ set have_base_types 0
+ } elseif {[istarget "powerpc*-*-*"]} {
+ # On PowerPC, RTTI typeinfo for base types (i, cp, ccp) may not be
+ # emitted until the inferior is started.
+ set have_base_types 0
+ }
+ }
+ if { $have_base_types } {
lappend var i cp ccp
}
-
foreach simple_var $var {
gdb_test "print &typeid($simple_var)" \
" = \\($type_re \\*\\) $hex.*"
--
2.51.1
next reply other threads:[~2025-11-25 6:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-25 6:50 Abhay Kandpal [this message]
2025-11-25 8:39 ` Tom de Vries
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=20251125065019.2316402-1-abhay@linux.ibm.com \
--to=abhay@linux.ibm.com \
--cc=Ulrich.Weigand@de.ibm.com \
--cc=abhay.k@ibm.com \
--cc=cel@linux.ibm.com \
--cc=gdb-patches@sourceware.org \
--cc=tdevries@suse.de \
/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