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 332413858D33 for ; Wed, 1 Mar 2023 20:59:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 332413858D33 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 (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 321KkiPp001250; Wed, 1 Mar 2023 20:59:31 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : subject : from : to : cc : date : in-reply-to : references : content-type : mime-version : content-transfer-encoding; s=pp1; bh=9uX4iOsimhSd1y2fynGNQONUWBB/C5cqBwtWuAla0zs=; b=Fmq4nCXDZxslgPfDX7UyM+x9ZUaBC3AWbY1XeUM2vJmtCckJsDN4FzCGBZ/KVAhiilqu rYzFGyIn4ZKmJ0NH2XWv2v+Jb+IufNZdjDo1v7viLGkq/kUnM1f0UJ+Aj+nGNkWNsKMj AVYFskA/oxpJqR2y4amrbmWPcXn+Ctjung0psag3mIqGEbhfen7LUCzg8GajWfJlI3/3 df38MgjbNoemqLLkTZrpnqC2IrtyLqnOY3P5G4WQeq3Z9SqyzpV3+CkPf2SPLrQdx/jr FFyjyxzBjqhGO6Tnsx5wExrSQrl58dwNd9qlPZKBztdLxCPMK0/zLKWwRGwAdOpTvkVg UA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3p2e1v88h2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 01 Mar 2023 20:59:30 +0000 Received: from m0098399.ppops.net (m0098399.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 321KrxXl028371; Wed, 1 Mar 2023 20:59:30 GMT Received: from ppma03wdc.us.ibm.com (ba.79.3fa9.ip4.static.sl-reverse.com [169.63.121.186]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3p2e1v88gd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 01 Mar 2023 20:59:30 +0000 Received: from pps.filterd (ppma03wdc.us.ibm.com [127.0.0.1]) by ppma03wdc.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 321JCF7n018818; Wed, 1 Mar 2023 20:59:28 GMT Received: from smtprelay04.dal12v.mail.ibm.com ([9.208.130.102]) by ppma03wdc.us.ibm.com (PPS) with ESMTPS id 3nybcc112c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 01 Mar 2023 20:59:28 +0000 Received: from smtpav03.wdc07v.mail.ibm.com (smtpav03.wdc07v.mail.ibm.com [10.39.53.230]) by smtprelay04.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 321KxREP5243448 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 1 Mar 2023 20:59:27 GMT Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2C35A58054; Wed, 1 Mar 2023 20:59:27 +0000 (GMT) Received: from smtpav03.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5E8185805A; Wed, 1 Mar 2023 20:59:26 +0000 (GMT) Received: from li-e362e14c-2378-11b2-a85c-87d605f3c641.ibm.com (unknown [9.163.10.51]) by smtpav03.wdc07v.mail.ibm.com (Postfix) with ESMTP; Wed, 1 Mar 2023 20:59:26 +0000 (GMT) Message-ID: Subject: [PATCH 1/2] PowerPC: fix for gdb.reverse/finish-precsave.exp and gdb.reverse/finish-reverse.exp From: Carl Love To: Tom de Vries , Ulrich Weigand , "gdb-patches@sourceware.org" , Bruno Larsen , "pedro@palves.net" Cc: cel@us.ibm.com Date: Wed, 01 Mar 2023 12:59:25 -0800 In-Reply-To: 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> 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: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: lEoYe5d-OvgAhCHxQP6ctCQRmus2CLi- X-Proofpoint-ORIG-GUID: O9YxCKZatfzzunVYYFUOdqNEgUe4H76X X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-01_15,2023-03-01_03,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 priorityscore=1501 mlxlogscore=999 malwarescore=0 lowpriorityscore=0 suspectscore=0 adultscore=0 mlxscore=0 spamscore=0 phishscore=0 bulkscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2303010162 X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,GIT_PATCH_0,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 List-Id: Tom, Ulrich, Bruno, Pedro, GDB maintainers: This patch moves the step_until procedure from gdb.reverse/step- indirect-call-thunk.exp to gdb/testsuite/lib/gdb.exp and renames it repeat_cmd_until. There are no functional changes as a result of this change. Patch tested on PowerPC and 5th generation X86 with no regression failures. Carl -------------------------------------------------------- Move step_until procedure Procedure proc_step_until from test gdb.reverse/step-indirect-call-thunk.exp is moved to lib/gdb.exp and renamed repeat_cmd_until. The existing proceedure gdb_step_until in lib/gdb.exp is simpler variant of the new repeat_cmd_until proceedure. The existing proceedure gdb_step_until is changed to just call the new repeat_cmd_until proceedure 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 proceedure gdb_step_until. --- .../gdb.reverse/step-indirect-call-thunk.exp | 49 +++---------------- gdb/testsuite/lib/gdb.exp | 49 ++++++++++++++----- 2 files changed, 46 insertions(+), 52 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..2b2a554f4c7 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -9270,31 +9270,58 @@ 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} } { +proc gdb_step_until { regexp {test_name ""} {current ""} \ + { max_steps 10 } } { + if { $current == "" } { + set current "\}" + } + if { $test_name == "" } { + set test_name "stepping until regexp" + } + + 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 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 100 steps. +# +# TEST passes if the resulting location matches TARGET and fails +# otherwise. +# +proc repeat_cmd_until { command current target test_name {max_steps 100} } { + global gdb_prompt if { $test_name == "" } { set test_name "stepping until regexp" } 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" + } } } -- 2.37.2