From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id yWWlLNeQQWn4CAQAWB0awg (envelope-from ) for ; Tue, 16 Dec 2025 12:03:19 -0500 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=llpV9b06; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=YBUhjUwz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=llpV9b06; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=YBUhjUwz; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id B29861E048; Tue, 16 Dec 2025 12:03:19 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 10E9E1E048 for ; Tue, 16 Dec 2025 12:03:19 -0500 (EST) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 945D04BA2E21 for ; Tue, 16 Dec 2025 17:03:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 945D04BA2E21 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=llpV9b06; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=YBUhjUwz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=llpV9b06; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=YBUhjUwz Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by sourceware.org (Postfix) with ESMTPS id 4DCEE4BA2E04 for ; Tue, 16 Dec 2025 17:02:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4DCEE4BA2E04 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 4DCEE4BA2E04 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1765904570; cv=none; b=HM3J7S3yV1hLjjhELbHuMCowi4Q7fwVrGce23w3UybHTnxTKYT17b9EeeDWHHqWuolIa5xPDQw7itevZmt1qgdc5rulvxLMXNV2lYUr3qlwkZkMw/KVGfepMCKr86qZcnAzlO3cO83n650COlbdLG0NRO6NaDejq49PGBNCZh78= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1765904570; c=relaxed/simple; bh=QwGXv/ghHg3laIOAvXA2sbZfRLg42u0KG/Tkp8xV8w4=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature: Message-ID:Date:MIME-Version:Subject:To:From; b=Xt1iCj6srAqy3qiYnirioucCxMxw4NM5j3MkwHvoEiKY1Po5woLU1TTx1isjlIKbXEWlI7MLsmpIcp28P7BWCtKRv78/DS2Lg33QETJlzayj9K7nzSQ3lnWPpb7J2exJ/0FaisPZGyXjw6HlEmlNMT9MD8BQeRApwAP3TFo/QR8= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4DCEE4BA2E04 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 3C735336D6; Tue, 16 Dec 2025 17:02:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765904569; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CFYh/RU/L5xV2rJsGwrLLZToS/MivHU8rQXpJicHg9w=; b=llpV9b06SkIqyQElzhMw+LXwHeoE0dtF1+tzh9joNINOzmmqIqjIcs94dypTY+n2ZpDfHt wWj1KZc6Aoso2PjPyxg/hkX+6kbzcezWvnK1MRVz85TyIz3+1gB0rinmc+ZU5Ly1PRbTvS MNLLhQvS7yS7OOy429inFWBfy1S/Fkk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765904569; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CFYh/RU/L5xV2rJsGwrLLZToS/MivHU8rQXpJicHg9w=; b=YBUhjUwz2Nue2t0WNlBk5hv+Bm7AIcBgqMWDS/FnJOkSA29K1tl18RP0ELTv8nk9cVKtXh 76TwG1nb4IjnUnDg== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1765904569; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CFYh/RU/L5xV2rJsGwrLLZToS/MivHU8rQXpJicHg9w=; b=llpV9b06SkIqyQElzhMw+LXwHeoE0dtF1+tzh9joNINOzmmqIqjIcs94dypTY+n2ZpDfHt wWj1KZc6Aoso2PjPyxg/hkX+6kbzcezWvnK1MRVz85TyIz3+1gB0rinmc+ZU5Ly1PRbTvS MNLLhQvS7yS7OOy429inFWBfy1S/Fkk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1765904569; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CFYh/RU/L5xV2rJsGwrLLZToS/MivHU8rQXpJicHg9w=; b=YBUhjUwz2Nue2t0WNlBk5hv+Bm7AIcBgqMWDS/FnJOkSA29K1tl18RP0ELTv8nk9cVKtXh 76TwG1nb4IjnUnDg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 27B8B3EA63; Tue, 16 Dec 2025 17:02:49 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id PEpQCLmQQWkJWQAAD6G6ig (envelope-from ); Tue, 16 Dec 2025 17:02:49 +0000 Message-ID: Date: Tue, 16 Dec 2025 18:02:44 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] [gdb/testsuite] Fix gdb.cp/typeid.exp with m32 PIE To: Simon Marchi , gdb-patches@sourceware.org References: <20251216134240.3843501-1-tdevries@suse.de> <366d1b78-aa6c-4279-bf88-931b6ee687dc@suse.de> <07d87f19-4e01-43b0-b9d8-cc99bd31fb47@simark.ca> Content-Language: en-US From: Tom de Vries In-Reply-To: <07d87f19-4e01-43b0-b9d8-cc99bd31fb47@simark.ca> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spamd-Result: default: False [-4.25 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.15)[-0.731]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; MID_RHS_MATCH_FROM(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.de:mid] X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org On 12/16/25 5:53 PM, Simon Marchi wrote: > > > On 2025-12-16 11:12, Tom de Vries wrote: >> On 12/16/25 4:50 PM, Simon Marchi wrote: >>> >>> >>> On 2025-12-16 08:42, Tom de Vries wrote: >>>> On x86_64-linux, if I run test-case gdb.cp/typeid.exp with target boards: >>>> - unix/-m64 >>>> - unix/-m32 >>>> - unix/-fPIE/-pie/-m64 >>>> - unix/-fPIE/-pie/-m32 >>>> for only target board unix/-fPIE/-pie/-m32 I get: >>>> ... >>>> (gdb) print &typeid(i)^M >>>> could not find typeinfo symbol for 'int'^M >>>> (gdb) FAIL: gdb.cp/typeid.exp: before starting: print &typeid(i) >>>> print &typeid(i) == &typeid(typeof(i))^M >>>> could not find typeinfo symbol for 'int'^M >>>> (gdb) FAIL: gdb.cp/typeid.exp: before starting: print &typeid(i) == &typeid(typeof(i)) >>>> print &typeid(cp)^M >>>> could not find typeinfo symbol for 'char*'^M >>>> (gdb) FAIL: gdb.cp/typeid.exp: before starting: print &typeid(cp) >>>> print &typeid(cp) == &typeid(typeof(cp))^M >>>> could not find typeinfo symbol for 'char*'^M >>>> (gdb) FAIL: gdb.cp/typeid.exp: before starting: print &typeid(cp) == &typeid(typeof(cp)) >>>> print &typeid(ccp)^M >>>> could not find typeinfo symbol for 'char const*'^M >>>> (gdb) FAIL: gdb.cp/typeid.exp: before starting: print &typeid(ccp) >>>> print &typeid(ccp) == &typeid(typeof(ccp))^M >>>> could not find typeinfo symbol for 'char const*'^M >>>> (gdb) FAIL: gdb.cp/typeid.exp: before starting: print &typeid(ccp) == &typeid(typeof(ccp)) >>>> ... >>>> >>>> This is yet another configuration for which these tests don't work. >>>> >>>> We're already allowing this for clang and istarget "powerpc*-*-*". >>>> >>>> I don't think there is value in trying to detect yet another configuration. >>>> >>>> Instead, just allow it in general. >>> >> >> Hi Simon, >> >> thanks for the review. >> >>> I don't know the history of this test. Why is the type info for these base >>> types missing before running? Is it a compiler bug or feature? >>> >> >> I don't think it's either, AFAIU it's an implementation detail. I suspect in this case it's related to relocations. >> >> But in general, there's nothing that mandates that type info needs to be available before starting an executable, so it's just a YMMV situation. > > I don't really understand how that works. In my understanding, either > there is an entry in the DWARF for the type info, or there isn't. I > don't understand how it can appear once the inferior is started. > Well, runtime relocations can make data valid that was invalid before. >>>> diff --git a/gdb/testsuite/gdb.cp/typeid.exp b/gdb/testsuite/gdb.cp/typeid.exp >>>> index e12b032f32b..58f0a928a63 100644 >>>> --- a/gdb/testsuite/gdb.cp/typeid.exp >>>> +++ b/gdb/testsuite/gdb.cp/typeid.exp >>>> @@ -27,29 +27,35 @@ proc do_typeid_tests {started} { >>>> # We might see the standard type or gdb's internal type. >>>> set type_re "(std::type_info|gdb_gnu_v3_type_info)" >>>> - set var {ca b} >>>> - 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 >>>> - } >>>> + # The typeinfo for some of these variables may or may not be present >>>> + # before the inferior has started. Mark these by listing them in >>>> + # maybe_missing_var. >>>> + set maybe_missing_var {i cp ccp} >>>> + set var [concat {ca b} $maybe_missing_var] >>>> foreach simple_var $var { >>>> - gdb_test "print &typeid($simple_var)" \ >>>> - " = \\($type_re \\*\\) $hex.*" >>>> + set maybe_missing \ >>>> + [expr {[lsearch -exact $maybe_missing_var $simple_var] != -1}] >>> >>> From the comment, it sounds like the type info for these should be >>> available once the inferior is started. So, should maybe_missing stay >>> false if $started is true? >>> >> >> Yes, thanks for catching that. >> >>>> + >>>> + set missing 0 >>>> + set re [subst_vars { = \($type_re \*\) $hex.*}] >>>> + gdb_test_multiple "print &typeid($simple_var)" "" { >>>> + -re -wrap $re { >>>> + pass $gdb_test_name >>>> + } >>>> + -re -wrap "could not find typeinfo symbol for '.*'" { >>>> + if { $maybe_missing } { >>>> + unsupported $gdb_test_name >>> >>> unsupported or xfail? >> >> Unsupported. It's not an xfail because the environment is doing nothing wrong. > > Ok. > > Approved-By: Simon Marchi Ack, I'll push this, thanks. - Tom