From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 38268 invoked by alias); 29 May 2018 17:25:26 -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 33771 invoked by uid 89); 29 May 2018 17:25:00 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_PASS autolearn=no version=3.3.2 spammy=HTo:D*oracle.com X-HELO: mx1.redhat.com Received: from mx3-rdu2.redhat.com (HELO mx1.redhat.com) (66.187.233.73) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 29 May 2018 17:24:57 +0000 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2DBC6401EF08; Tue, 29 May 2018 17:24:37 +0000 (UTC) Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5A2582166BB2; Tue, 29 May 2018 17:24:36 +0000 (UTC) Subject: Re: [PATCH PR gdb/22736] [aarch64] gdb crashes on a conditional breakpoint with cast return type To: Simon Marchi , Weimin Pan References: <1527290419-17631-1-git-send-email-weimin.pan@oracle.com> Cc: gdb-patches@sourceware.org, Alan Hayward From: Pedro Alves Message-ID: <38c37a2c-e3c1-44cf-3f72-effb1d5c2160@redhat.com> Date: Tue, 29 May 2018 17:46:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-SW-Source: 2018-05/txt/msg00773.txt.bz2 On 05/26/2018 02:14 AM, Simon Marchi wrote: > 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. Agreed. Note this bug discussed earlier, and Alan had a patch too: https://sourceware.org/ml/gdb-patches/2018-03/msg00157.html That was discussed just before the recent ifunc revamp, and I wasn't exactly sure whether master still had the issue. Also I forgot about it. :-P Alan, do you recall the status of that from your end? The issue of using the cast-to type was discussed then too: https://sourceware.org/ml/gdb-patches/2018-03/msg00204.html So I wonder whether you already had a patch for that somewhere. > > 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, Pedro Alves