From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 8AGLAKC5dGNBCxkAWB0awg (envelope-from ) for ; Wed, 16 Nov 2022 05:21:20 -0500 Received: by simark.ca (Postfix, from userid 112) id F1B651E124; Wed, 16 Nov 2022 05:21:19 -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=ayIfwH8N; 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,RCVD_IN_DNSWL_MED, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from sourceware.org (server2.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 AB6C11E0D3 for ; Wed, 16 Nov 2022 05:21:19 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7962B3959C66 for ; Wed, 16 Nov 2022 10:21:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7962B3959C66 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1668594078; bh=DGGyd0DywalXszC6i5/X1Z80CrJvioyS9p3K6tvf+dQ=; h=Date:To:Cc:Subject:References:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=ayIfwH8NpxDoK7cNtIC+oblJXHYlp9oJ7X21nyRuD68+lF+dukfwttK42GQUoiXzP DlS93ClBm69u63zuq/1x/rZyaPaRl+xEQvAdHFY/wRhsdJp65dBq9r2nZd5dgkY/KS 7aPn4GL+gZ2irk0u9OUMGF5bc73OwWdFIpfnQLeg= Received: from lndn.lancelotsix.com (vps-42846194.vps.ovh.net [IPv6:2001:41d0:801:2000::2400]) by sourceware.org (Postfix) with ESMTPS id 08E9A3959C73 for ; Wed, 16 Nov 2022 10:20:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 08E9A3959C73 Received: from ubuntu.lan (cust120-dsl54.idnet.net [212.69.54.120]) by lndn.lancelotsix.com (Postfix) with ESMTPSA id ABFB980363; Wed, 16 Nov 2022 10:20:55 +0000 (UTC) Date: Wed, 16 Nov 2022 10:20:18 +0000 To: Carl Love Cc: Ulrich Weigand , "gdb-patches@sourceware.org" , "tdevries@suse.de" , Simon Marchi , "kevinb@redhat.com" , "will_schmidt@vnet.ibm.com" , "blarsen@redhat.com" Subject: Re: [PATCH 2/2 ver 3] PowerPC, fix support for printing the function return value for non-trivial values. Message-ID: <20221116101958.aadx4r5f72ub2emw@ubuntu.lan> References: <2db5ad69b32f4cda9c53b252ad37cd783f827c14.camel@de.ibm.com> <7f476265-c6a9-9fcf-ce13-ff550ea5e6f6@suse.de> <6ed2cf1714e5b8dc386e66b634b540efdf828ed5.camel@de.ibm.com> <2466b7efc91dd4964add9a0d7ce4cd47678f5800.camel@us.ibm.com> <6cb9fd038eefd825bd0e66c80da3771e4a512b68.camel@us.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <6cb9fd038eefd825bd0e66c80da3771e4a512b68.camel@us.ibm.com> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.11 (lndn.lancelotsix.com [0.0.0.0]); Wed, 16 Nov 2022 10:20:56 +0000 (UTC) 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: Lancelot SIX via Gdb-patches Reply-To: Lancelot SIX Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" Hi Carl, Thanks for the fix. > diff --git a/gdb/infcmd.c b/gdb/infcmd.c > index b71dc10370b..a72df2d6a01 100644 > --- a/gdb/infcmd.c > +++ b/gdb/infcmd.c > @@ -1877,26 +1877,28 @@ finish_command (const char *arg, int from_tty) > /* Find the function we will return from. */ > frame_info_ptr callee_frame = get_selected_frame (NULL); > sm->function = find_pc_function (get_frame_pc (callee_frame)); > + sm->return_buf = 0; /* Initialize buffer address is not available. */ > > /* Determine the return convention. If it is RETURN_VALUE_STRUCT_CONVENTION, > attempt to determine the address of the return buffer. */ > - enum return_value_convention return_value; > - struct gdbarch *gdbarch = get_frame_arch (callee_frame); > + if (sm->function != NULL) I know that Ulrich has already approved the patch, but to follow the coding standard the NULL should be replaced by nullptr. If this is not too much trouble and is OK with maintainers, I think it would be nice to do this minor tweak. > + { > + enum return_value_convention return_value; > + struct gdbarch *gdbarch = get_frame_arch (callee_frame); > > - struct type * val_type > - = check_typedef (sm->function->type ()->target_type ()); > + struct type * val_type > + = check_typedef (sm->function->type ()->target_type ()); > > - return_value = gdbarch_return_value (gdbarch, > - read_var_value (sm->function, NULL, > - callee_frame), > - val_type, NULL, NULL, NULL); > + return_value = gdbarch_return_value (gdbarch, > + read_var_value (sm->function, NULL, > + callee_frame), > + val_type, NULL, NULL, NULL); While at it, those NULL could probably be updated I guess. Best, Lancelot. > > - if (return_value == RETURN_VALUE_STRUCT_CONVENTION > - && val_type->code () != TYPE_CODE_VOID) > - sm->return_buf = gdbarch_get_return_buf_addr (gdbarch, val_type, > - callee_frame); > - else > - sm->return_buf = 0; > + if (return_value == RETURN_VALUE_STRUCT_CONVENTION > + && val_type->code () != TYPE_CODE_VOID) > + sm->return_buf = gdbarch_get_return_buf_addr (gdbarch, val_type, > + callee_frame); > + } > > /* Print info on the selected frame, including level number but not > source. */ > -- > 2.31.1 > >