From patchwork Fri May 25 23:20:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Weimin Pan X-Patchwork-Id: 27513 Received: (qmail 110149 invoked by alias); 25 May 2018 23:20:30 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 110135 invoked by uid 89); 25 May 2018 23:20:29 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS, SPF_PASS, UNPARSEABLE_RELAY autolearn=ham version=3.3.2 spammy=Pan, 14269, 1426, 9 X-HELO: aserp2130.oracle.com Received: from aserp2130.oracle.com (HELO aserp2130.oracle.com) (141.146.126.79) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 25 May 2018 23:20:28 +0000 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w4PNGd6s168161 for ; Fri, 25 May 2018 23:20:26 GMT Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp2130.oracle.com with ESMTP id 2j6qk5gv1q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 25 May 2018 23:20:26 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w4PNKOjx017811 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 25 May 2018 23:20:25 GMT Received: from abhmp0015.oracle.com (abhmp0015.oracle.com [141.146.116.21]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w4PNKOdK010348 for ; Fri, 25 May 2018 23:20:24 GMT Received: from localhost.us.oracle.com (/10.211.15.129) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 25 May 2018 16:20:24 -0700 From: Weimin Pan To: gdb-patches@sourceware.org Subject: [PATCH PR gdb/22736] [aarch64] gdb crashes on a conditional breakpoint with cast return type Date: Fri, 25 May 2018 23:20:19 +0000 Message-Id: <1527290419-17631-1-git-send-email-weimin.pan@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8904 signatures=668700 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=582 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1805250236 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(). Tested on aarch64-linux-gnu. No regressions. --- gdb/ChangeLog | 6 ++++++ gdb/aarch64-tdep.c | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 6f4153b..4c5691f 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2018-05-23 Weimin Pan + + PR gdb/22736: + * aarch64-tdep.c (aarch64_push_dummy_call): Do not call + language_pass_by_reference if return_type is NULL. + 2018-05-14 Weimin Pan * minsyms.h (lookup_minimal_symbol_and_objfile): Remove declaration. diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c index 01566b4..b4633ff 100644 --- a/gdb/aarch64-tdep.c +++ b/gdb/aarch64-tdep.c @@ -1426,7 +1426,9 @@ aarch64_push_dummy_call (struct gdbarch *gdbarch, struct value *function, given an additional initial argument, a hidden pointer to the return slot in memory. */ return_type = TYPE_TARGET_TYPE (func_type); - lang_struct_return = language_pass_by_reference (return_type); + lang_struct_return = (return_type != NULL + ? language_pass_by_reference (return_type) + : 0); /* Set the return address. For the AArch64, the return breakpoint is always at BP_ADDR. */