From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 92850 invoked by alias); 29 May 2018 17:12:13 -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 92828 invoked by uid 89); 29 May 2018 17:12:11 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=HContent-Transfer-Encoding:8bit X-HELO: aserp2120.oracle.com Received: from aserp2120.oracle.com (HELO aserp2120.oracle.com) (141.146.126.78) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 29 May 2018 17:12:07 +0000 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w4THANU5180487; Tue, 29 May 2018 17:11:59 GMT Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp2120.oracle.com with ESMTP id 2j6yjbj6sm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 May 2018 17:11:59 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w4THBw3U004351 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 May 2018 17:11:58 GMT Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w4THBwBq010087; Tue, 29 May 2018 17:11:58 GMT Received: from [10.159.148.13] (/10.159.148.13) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 29 May 2018 10:11:57 -0700 Subject: Re: [PATCH PR gdb/22736] [aarch64] gdb crashes on a conditional breakpoint with cast return type To: Simon Marchi Cc: gdb-patches@sourceware.org References: <1527290419-17631-1-git-send-email-weimin.pan@oracle.com> From: Wei-min Pan Message-ID: <428ed785-ae74-1656-5a81-f2701b811a6f@oracle.com> Date: Tue, 29 May 2018 17:43:00 -0000 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8908 signatures=668702 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1805290187 X-SW-Source: 2018-05/txt/msg00772.txt.bz2 On 5/25/2018 6:14 PM, 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. Hi Simon, Since call_function_by_hand_dummy () already calls gdbarch_return_in_first_hidden_param_p() and sets hidden_first_param_p accordingly. Instead of passing the deault_return_type and having the target make the same call again , I think we should just pass hidden_first_param_p to gdbarch_push_dummy_call()? > > 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" Yes, will do and maybe use the one you provided here. Thanks for your comments. Weimin > > Thanks, > > Simon