From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 5DD453858D28 for ; Tue, 24 Jan 2023 15:51:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5DD453858D28 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=us.ibm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=us.ibm.com Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30OFUFnu027092; Tue, 24 Jan 2023 15:51:21 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : from : to : cc : date : in-reply-to : references : content-type : content-transfer-encoding : mime-version : subject; s=pp1; bh=joOTUTxi1FOtdKhrDY/tyB2UMXbEtHLvIMypOZ4/cTc=; b=fJwRAMGxULRba1v/hc3WZDuuL0J2E+i5cRjUE/KKxO0+q4UHcAS6IPhphKVW1jtRL/Rv LgsGhDUl/EFfgCJfm8/HTFXglBxo4xj2B6ZdBgk/H5rMCi1bHqrxhBTQNBIYP6Ceowva wNslXKdpCuCWcioyNRUU9++wbp2elTwmt4K/YSlY7t0Fph5uRAdhAsQ4Ib+T+PndMxhM Z2+cKAxh1HuIHDvjdbTMP7twh5Yu0/yE4CqwwIGW5UExaPSjEvyBT1+5BxnFsZYRcY+s kZSbVnKiuV3ul5U/bJ7WGOEWEAJ66Qyl9LY6KOuVw+ZG9EsLjYmR2eRFaKsUI1Sxlf5E vA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3nabuf26cm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 24 Jan 2023 15:51:20 +0000 Received: from m0098420.ppops.net (m0098420.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 30OForju021831; Tue, 24 Jan 2023 15:51:20 GMT Received: from ppma04dal.us.ibm.com (7a.29.35a9.ip4.static.sl-reverse.com [169.53.41.122]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3nabuf26c9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 24 Jan 2023 15:51:20 +0000 Received: from pps.filterd (ppma04dal.us.ibm.com [127.0.0.1]) by ppma04dal.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 30OESXOB019839; Tue, 24 Jan 2023 15:51:19 GMT Received: from smtprelay07.wdc07v.mail.ibm.com ([9.208.129.116]) by ppma04dal.us.ibm.com (PPS) with ESMTPS id 3n87p77myn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 24 Jan 2023 15:51:19 +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 30OFpI3X2687562 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 24 Jan 2023 15:51:18 GMT Received: from smtpav06.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 43E945803F; Tue, 24 Jan 2023 15:51:18 +0000 (GMT) Received: from smtpav06.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 78E145804E; Tue, 24 Jan 2023 15:51:17 +0000 (GMT) Received: from li-e362e14c-2378-11b2-a85c-87d605f3c641.ibm.com (unknown [9.163.12.142]) by smtpav06.wdc07v.mail.ibm.com (Postfix) with ESMTP; Tue, 24 Jan 2023 15:51:17 +0000 (GMT) Message-ID: <664fddbf66d61e7573ccbc0f107f428ee6e1410c.camel@us.ibm.com> From: Carl Love To: Pedro Alves , Bruno Larsen , Ulrich Weigand , "will_schmidt@vnet.ibm.com" , gdb-patches@sourceware.org Cc: Luis Machado , cel@us.ibm.com Date: Tue, 24 Jan 2023 07:51:16 -0800 In-Reply-To: <873eb58a-a6ab-08b2-0827-ca6e0c8088ae@palves.net> References: <50474aa92ba82eff05cdc8f49001eae56be29670.camel@us.ibm.com> <89331c26795e3f7743e1e068dce43b3c2dd53008.camel@us.ibm.com> <071f24ecf9b3a2bbbe8fee7db77492eb55c5f3ff.camel@us.ibm.com> <1d9b21914354bef6a290ac30673741e722e11757.camel@de.ibm.com> <3e3c9c40f07ab01c79fe10915e76ffa187c42ad9.camel@us.ibm.com> <122f5d2d3db9ef1979b0f8da927d005f32bba82c.camel@us.ibm.com> <011768e8-2b76-f8ed-1174-fbaa020b15e7@redhat.com> <58cebd1a-7883-fbc6-ac94-c67293f8fc8d@redhat.com> <5e5dc4a49aa8feb370419a1efecf277673b7dfc7.camel@us.ibm.com> <610d5f171d5f4baeb94887217e69d0e6d70e9d66.camel@us.ibm.com> <873eb58a-a6ab-08b2-0827-ca6e0c8088ae@palves.net> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 (3.28.5-18.el8) X-TM-AS-GCONF: 00 X-Proofpoint-GUID: Yxk0Bl7ng-NNOtjkw5655AblNdj-hQgv X-Proofpoint-ORIG-GUID: iIJDf_DP2DHLJsEycQNQMTduMdSGHkA_ Content-Transfer-Encoding: 7bit X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 Subject: RE: [PATCH 1/2 version 3] fix for gdb.reverse/finish-precsave.exp and gdb.reverse/finish-reverse.exp X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-23_12,2023-01-24_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=828 bulkscore=0 mlxscore=0 impostorscore=0 clxscore=1011 malwarescore=0 priorityscore=1501 lowpriorityscore=0 spamscore=0 adultscore=0 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301240141 X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,TXREP,T_SPF_TEMPERROR,URIBL_BLOCKED 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: Pedro: On Tue, 2023-01-24 at 14:08 +0000, Pedro Alves wrote: > On 2023-01-23 9:13 p.m., Carl Love wrote: > > Pedro: > > > > On Mon, 2023-01-23 at 19:17 +0000, Pedro Alves wrote: > > > > Currently on X86, when executing the finish command in reverse, > > > > gdb > > > > does a > > > > single step from the first instruction in the callee to get > > > > back to > > > > the > > > > caller. GDB stops on the last instruction in the source code > > > > line > > > > where > > > > the call was made. When stopped at the last instruction of the > > > > source code > > > > line, a reverse next or step command will stop at the first > > > > instruction > > > > of the same source code line thus requiring two step/next > > > > commands > > > > to > > > > reach the previous source code line. It should only require > > > > one > > > > step/next > > > > command to reach the previous source code line. > > > > > > > > By contrast, a reverse next or step command from the first line > > > > in > > > > a > > > > function stops at the first instruction in the source code line > > > > where the > > > > call was made. > > > > > > I'd think this was on purpose. Note that next/step/reverse- > > > {next/step} are line-oriented > > > stepping commands, they step/next until the previous/next line. > > > While "finish" is described > > > as undoing the _function call_. > > > > > > The manual says: > > > > > > reverse-finish > > > Just as the finish command takes you to the point where the > > > current > > > function returns, > > > reverse-finish takes you to the point where it was called. > > > Instead > > > of ending up at the end of > > > the current function invocation, you end up at the beginning. > > > > > > Say you have a line with multiple statements involving multiple > > > function calls. > > > The simplest would be: > > > > > > func1 (); func2 (); > > > > > > Say you'd stopped inside 'func2'. If you do finish there, in > > > current > > > master gdb > > > stops at the call to 'func2', and you can then decide to reverse > > > step > > > into 'func1'. > > > > I don't think you followed the issue. > > Totally possible! > > > So, if you are in func2 and do a reverse-finish, without the patch > > gdb > > stops on the last instruction for the line that calls func2. > > Right. > > > Now if > > you issue a reverse-step, you stop at the first instruction for the > > call to func2, i.e. you are still on the same source code line. > > Wait. That right there sounds bogus. The source line looks like: > > func1 (); func2 (); My bad, I didn't catch that you were implying func1 and func2 as being on the same source line. There is an existing bugzilla for the case of multiple executable statements on the same line. https://sourceware.org/bugzilla/show_bug.cgi?id=28426 I have worked with Luis Machado on a patch to address that issue. We have posted a few versions of the patch but it still needs some work for finish. I wanted to get back to that patch once the reverse-finish issue is done. I need to spend some more time looking at the rest of your response to understand everything you are talking about. That said, my first read looked like the issue in the bugzilla I mentioned. The patch Luis and I have for addressing multiple statements on the same line applies on top of the X86 and PowerPC reverse-finish patches. Let me spend some more time looking at your response. Thanks. Carl > > so stepping backwards over that line should always stop at the first > instruction of the line, not in the middle. Let's simplify this.