From 0217fa55cbe406d6cdf122f5cd998f1ddb3461d3 Mon Sep 17 00:00:00 2001 From: Abhay Kandpal Date: Wed, 26 Nov 2025 01:33:25 -0500 Subject: [PATCH] PowerPC: Skip base type RTTI tests before inferior start 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. Approved-By: Tom de Vries --- gdb/testsuite/gdb.cp/typeid.exp | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/gdb/testsuite/gdb.cp/typeid.exp b/gdb/testsuite/gdb.cp/typeid.exp index bd97b26c6e4..e12b032f32b 100644 --- a/gdb/testsuite/gdb.cp/typeid.exp +++ b/gdb/testsuite/gdb.cp/typeid.exp @@ -28,11 +28,22 @@ 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 } -- 2.47.3