From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 6NX1EvE8c2NloRgAWB0awg (envelope-from ) for ; Tue, 15 Nov 2022 02:17:05 -0500 Received: by simark.ca (Postfix, from userid 112) id 3B0D51E124; Tue, 15 Nov 2022 02:17:05 -0500 (EST) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=LAIOrsXw; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,NICE_REPLY_A, RCVD_IN_DNSWL_MED,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id C9E421E0D3 for ; Tue, 15 Nov 2022 02:17:04 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 32080382E507 for ; Tue, 15 Nov 2022 07:17:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 32080382E507 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1668496624; bh=WLlO5kzBJldb3gKl6KndvVTAaJnC64DkNL/LhIh/v2E=; h=Date:Subject:To:Cc:References:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=LAIOrsXwm6DHYQNdswWZrWS2de7J9AWd0dY6Dt6kryAi6Q6T7eyoR6F1nkQi2LQPa 7dyikAgIdOKj8+rNY/WMqXtvupHR4gRKC7dr+BgUaFfem3SS/h8Q7f5x3OxDJgpDey ODkCxD53IoqDxzMlyuhIicu9YhqC4Uqq8hvfneRI= 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 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) 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> In-Reply-To: <2db5ad69b32f4cda9c53b252ad37cd783f827c14.camel@de.ibm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Tom de Vries via Gdb-patches Reply-To: Tom de Vries Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" 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