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 0803E385773E for ; Wed, 10 May 2023 17:16:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0803E385773E 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 (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34AHGA73021704; Wed, 10 May 2023 17:16:24 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 : mime-version : content-transfer-encoding : subject; s=pp1; bh=8oaJZDZ0K4q8lQ3N2rv9qbw5unbn0z2zbv2KICc6QX4=; b=gPkO66ZDL0330Ug8HeRScj1fp/6poU4y0WRAmD1a3W0yZt+0lKcjNAwFLeVUDRqWnsdz D5QPjVmLhhDxNd/Il4AwjoJw+86/d5WPx8KdtfYm4tY3ndLhRhFo0FPaoCnGzlXr+Bt3 sKM0XV5Ay62Ykc509Ed2lOPMambdx6FDuGj/XsSG3NLBMGD4eDtwRz0xrfa5UWyNJ2vx 1WRHX4TsT8pbwXFjld4HJggmYXXh+KLX97b5Qio3ZkXnYBr4U67VsHRQv7cNoCf/4eGr /u6oTbVGdwVj2ynbt72crvHQ305PhZUlgAgib3QIOatC3Z2UVuOVwD5KWJclmXa+TtG/ Lw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3qgaa2kgj1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 10 May 2023 17:16:23 +0000 Received: from m0353729.ppops.net (m0353729.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 34AHGNRU022627; Wed, 10 May 2023 17:16:23 GMT Received: from ppma05wdc.us.ibm.com (1b.90.2fa9.ip4.static.sl-reverse.com [169.47.144.27]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3qgaa2kgh0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 10 May 2023 17:16:23 +0000 Received: from pps.filterd (ppma05wdc.us.ibm.com [127.0.0.1]) by ppma05wdc.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 34AGHfjt002671; Wed, 10 May 2023 17:16:21 GMT Received: from smtprelay03.dal12v.mail.ibm.com ([9.208.130.98]) by ppma05wdc.us.ibm.com (PPS) with ESMTPS id 3qf88u9vqv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 10 May 2023 17:16:21 +0000 Received: from smtpav03.wdc07v.mail.ibm.com (smtpav03.wdc07v.mail.ibm.com [10.39.53.230]) by smtprelay03.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 34AHGKLD131632 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 10 May 2023 17:16:20 GMT Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1D8E158054; Wed, 10 May 2023 17:16:20 +0000 (GMT) Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 549E45805A; Wed, 10 May 2023 17:16:19 +0000 (GMT) Received: from li-e362e14c-2378-11b2-a85c-87d605f3c641.ibm.com (unknown [9.163.31.184]) by smtpav03.wdc07v.mail.ibm.com (Postfix) with ESMTP; Wed, 10 May 2023 17:16:19 +0000 (GMT) Message-ID: <956b8c3c9a7bdc3aa6f9a040619ec4778edc9c94.camel@us.ibm.com> From: Carl Love To: Bruno Larsen , gdb-patches@sourceware.org, UlrichWeigand , pedro@palves.net Cc: luis.machado@arm.com, cel@us.ibm.com Date: Wed, 10 May 2023 10:16:18 -0700 In-Reply-To: <0a2c4ebd-f01d-4b96-1b13-25d7276056a5@redhat.com> References: <74630f1ccb6e9258ae60682105ee5490726fb255.camel@us.ibm.com> <46d73c69-9168-44c6-b515-23dd893fc0eb@redhat.com> <86c65f2ad74caffc162f100e4e9c5be9062a7f59.camel@us.ibm.com> <0a2c4ebd-f01d-4b96-1b13-25d7276056a5@redhat.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 (3.28.5-18.el8) Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: XwEMez4RYAmZ7LDb_jdFxcw3CQzMMnBG X-Proofpoint-ORIG-GUID: s1GDKLYG66l4HXQdMaA2tuxW4S9yoHle Subject: RE: [PATCH v3] Fix reverse stepping multiple contiguous PC ranges over the line table. X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-10_04,2023-05-05_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 spamscore=0 impostorscore=0 malwarescore=0 lowpriorityscore=0 bulkscore=0 priorityscore=1501 phishscore=0 clxscore=1015 suspectscore=0 adultscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2305100137 X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,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: Bruno: Thanks for the review. I addressed your comments as mentioned below. I will post version 4 with the changes. FYI, I will be out of the office from May 11 thru May 15. So will reply to any additional comments when I return. On Wed, 2023-05-10 at 15:47 +0200, Bruno Larsen wrote: > On 04/05/2023 17:59, Carl Love wrote: > > Bruno, GDB maintainers: > > > > Version 3, added the gcc version check as discussed further from > > version 2 of the patch. Also updated the tests to check for > > supporting > > > > extern struct symtab *find_pc_line_symtab (CORE_ADDR); > > diff --git a/gdb/testsuite/gdb.reverse/func-map-to-same-line.c > > b/gdb/testsuite/gdb.reverse/func-map-to-same-line.c > > new file mode 100644 > > index 00000000000..412ab180943 > > --- /dev/null > > +++ b/gdb/testsuite/gdb.reverse/func-map-to-same-line.c > > @@ -0,0 +1,36 @@ > > +/* Copyright 2008-2023 Free Software Foundation, Inc. > > + > > + This program is free software; you can redistribute it and/or > > modify > > + it under the terms of the GNU General Public License as > > published by > > + the Free Software Foundation; either version 3 of the License, > > or > > + (at your option) any later version. > > + > > + This program is distributed in the hope that it will be useful, > > + but WITHOUT ANY WARRANTY; without even the implied warranty of > > + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > > + GNU General Public L > > + > > +require supports_reverse > > + > > +# This test uses the gcc no-column-info command which was added in > > gcc 7.1. > > +require get_compiler_info "gcc-7-*" I put the compiler check in last. When I ran it, I obviously didn't double check gdb/testsuite/gdb.log to make sure it really worked. I normally try to make a point of double checking the log file. I have been burned before thinking it was OK when there were no errors visible on the command line. The above command fails if you check the log file. > > By constructing your regex like this, you are only allowing this test > to > be run on gcc 7. Anything later is also not accepted. I would do > something like (Warning, untested) > > require get_compiler_info "gcc" > require !get_compiler_info "gcc-[1-6]-*" I couldn't get require to work like that. The get_compiler_info doesn't seem take "gcc" as an argument. I changed the test to: if {![test_compiler_info {gcc-*}] || [test_compiler_info {gcc-[1-6]-*}]} { return } With this, I do see the correct number of passes in gdb/testsuite/gdb.log. > > Which requires gcc, but does not allow versions 1 to 6. There is > probably a way to do it with a single require line, but I'm not the > best > with regexes. > > > + > > +proc run_tests {msg} { > > + global srcfile > > + global executable > > + > > + runto_main > > + set target_remote [gdb_is_target_remote] > > When probing for target remote, GDB will emit pass/fails with > hardcoded > names, so the current proc setup gives us some duplicated test names. > > I would suggest that, instead of passing a message as a parameter, > you > wrapped all function calls in a with_test_prefix scope, like: > > with_test_prefix "with-column-info" { > run_test > } OK, I changed from passing in an argument and did the wrapped calls to run_test instead. Note, this still didn't fix the duplicate test names for turning on record. > > > + > > + gdb_test_no_output "record" "turn on process record" > > + > > + # This regression test verifies the reverse-step and reverse- > > next commands > > + # work properly when executing backwards thru a source line > > containing > > + # two function calls on the same source line, i.e. func1 (); > > func2 (); > > + # This test is compiled so the dwarf info not contain the line > > table > > + # information. > > + > > + # Test 1, reverse-next command > > + # Set breakpoint at the line after the function calls. > > + set bp_start_reverse_test [gdb_get_line_number "START REVERSE > > TEST" \ > > + $srcfile] > > + gdb_breakpoint $srcfile:$bp_start_reverse_test temporary > > + > > + # Continue to break point for reverse-next test. > > + # Command definition: reverse-next [count] > > + # Run backward to the beginning of the previous line > > executed in the > > + # current (innermost) stack frame. If the line contains > > function calls, > > + # they will be “un-executed” without stopping. Starting from > > the first > > + # line of a function, reverse-next will take you back to the > > caller of > > + # that function, before the function was called, just as the > > normal next > > + # command would take you from the last line of a function > > back to its > > + # return to its caller 2 . > > + gdb_continue_to_breakpoint \ > > + "$msg: test1: stopped at command reverse-next test start > > location" \ > > + ".*$srcfile:$bp_start_reverse_test\r\n.*" > > + > > + # The reverse-next should step all the way back to the > > beginning of the > > + # line, i.e. at the beginning of the func1 call. > > + gdb_test "reverse-next" ".*func1 \\(\\); func2 \\(\\);.*" \ > > + "$msg: test1: reverse-next to line with two functions" > > + > > + # We should be stopped at the first instruction of the line. A > > reverse-step > > + # should step back and stop at the beginning of the previous > > line b = 2, > > + # i.e. not in func1 (). > > + gdb_test "reverse-stepi" ".*b = 2;.*" \ > > + "$msg: test1: reverse-stepi to previous line b = 2" > > + > > + > > + # Setup for test 2 > > + clean_restart $executable > > + runto_main > > + > > + gdb_test_no_output "record" "turn on process record" > > This gives a duplicate test name from setting up for the first test. > Adding "test 2:(...)" in here solves it. I couldn't figure out how to get the above syntax to work. So I used the with_test_prefix instead, i.e. with_test_prefix "test2" { gdb_test_no_output "record" "turn on process record" } That fixed the duplicate names. I also wrapped the first record with "test1" for consistency. > > > + > > + # Test 2, reverse-step command > > + # Set breakpoint at the line after the function calls. > > + gdb_breakpoint $srcfile:$bp_start_reverse_test temporary > > + > > > > +# the same line to do the needed testing. > > + > > +# This test can only be run on targets which support DWARF-2 and > > use gas. > > +require dwarf2_support > > +load_lib dwarf.exp > the library has to be imported before the "require" OK, switched the order of the lines. > > + > > +# The DWARF assembler requires the gcc compiler. > > +require is_c_compiler_gcc > > + > > +# This test suitable only for process that can do reverse > > execution > > +requires supports_reverse > > s/requires/require Fixed. Carl