From patchwork Thu Mar 9 21:54:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carl Love X-Patchwork-Id: 66190 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CE9223858281 for ; Thu, 9 Mar 2023 21:54:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CE9223858281 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1678398882; bh=UTOpPQR667XGHkuyZyq80tmr05zgxB+pAS/zONpMYMg=; h=Subject:To:Cc:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=J6oG4uWAmZGSMlr5/Omsy4vgfw2G8r8gEkAnFiWd5nyZAXPy1n6M3xj7LabyS6/LG ZgWRHsP1A1ZpdUbXn/utqjZ8EbCDmVFzr/JkEyrgkb+67bivs9Qo7PV1kg6Pyvv3A+ QOeEu+gJ8PQSzGGJ2q9cJ6Z50NPf6nfpeR0vRBTc= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id BE3103858D20 for ; Thu, 9 Mar 2023 21:54:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BE3103858D20 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 329KAUVW012043; Thu, 9 Mar 2023 21:54:14 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3p6t3c7g71-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 09 Mar 2023 21:54:13 +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 329LKrtp024933; Thu, 9 Mar 2023 21:54:13 GMT Received: from ppma02dal.us.ibm.com (a.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.10]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3p6t3c7g6p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 09 Mar 2023 21:54:13 +0000 Received: from pps.filterd (ppma02dal.us.ibm.com [127.0.0.1]) by ppma02dal.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 329L2RJ8022786; Thu, 9 Mar 2023 21:54:12 GMT Received: from smtprelay07.wdc07v.mail.ibm.com ([9.208.129.116]) by ppma02dal.us.ibm.com (PPS) with ESMTPS id 3p6fkxxbp7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 09 Mar 2023 21:54:12 +0000 Received: from smtpav03.wdc07v.mail.ibm.com (smtpav03.wdc07v.mail.ibm.com [10.39.53.230]) by smtprelay07.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 329LsBCe66191616 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 9 Mar 2023 21:54:11 GMT Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E981B5805C; Thu, 9 Mar 2023 21:54:10 +0000 (GMT) Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 209EB5805A; Thu, 9 Mar 2023 21:54:10 +0000 (GMT) Received: from li-e362e14c-2378-11b2-a85c-87d605f3c641.ibm.com (unknown [9.163.92.223]) by smtpav03.wdc07v.mail.ibm.com (Postfix) with ESMTP; Thu, 9 Mar 2023 21:54:10 +0000 (GMT) Message-ID: Subject: [PATCH 1/2 ver 2] PowerPC: fix for gdb.reverse/finish-precsave.exp and gdb.reverse/finish-reverse.exp To: Tom Tromey , Carl Love via Gdb-patches , cel@us.ibm.com Cc: Tom de Vries , Ulrich Weigand , Bruno Larsen , "pedro@palves.net" Date: Thu, 09 Mar 2023 13:54:09 -0800 In-Reply-To: <87y1o5n3wd.fsf@tromey.com> References: <78b464a1-e32e-c3da-85e4-7bfc322cc29f@redhat.com> <7848e9858b54e33e399b871774ffc0b5058c1736.camel@us.ibm.com> <65d44121-65f7-a212-79ec-07ce53c15ecb@suse.de> <9fe94c0979cb40979b0dea7693a901c2d9f66164.camel@us.ibm.com> <59417813-eb4a-baf8-4e5d-e225d6732f71@suse.de> <7a494157-494f-6adf-d533-bf373b0f054f@redhat.com> <71aa635593df0677811afb85409aa190bcfa4f6a.camel@us.ibm.com> <15864a6b87b25c93e99a28149f23138267735f2a.camel@us.ibm.com> <041f62e9f26fd4a536bc90c34f072985582e6237.camel@de.ibm.com> <46c2c756475ba5923d7eed97996632a08285dd42.camel@us.ibm.com> <65861786-069e-53a1-ca17-a525b6629c95@suse.de> <87y1o5n3wd.fsf@tromey.com> X-Mailer: Evolution 3.28.5 (3.28.5-18.el8) Mime-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: Etz66d8nEW97OYo73abyTAbrhtgoLsXn X-Proofpoint-ORIG-GUID: o-nTd3SKfTpc9dUQlwJXzCp2xgLl45p0 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-03-09_12,2023-03-09_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 adultscore=0 malwarescore=0 bulkscore=0 mlxlogscore=999 spamscore=0 priorityscore=1501 lowpriorityscore=0 clxscore=1015 impostorscore=0 phishscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303090173 X-Spam-Status: No, score=-11.1 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 autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Carl Love via Gdb-patches From: Carl Love Reply-To: Carl Love Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" GDB maintainers, Tom, Ulrich, Bruno, Pedro: I fixed the documentation errors and changed the arguments of the proceedures to set the values by default rather than using an additional if statement. Fixed a couple of spelling mistakes in the commit log. I retested the patch to make sure everything still works. Thanks for the reviews. Carl -------------------------------------------------------- Move step_until procedure Procedure step_until from test gdb.reverse/step-indirect-call-thunk.exp is moved to lib/gdb.exp and renamed repeat_cmd_until. The existing procedure gdb_step_until in lib/gdb.exp is simpler variant of the new repeat_cmd_until procedure. The existing procedure gdb_step_until is changed to just call the new repeat_cmd_until procedure with the command set to "step" and an optional CURRENT string. The default CURRENT string is set to "\}" to work with the existing uses of procedure gdb_step_until. --- .../gdb.reverse/step-indirect-call-thunk.exp | 49 +++---------------- gdb/testsuite/lib/gdb.exp | 47 ++++++++++++------ 2 files changed, 41 insertions(+), 55 deletions(-) diff --git a/gdb/testsuite/gdb.reverse/step-indirect-call-thunk.exp b/gdb/testsuite/gdb.reverse/step-indirect-call-thunk.exp index f433efb11c2..e6c81b80a7b 100644 --- a/gdb/testsuite/gdb.reverse/step-indirect-call-thunk.exp +++ b/gdb/testsuite/gdb.reverse/step-indirect-call-thunk.exp @@ -38,39 +38,6 @@ if { ![runto_main] } { return -1 } -# Do repeated stepping COMMANDs in order to reach TARGET from CURRENT -# -# COMMAND is a stepping command -# CURRENT is a string matching the current location -# TARGET is a string matching the target location -# TEST is the test name -# -# The function issues repeated COMMANDs as long as the location matches -# CURRENT up to a maximum of 100 steps. -# -# TEST passes if the resulting location matches TARGET and fails -# otherwise. -# -proc step_until { command current target test } { - global gdb_prompt - - set count 0 - gdb_test_multiple "$command" "$test" { - -re "$current.*$gdb_prompt $" { - incr count - if { $count < 100 } { - send_gdb "$command\n" - exp_continue - } else { - fail "$test" - } - } - -re "$target.*$gdb_prompt $" { - pass "$test" - } - } -} - gdb_test_no_output "record" gdb_test "next" ".*" "record trace" @@ -90,20 +57,20 @@ gdb_test "reverse-next" "apply\.2.*" \ "reverse-step through thunks and over inc" # We can use instruction stepping to step into thunks. -step_until "stepi" "apply\.2" "indirect_thunk" "stepi into call thunk" -step_until "stepi" "indirect_thunk" "inc" \ +repeat_cmd_until "stepi" "apply\.2" "indirect_thunk" "stepi into call thunk" +repeat_cmd_until "stepi" "indirect_thunk" "inc" \ "stepi out of call thunk into inc" set alphanum_re "\[a-zA-Z0-9\]" set pic_thunk_re "__$alphanum_re*\\.get_pc_thunk\\.$alphanum_re* \\(\\)" -step_until "stepi" "(inc|$pic_thunk_re)" "return_thunk" "stepi into return thunk" -step_until "stepi" "return_thunk" "apply" \ +repeat_cmd_until "stepi" "(inc|$pic_thunk_re)" "return_thunk" "stepi into return thunk" +repeat_cmd_until "stepi" "return_thunk" "apply" \ "stepi out of return thunk back into apply" -step_until "reverse-stepi" "apply" "return_thunk" \ +repeat_cmd_until "reverse-stepi" "apply" "return_thunk" \ "reverse-stepi into return thunk" -step_until "reverse-stepi" "return_thunk" "inc" \ +repeat_cmd_until "reverse-stepi" "return_thunk" "inc" \ "reverse-stepi out of return thunk into inc" -step_until "reverse-stepi" "(inc|$pic_thunk_re)" "indirect_thunk" \ +repeat_cmd_until "reverse-stepi" "(inc|$pic_thunk_re)" "indirect_thunk" \ "reverse-stepi into call thunk" -step_until "reverse-stepi" "indirect_thunk" "apply" \ +repeat_cmd_until "reverse-stepi" "indirect_thunk" "apply" \ "reverse-stepi out of call thunk into apply" diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 19c782bea46..46bd40318f6 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -9270,31 +9270,50 @@ gdb_caching_proc arm_cc_for_target { # Step until the pattern REGEXP is found. Step at most # MAX_STEPS times, but stop stepping once REGEXP is found. -# +# CURRENT matches current location # If REGEXP is found then a single pass is emitted, otherwise, after # MAX_STEPS steps, a single fail is emitted. # # TEST_NAME is the name used in the pass/fail calls. -proc gdb_step_until { regexp {test_name ""} {max_steps 10} } { - if { $test_name == "" } { - set test_name "stepping until regexp" - } +proc gdb_step_until { regexp {test_name "stepping until regexp"} \ + {current "\}"} { max_steps 10 } } { + repeat_cmd_until "step" $current $regexp $test_name "10" +} + +# Do repeated stepping COMMANDs in order to reach TARGET from CURRENT +# +# COMMAND is a stepping command +# CURRENT is a string matching the current location +# TARGET is a string matching the target location +# TEST_NAME is the test name +# MAX_STEPS is number of steps attempted before fail is emitted +# +# The function issues repeated COMMANDs as long as the location matches +# CURRENT up to a maximum of MAX_STEPS. +# +# TEST_NAME passes if the resulting location matches TARGET and fails +# otherwise. + +proc repeat_cmd_until { command current target \ + {test_name "stepping until regexp"} \ + {max_steps 100} } { + global gdb_prompt set count 0 - gdb_test_multiple "step" "$test_name" { - -re "$regexp\r\n$::gdb_prompt $" { - pass $test_name - } - -re ".*$::gdb_prompt $" { - if {$count < $max_steps} { - incr count - send_gdb "step\n" + gdb_test_multiple "$command" "$test_name" { + -re "$current.*$gdb_prompt $" { + incr count + if { $count < $max_steps } { + send_gdb "$command\n" exp_continue } else { - fail $test_name + fail "$test_name" } } + -re "$target.*$gdb_prompt $" { + pass "$test_name" + } } }