From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id 3A0223858D1E for ; Tue, 7 Nov 2023 21:29:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3A0223858D1E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linux.ibm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 3A0223858D1E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699392585; cv=none; b=WeKslXn6ZZmnLEozmHFu06Vh/u5CBLNTBKNEimA0DyX5Hsh7Euh+54DpKjVNBrcAfWKlw9CzOQqqYeayVF0lvAAswjGWrh1D4KtkWKH6Qg7E3LcCUbUnQFdIY8MgRvXkxe2v1hHvADSjiYOuAP3f41tF+Wc5hM+7n0saZaddoRE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699392585; c=relaxed/simple; bh=j97odqhGIjzzEvI/J5bh3xBB0rqcyfKSUsz4sb946Y0=; h=DKIM-Signature:Message-ID:Subject:From:To:Date:Mime-Version; b=S8OZAEnGa4AP3cGmoGXw5HWw1kZMnsjMjIzKW04TaKoqzs1t7JPE5hD9TpiNBX2l8QHdGZ32gSBYGhun4Q+Rm/R/CDYaUAlSnmHV54W3wK3etPNxl/u27WHqCUFctCrBv8uoi+T2xTq890pKvZzTvEOzrRyuLw0auOrsYBBwOcs= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3A7LSEqc010338; Tue, 7 Nov 2023 21:29:41 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : subject : from : to : cc : date : content-type : mime-version : content-transfer-encoding; s=pp1; bh=KcTlO0kNngOHkdh7Uey/zd6+l3OKQ+7yBTVROAlraHw=; b=cAgiW+6yh+aYATO++wy4k5+sjVjo+NJ4TrH1RzBqPO0+NA+HHs/2df4diCHGfJWfV8Eh 4553R1R+nM/0tr83p+6ES0YPUoWapwPQHmogcQse+eYpJqjJ6qDulYOkFPt27Azo8tGi yEwagxJvkA4J16t98CSNm9agnFbW/d+9Aaoe+UPluPrFE2cJx3zyQTacCuyPeTXlIoUb 16oK7fRsjqXU1hUlfKFmSRg1paVtBRojV3f2eFaA6JD9rRp8akOPLEUnmPJC6bERa4pL AA5MMdThFxpOenxvgREqih5rqTucDC5QNPwkg/ZxAmsuqpUMnIvBd9MjfZ7ZhgtNZITy jw== Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3u7w618185-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Nov 2023 21:29:40 +0000 Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3A7LJK6e003529; Tue, 7 Nov 2023 21:29:39 GMT Received: from smtprelay07.wdc07v.mail.ibm.com ([172.16.1.74]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 3u7w21r1g1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 07 Nov 2023 21:29:39 +0000 Received: from smtpav06.wdc07v.mail.ibm.com (smtpav06.wdc07v.mail.ibm.com [10.39.53.233]) by smtprelay07.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3A7LTbcE22610432 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 7 Nov 2023 21:29:37 GMT Received: from smtpav06.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 70AAB5803F; Tue, 7 Nov 2023 21:29:37 +0000 (GMT) Received: from smtpav06.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6F5B25804E; Tue, 7 Nov 2023 21:29:36 +0000 (GMT) Received: from wecm-9-67-110-146.wecm.ibm.com (unknown [9.67.110.146]) by smtpav06.wdc07v.mail.ibm.com (Postfix) with ESMTP; Tue, 7 Nov 2023 21:29:36 +0000 (GMT) Message-ID: <28eb1ebbaad9ad0a114d628e79072a0320c659f5.camel@linux.ibm.com> Subject: [PATCH] Powerpc, fix for test gdb.base/unwind-on-each-insn.exp From: Carl Love To: gdb-patches@sourceware.org, Tom Tromey , luis.machado@arm.com, cel@linux.ibm.com Cc: Ulrich Weigand Date: Tue, 07 Nov 2023 13:29:35 -0800 Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 (3.28.5-22.el8) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: ohqPOrfKgEEpGsxkKbMC4rEssxfMAoca X-Proofpoint-GUID: ohqPOrfKgEEpGsxkKbMC4rEssxfMAoca X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-07_13,2023-11-07_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 mlxlogscore=999 clxscore=1011 adultscore=0 mlxscore=0 priorityscore=1501 bulkscore=0 malwarescore=0 spamscore=0 suspectscore=0 impostorscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311070178 X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE 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: GDB maintainers, Luis, Tom: Here is the patch to fix test gdb.base/unwind-on-each-insn.exp on PowerPC as discussed on IRC. Per that discussion with Tom and Luis, the point of the test is to look for an error where a breakpoint in an inlined ada function was reported as being set in multiple places. There should only be one location reported for the test and the breakpoint address should not be at address 0x0. The test also fails on aarch64 but passes on X86-64. The issue is the location of the inserted breakpoint in function callee may be reported as being in file callee.adb or in file caller.adb. The location reported by the ada compiler for inlined functions seems to be a function of either the ada compiler version or target dependent. The following patch will accept the reported breakpoint location as being correctly set in either file callee.adb or caller.adb. In either case the address of the breakpoint must not be zero. The test checks that the file line number matches the requested line number in file calleeadb or one less if the reported location is in caller.adb. The key thing is we want to make sure we have a reasonable line number and the breakpoint address is not zero. The patch fixes the single test failure on PowerPC. It does not introduce any additional errors on the X86-84 platform on which it was tested. Please let me know if the patch looks OK for gdb mainline. Thanks. Carl ------------------------- Fix the gdb.ada/inline-section-gc.exp test The original intention of the test appears to be checking to make sure setting a breakpoint in an inlined function didn't set multiple breakpoints where one of them was at address 0. The gdb.ada/inline-section-gc.exp test may pass or fail depending on the version of gnat. Per the discussion on IRC, the ada inlining appears to have some target dependencies. In this test there are two functions, callee and caller. Function calee is inlined into caller. The test sets a breakpoint in function callee. The reported location where the breakpoint is set may be at the requested location in callee or the location in caller after callee has been inlined. The test needs to accept either location as correct provided the breakpoint address is not zero. This patch checks to see if the reported breakpoint is in function callee or function caller and fails if the breakpoint address is 0x0. The line number where the breakpoint is set will match the requested line if the breakpoint location is reported is callee.adb. If the reported file is caller.adb, the line number is one less. The difference is a function of the source code. The key thing is the line number should be reasonable. This patch fixes the single regression failure for the test on PowerPC. It does not introduce any failures on X86-64. --- gdb/testsuite/gdb.ada/inline-section-gc.exp | 23 ++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/gdb/testsuite/gdb.ada/inline-section-gc.exp b/gdb/testsuite/gdb.ada/inline-section-gc.exp index b707335eb04..1f5dabc1896 100644 --- a/gdb/testsuite/gdb.ada/inline-section-gc.exp +++ b/gdb/testsuite/gdb.ada/inline-section-gc.exp @@ -34,8 +34,25 @@ if {[gdb_compile_ada "${srcfile}" "${binfile}" executable $options] != ""} { clean_restart ${testfile} -set bp_location [gdb_get_line_number "BREAK" ${testdir}/callee.adb] + +# Depending on the version of gnat, the location of the set breakpoint may +# be reported as being at the requested location in file callee.adb or in +# file caller.adb where the callee function was inlined. Either way, only +# on breakpoint should be reported and it's address should not be at 0x0. +# If the breakpoint is reported in caller, then the line number happens to +# be one less the the requested line number. +set bp_location1 [gdb_get_line_number "BREAK" ${testdir}/callee.adb] +set bp_location2 [expr $bp_location1 - 1] +set test "break callee.adb:$bp_location1" +set message "Breakpoint set" + # The bug here was that gdb would set a breakpoint with two locations, # one of them at 0x0. -gdb_test "break callee.adb:$bp_location" \ - "Breakpoint $decimal at $hex: file .*callee.adb, line $bp_location." +gdb_test_multiple $test $message { + -re "Breakpoint $decimal at $hex: file .*callee.adb, line $bp_location1." { + pass $test + } + -re "Breakpoint $decimal at $hex: file .*caller.adb, line $bp_location2." { + pass $test + } +} -- 2.37.2