From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 2E0F33858D28 for ; Fri, 12 Nov 2021 00:28:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2E0F33858D28 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 1ABNmFIa002780; Fri, 12 Nov 2021 00:28:47 GMT Received: from ppma04wdc.us.ibm.com (1a.90.2fa9.ip4.static.sl-reverse.com [169.47.144.26]) by mx0a-001b2d01.pphosted.com with ESMTP id 3c9ay6aupy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 12 Nov 2021 00:28:47 +0000 Received: from pps.filterd (ppma04wdc.us.ibm.com [127.0.0.1]) by ppma04wdc.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 1AC0J0sf007406; Fri, 12 Nov 2021 00:28:46 GMT Received: from b03cxnp07028.gho.boulder.ibm.com (b03cxnp07028.gho.boulder.ibm.com [9.17.130.15]) by ppma04wdc.us.ibm.com with ESMTP id 3c9854eypa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 12 Nov 2021 00:28:46 +0000 Received: from b03ledav006.gho.boulder.ibm.com (b03ledav006.gho.boulder.ibm.com [9.17.130.237]) by b03cxnp07028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 1AC0SjTW30605990 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Nov 2021 00:28:45 GMT Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D17C9C605A; Fri, 12 Nov 2021 00:28:45 +0000 (GMT) Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7E3B1C6059; Fri, 12 Nov 2021 00:28:45 +0000 (GMT) Received: from li-e362e14c-2378-11b2-a85c-87d605f3c641.ibm.com (unknown [9.211.101.135]) by b03ledav006.gho.boulder.ibm.com (Postfix) with ESMTP; Fri, 12 Nov 2021 00:28:45 +0000 (GMT) Message-ID: <592925571914d01d1669167994c074920a44a427.camel@us.ibm.com> From: Carl Love To: Tom de Vries , gdb-patches@sourceware.org, Will Schmidt , Rogerio Alves Date: Thu, 11 Nov 2021 16:28:44 -0800 In-Reply-To: References: <0a9375881ccc306f3e66d83ff5206594d53fed0e.camel@us.ibm.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 (3.28.5-16.el8) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: PdSNkc8y_3_n1TkctNceeV2MZVt_CFf1 X-Proofpoint-GUID: PdSNkc8y_3_n1TkctNceeV2MZVt_CFf1 Subject: RE: [PATCH] Fix for the gdb.base/sigstep.exp test. X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-11-11_09,2021-11-11_01,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 adultscore=0 impostorscore=0 mlxscore=0 malwarescore=0 lowpriorityscore=0 clxscore=1015 priorityscore=1501 bulkscore=0 phishscore=0 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2111110122 X-Spam-Status: No, score=-12.4 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_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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-List-Received-Date: Fri, 12 Nov 2021 00:28:49 -0000 Tom: > > The description here does not tell us why two stepi commands are > required, while its obvious if you show it. I'd include the relevant > part of the gdb log in the commit message to clarify why you're > making > the change. > > Anyway, using this change all 6 FAILs disappear. > > > The second change in proc advance is due to gdb stopping int the > > prolog of > > the function on PPC. Specificially it stops at the opening brace > > for the > > function not with the first line of code. The patch adds an extra > > step for > > PPC to get gdb to the expected location. > > Do you really need this bit? If so, can you show why? I actually made the "second change" discussed above. It fixed 2 of the errors. Then I did the "first change" in the patch. I went back and is seems the "second change" is no longer needed. The bottom line is we only need one fix to take care of all failures. > > > --- > > gdb/testsuite/gdb.base/sigstep.exp | 17 ++++++++++++++++- > > 1 file changed, 16 insertions(+), 1 deletion(-) > > > > diff --git a/gdb/testsuite/gdb.base/sigstep.exp > > b/gdb/testsuite/gdb.base/sigstep.exp > > index ea254af5297..dca9d39d1b6 100644 > > --- a/gdb/testsuite/gdb.base/sigstep.exp > > +++ b/gdb/testsuite/gdb.base/sigstep.exp > > @@ -93,7 +93,17 @@ proc advance { enter_cmd in_handler_prefix > > in_handler exit_cmd } { > > gdb_test "handle SIGVTALRM print pass stop" > > gdb_test "continue" "Program received signal.*" "continue > > to signal" > > } > > - gdb_test "$enter_cmd" ".*handler .*" "$enter_cmd to handler" > > + > > + set test_cmd ".*handler .*" > > The second parameter of gdb_test is a regexp, not a command. > > > + gdb_test_multiple "$enter_cmd" "$enter_cmd to handler" { > > + -re "handler .*sig=.*" { > > Both regexps are missing a -wrap, otherwise you're not consuming the > prompt. > > > + pass "$test_cmd" > > The name of the test is "$enter_cmd to handler", and it's available > as > $gdb_test_name. > > > + } > > + -re ".*signal handler called.*" { > > + #ppc is at branch instruction, need one more stepi to get > > to handler > > + gdb_test "$enter_cmd" ".*handler .*" "$enter_cmd to handler > > ppc" > > + } > > + } > > [ Missing indentation. ] > > I guess it's easier to reuse the first regexp using exp_continue > rather > than using another gdb_test. If not, you can also assign the regexp > to > a variable, and use that one twice. I like this fix better than what I had did. Below is the updated patch. I has been tested on PPC and Intel. The test passes on both platforms without errors. Carl ----------------------------------------------------- Fix for the sigstep.exp test. The test stops at which is the call to the handler rather than in the handler as intended. This patch replaces the gdb_test "$enter_cmd to handler" with a gdb_test_multiple test. The multiple test looks for the stop at . If found, the command is issued again. The test passes if gdb stops in the handler as expected. (gdb) PASS: gdb.base/sigstep.exp: stepi to handler, nothing in handler, step fr\ om handler: continue to signal stepi 1: x/i $pc => 0x7ffff7f80440 <__kernel_start_sigtramp_rt64>: bctrl (gdb) stepi handler (sig=551) at /home/carll/GDB/build-current/gdb/testsuite/../../../binut\ ils-gdb-current/gdb/testsuite/gdb.base/sigstep.c:32 32 { 1: x/i $pc => 0x10000097c : addis r2,r12,2 (gdb) PASS: gdb.base/sigstep.exp: stepi to handler, nothing in handler, step from handler: stepi to handler --- gdb/testsuite/gdb.base/sigstep.exp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/gdb.base/sigstep.exp b/gdb/testsuite/gdb.base/sigstep.exp index ea254af5297..7bdadfd5823 100644 --- a/gdb/testsuite/gdb.base/sigstep.exp +++ b/gdb/testsuite/gdb.base/sigstep.exp @@ -79,6 +79,7 @@ validate_backtrace proc advance { enter_cmd in_handler_prefix in_handler exit_cmd } { global gdb_prompt inferior_exited_re global clear_done other_handler_location + global decimal set prefix "$enter_cmd to handler, $in_handler_prefix in handler, $exit_cmd from handler" @@ -93,7 +94,17 @@ proc advance { enter_cmd in_handler_prefix in_handler exit_cmd } { gdb_test "handle SIGVTALRM print pass stop" gdb_test "continue" "Program received signal.*" "continue to signal" } - gdb_test "$enter_cmd" ".*handler .*" "$enter_cmd to handler" + + set test_cmd ".*handler .*" + gdb_test_multiple "$enter_cmd" "$enter_cmd to handler" { + -re -wrap "\r\n.*" { + send_gdb "$enter_cmd\n" + exp_continue + } + -re -wrap "\r\n(Breakpoint $decimal, )?handler \\(sig=.*" { + pass $gdb_test_name + } + } delete_breakpoints -- 2.30.2