From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by sourceware.org (Postfix) with ESMTPS id A8A70382E500 for ; Tue, 15 Nov 2022 07:15:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A8A70382E500 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id E5EB6336CD; Tue, 15 Nov 2022 07:15:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1668496553; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WLlO5kzBJldb3gKl6KndvVTAaJnC64DkNL/LhIh/v2E=; b=uPn7AGQY8LY7l2xbrgkOVuycQbsimKN0pQgTMBgWq3jkcSGiHhU02Kiekj6YqxiAPeouSn q2c9vWlc5fZ8+mEDOkvx8odPM2FyZhw7BiEYuKobkaVYOjIpZLMqAPFKK81HpnLT3Db5IG zjKP5lvh5qjidPq2dqX0uGsFqqyTBRc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1668496553; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WLlO5kzBJldb3gKl6KndvVTAaJnC64DkNL/LhIh/v2E=; b=R0UmGfpUgZ5QfJDVfiYK1SE6gazFbnsKYRYbuWPbk9STvkdGyoaF314IV/hu0xvwz58wBM TEDVCmP4JSb9o+BQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id B932A13273; Tue, 15 Nov 2022 07:15:53 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id KQxoK6k8c2PDHQAAMHmgww (envelope-from ); Tue, 15 Nov 2022 07:15:53 +0000 Message-ID: <7f476265-c6a9-9fcf-ce13-ff550ea5e6f6@suse.de> Date: Tue, 15 Nov 2022 08:15:53 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: [PATCH 2/2 ver 3] PowerPC, fix support for printing the function return value for non-trivial values. Content-Language: en-US To: Ulrich Weigand , "gdb-patches@sourceware.org" , "cel@us.ibm.com" Cc: "kevinb@redhat.com" , "will_schmidt@vnet.ibm.com" , "blarsen@redhat.com" References: <2db5ad69b32f4cda9c53b252ad37cd783f827c14.camel@de.ibm.com> From: Tom de Vries In-Reply-To: <2db5ad69b32f4cda9c53b252ad37cd783f827c14.camel@de.ibm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 11/14/22 17:47, Ulrich Weigand via Gdb-patches wrote: > Carl Love wrote: > >> PowerPC, fix support for printing the function return value for non-trivial values. >> >> Currently, a non-trivial return value from a function cannot currently be >> reliably determined on PowerPC. This is due to the fact that the PowerPC >> ABI uses register r3 to store the address of the buffer containing the >> non-trivial return value when the function is called. The PowerPC ABI >> does not guarantee the value in register r3 is not modified in the >> function. Thus the value in r3 cannot be reliably used to obtain the >> return addreses on exit from the function. >> >> This patch adds a new gdbarch method to allow PowerPC to access the value >> of r3 on entry to a function. On PowerPC, the new gdbarch method attempts >> to use the DW_OP_entry_value for the DWARF entries, when exiting the >> function, to determine the value of r3 on entry to the function. This >> requires the use of the -fvar-tracking compiler option to compile the >> user application thus generating the DW_OP_entry_value in the binary. The >> DW_OP_entry_value entries in the binary file allows GDB to resolve the >> DW_TAG_call_site entries. This new gdbarch method is used to get the >> return buffer address, in the case of a function returning a nontrivial >> data type, on exit from the function. The GDB function should_stop checks >> to see if RETURN_BUF is non-zero. By default, RETURN_BUF will be set to >> zero by the new gdbarch method call for all architectures except PowerPC. >> The get_return_value function will be used to obtain the return value on >> all other architectures as is currently being done if RETURN_BUF is zero. >> On PowerPC, the new gdbarch method will return a nonzero address in >> RETURN_BUF if the value can be determined. The value_at function uses the >> return buffer address to get the return value. >> >> This patch fixes five testcase failures in gdb.cp/non-trivial-retval.exp. >> The correct function return values are now reported. >> >> Note this patch is dependent on patch: "PowerPC, function >> ppc64_sysv_abi_return_value add missing return value convention". >> >> This patch has been tested on Power 10 and x86-64 with no regressions. > > I believe all of Kevin's and Bruno's comments have been addressed > in this version. I've reviewed it myself as well, and it looks > good to me. > > This is OK. > On x86_64-linux, I run into a segfault: ... PASS: gdb.asm/asm-source.exp: info source asmsrc1.s ERROR: GDB process no longer exists UNRESOLVED: gdb.asm/asm-source.exp: finish from foo3 ... Reproduced on command line: ... $ gdb -q -batch -x outputs/gdb.asm/asm-source/gdb.in.1 ... The problem seems to be that: ... Thread 1 "gdb" received signal SIGSEGV, Segmentation fault. 0x000000000043de7a in symbol::type (this=0x0) at /home/vries/gdb_versions/devel/src/gdb/symtab.h:1287 1287 return m_type; ... because: ... (gdb) up #1 0x0000000000852d94 in finish_command (arg=0x0, from_tty=0) at /home/vries/gdb_versions/devel/src/gdb/infcmd.c:1887 1887 = check_typedef (sm->function->type ()->target_type ()); (gdb) p sm->function $1 = (symbol *) 0x0 ... Thanks, - Tom