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 0B7A43851C13 for ; Wed, 29 Jun 2022 15:34:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0B7A43851C13 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 25TFQbuh029487 for ; Wed, 29 Jun 2022 15:34:20 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3h0sctr6wp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 29 Jun 2022 15:34:20 +0000 Received: from m0098417.ppops.net (m0098417.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 25TFSpfP006931 for ; Wed, 29 Jun 2022 15:34:19 GMT Received: from ppma01wdc.us.ibm.com (fd.55.37a9.ip4.static.sl-reverse.com [169.55.85.253]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3h0sctr6w8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 Jun 2022 15:34:19 +0000 Received: from pps.filterd (ppma01wdc.us.ibm.com [127.0.0.1]) by ppma01wdc.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 25TFL3N6015567; Wed, 29 Jun 2022 15:34:19 GMT Received: from b01cxnp22036.gho.pok.ibm.com (b01cxnp22036.gho.pok.ibm.com [9.57.198.26]) by ppma01wdc.us.ibm.com with ESMTP id 3gwt09gg9h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 Jun 2022 15:34:18 +0000 Received: from b01ledav001.gho.pok.ibm.com (b01ledav001.gho.pok.ibm.com [9.57.199.106]) by b01cxnp22036.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 25TFYI5r10552014 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 29 Jun 2022 15:34:18 GMT Received: from b01ledav001.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 858B628058; Wed, 29 Jun 2022 15:34:18 +0000 (GMT) Received: from b01ledav001.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 06DF32805E; Wed, 29 Jun 2022 15:34:18 +0000 (GMT) Received: from li-e362e14c-2378-11b2-a85c-87d605f3c641.ibm.com (unknown [9.211.68.56]) by b01ledav001.gho.pok.ibm.com (Postfix) with ESMTP; Wed, 29 Jun 2022 15:34:17 +0000 (GMT) Message-ID: <54294fecf3baf625715a5748827948f86d657234.camel@us.ibm.com> From: Carl Love To: Andrew Burgess , Carl Love via Gdb-patches , will schmidt , Ulrich Weigand Date: Wed, 29 Jun 2022 08:34:17 -0700 In-Reply-To: <87zghvdc4v.fsf@redhat.com> References: <8338e122e114bb9091f2f06cd0012db826ece6cb.camel@us.ibm.com> <87letidy26.fsf@redhat.com> <3f116734745ecd168d45584c0686b0eca3406eb4.camel@us.ibm.com> <87zghvdc4v.fsf@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: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: MSVEOc76VnHZm95OVL1EIZtq5DqdKfDl X-Proofpoint-ORIG-GUID: J3jrJBrwCQvlJDtv1LT5XIdRTJTzMkD6 Subject: RE: [PATCH] Fix for gdb.base/break-idempotent.exp X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-06-29_17,2022-06-28_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 lowpriorityscore=0 spamscore=0 priorityscore=1501 malwarescore=0 phishscore=0 clxscore=1015 impostorscore=0 suspectscore=0 adultscore=0 bulkscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206290056 X-Spam-Status: No, score=-12.0 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 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: Wed, 29 Jun 2022 15:34:23 -0000 Andrew: Thanks for letting me know. I did a fresh pull, build and test to verify everything looks good on my system. Thanks for the help getting this fixed. Carl On Wed, 2022-06-29 at 10:58 +0100, Andrew Burgess wrote: > Carl Love via Gdb-patches writes: > > > Andrew: > > > > Thanks for looking at the patch. I am fine with you using your > > patch > > and merging in anything from mine that is useful. Thanks for > > sharing > > you insight on the issues. Thanks for the help in getting this > > fixed. > > Carl, > > I pushed the patch below. > > Thanks, > Andrew > > --- > > commit 13f72372413400410aaa94b7f0e2ff7de663fdcb > Author: Carl Love > Date: Wed Jun 22 16:14:20 2022 +0100 > > gdb/testsuite: fix gdb.base/break-idempotent.exp on ppc > > When running the gdb.base/break-idempotent.exp test on ppc, I was > seeing some test failures (or rather errors), that looked like > this: > > (gdb) watch local > Hardware watchpoint 2: local > > has_hw_wp_support: Hardware watchpoint detected > ERROR: no fileid for gcc2-power8 > ERROR: Couldn't send delete breakpoints to GDB. > ERROR OCCURED: can't read "gdb_spawn_id": no such variable > while executing > "expect { > -i 1000 -timeout 100 > -re ".*A problem internal to GDB has been detected" { > fail "$message (GDB internal error)" > gdb_internal_erro..." > ("uplevel" body line 1) > invoked from within > > What happens is that in break-idempotent.exp we basically do > this: > > if {[prepare_for_testing "failed to prepare" $binfile > $srcfile $opts]} { > continue > } > > # .... > > if {![skip_hw_watchpoint_tests]} { > test_break $always_inserted "watch" > } > > The problem with this is that skip_hw_watchpoint_tests, includes > this: > > if { [istarget "i?86-*-*"] > || [istarget "x86_64-*-*"] > || [istarget "ia64-*-*"] > || [istarget "arm*-*-*"] > || [istarget "aarch64*-*-*"] > || ([istarget "powerpc*-*-linux*"] && > [has_hw_wp_support]) > || [istarget "s390*-*-*"] } { > return 0 > } > > For powerpc only we call has_hw_wp_support. This is a caching > proc > that runs a test within GDB to detect if we have hardware > watchpoint > support or not. > > Unfortunately, to run this test we restart GDB, and when the test > has > completed, we exit GDB. This means that in break-idempotent.exp, > when > we call skip_hw_watchpoint_tests for the first time on powerpc, > GDB > will unexpectedly be exited. When we later call > delete_breakpoints we > see the errors I reported above. > > The fix is to call skip_hw_watchpoint_tests early, before we > start GDB > as part of the break-idempotent.exp script, and store the result > in a > variable, we can then check this variable in the script as > needed. > > After this change break-idempotent.exp runs fine on powerpc. > > Co-authored-by: Andrew Burgess > > diff --git a/gdb/testsuite/gdb.base/break-idempotent.exp > b/gdb/testsuite/gdb.base/break-idempotent.exp > index 29002f103a8..837ac000b57 100644 > --- a/gdb/testsuite/gdb.base/break-idempotent.exp > +++ b/gdb/testsuite/gdb.base/break-idempotent.exp > @@ -36,6 +36,12 @@ > > standard_testfile > > +# The skip_hw_watchpoint_tests starts GDB on a small test program to > +# check if HW watchpoints are supported. We do not want to restart > +# GDB after this test script has itself started GDB, so call > +# skip_hw_watchpoint_tests first and cache the result. > +set skip_hw_watchpoint_tests_p [skip_hw_watchpoint_tests] > + > # Force a breakpoint re-set in GDB. Currently this is done by > # reloading symbols with the "file" command. > > @@ -174,7 +180,7 @@ foreach_with_prefix pie { "nopie" "pie" } { > test_break $always_inserted "hbreak" > } > > - if {![skip_hw_watchpoint_tests]} { > + if {!$skip_hw_watchpoint_tests_p} { > test_break $always_inserted "watch" > } > >