From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=lancelotsix.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=lancelotsix.com 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) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=lancelotsix.com; s=2021; t=1668594056; bh=oRTXtkfOXxAC+OfbbyMRMN2Vc+QSfWlnTTZuJUw5MWo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=y47zGcbgP3GJDg6w1OiugTbzkjjiHeU0pPNNoRLyaMqPA5bSBkEcDCc3jl3p3UZU2 CqqzXCIp8TNK7z8GXVU7x6VFFh3lJK54MiPFj4IaiYZiF/J8MQfxN2XUwPlVdsMETq vS4yNTswVysomfcDrt2QolgfT1yJ37O4pOOC69ybKopvcuajhKl2C+eD1eSc2OCV8G eKyhrkfU44sR6ydIyoKD8fvrxHHNU6bG1BCii8qD4pPTMu8yxUR1oCpJzAJZpAa9k3 Aa3hhf3lcnQbYcle0IIEwGBIZ3lBEpdgn7hcdRcrkWnqYwE72mUS+F+17IVyDaSYMz 5pNYMXOT3+h/g== Date: Wed, 16 Nov 2022 10:20:18 +0000 From: Lancelot SIX 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-Spam-Status: No, score=-10.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_SBL_CSS,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: 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 > >