Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: Abhay Kandpal <abhay@linux.ibm.com>, gdb-patches@sourceware.org
Cc: Ulrich.Weigand@de.ibm.com, cel@linux.ibm.com, abhay.k@ibm.com
Subject: Re: [PATCH v2] PowerPC: Skip base type RTTI tests before inferior start
Date: Tue, 25 Nov 2025 09:39:37 +0100	[thread overview]
Message-ID: <77a934e1-948d-4174-a9d9-83393f1f2141@suse.de> (raw)
In-Reply-To: <20251125065019.2316402-1-abhay@linux.ibm.com>

On 11/25/25 7:50 AM, Abhay Kandpal wrote:
> 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.
> 

LGTM, with one nit below.

Approved-By: Tom de Vries <tdevries@suse.de>

Thanks,
- Tom

> 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
>       }
> -

Don't remove this empty line.

>       foreach simple_var $var {
>   	gdb_test "print &typeid($simple_var)" \
>   	    " = \\($type_re \\*\\) $hex.*"


      reply	other threads:[~2025-11-25  8:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-25  6:50 Abhay Kandpal
2025-11-25  8:39 ` Tom de Vries [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=77a934e1-948d-4174-a9d9-83393f1f2141@suse.de \
    --to=tdevries@suse.de \
    --cc=Ulrich.Weigand@de.ibm.com \
    --cc=abhay.k@ibm.com \
    --cc=abhay@linux.ibm.com \
    --cc=cel@linux.ibm.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