From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 57163 invoked by alias); 26 May 2018 01:14:44 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 57150 invoked by uid 89); 26 May 2018 01:14:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=Pedro's, pedros, pedro's, Pedros X-HELO: smtp.polymtl.ca Received: from smtp.polymtl.ca (HELO smtp.polymtl.ca) (132.207.4.11) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 26 May 2018 01:14:43 +0000 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id w4Q1Ea5T031367 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 25 May 2018 21:14:41 -0400 Received: by simark.ca (Postfix, from userid 112) id 801E51F21C; Fri, 25 May 2018 21:14:36 -0400 (EDT) Received: from simark.ca (localhost [127.0.0.1]) by simark.ca (Postfix) with ESMTP id B262A1E481; Fri, 25 May 2018 21:14:34 -0400 (EDT) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Sun, 27 May 2018 03:42:00 -0000 From: Simon Marchi To: Weimin Pan Cc: gdb-patches@sourceware.org Subject: Re: [PATCH PR gdb/22736] [aarch64] gdb crashes on a conditional breakpoint with cast return type In-Reply-To: <1527290419-17631-1-git-send-email-weimin.pan@oracle.com> References: <1527290419-17631-1-git-send-email-weimin.pan@oracle.com> Message-ID: X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.3.6 X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Sat, 26 May 2018 01:14:36 +0000 X-IsSubscribed: yes X-SW-Source: 2018-05/txt/msg00709.txt.bz2 On 2018-05-25 19:20, Weimin Pan wrote: > Don't call language_pass_by_reference() with function that has no > return type. > > Only call language_pass_by_reference(), which returns whether or not an > additional initial argument has been given, when return_type is not > NULL > in function aarch64_push_dummy_call(). Hi Weimin, Since Pedro's patch that makes GDB not assume that the return type of functions without debug info is int: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=7022349d5c86bae74b49225515f42d2e221bd368 I think we will always know the return type of the function. Either it's in the debug info or it's provided by the user. In call_function_by_hand_dummy, if the debug info doesn't provide the return type of the function, we use the type of the user-provided cast: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob;f=gdb/infcall.c;h=cd3eedfeeb712b27234a68cf8af394558ce4f57d;hb=cd3eedfeeb712b27234a68cf8af394558ce4f57d#l870 I think the default_return_type could be passed down to gdbarch_push_dummy_call and used the same way, so that we always have a return type. Also, could you add a test case for this? I was able to create a simple C++ (not C) program made from an object file built with no debug info: int returns_two () { return 2; } and one built with debug info: int returns_two(); void func() { } int main() { func(); return 0; } Putting this breakpoint and running crashes GDB: (gdb) b func if (int)returns_two() == 2" Thanks, Simon