From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 59E48385AE41 for ; Wed, 29 Jun 2022 09:58:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 59E48385AE41 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-331-JPV2uY1ZMUWU1sxwmbg-kw-1; Wed, 29 Jun 2022 05:58:43 -0400 X-MC-Unique: JPV2uY1ZMUWU1sxwmbg-kw-1 Received: by mail-wm1-f69.google.com with SMTP id n35-20020a05600c3ba300b003a02d7bd5caso8472802wms.2 for ; Wed, 29 Jun 2022 02:58:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:in-reply-to:references:date :message-id:mime-version; bh=/GC3Hhw3GYYYCQcK86ywGltIYORC5S4sGHMDg6xF7KQ=; b=MGUCRyDmEup6crQfQUqLiRGm+ixbK26TBxscWLujNNtUsDmnujD71sAvj+nOxEG6CP cW8UssaJkiIdkg9Dcr2KN62PWFQHSabdHdt7+PvnHriv098sw7IuLqhtJqDUjvKbmNAE omrfNkA2p+nnZ5Ocqam0M/Tq9Y11mNJpJvilCqbeDBiIGPNokQ2VgTmD2kpIKVk5q0kH Mk2w5+JafI79EJj63HZMS60Wrd4Pk+mIxM7it4UE5xWhARx1OI58BK67+wb2vM50jl0t TLr358E/cyZDvL5c/V56RJC2zFnPXeoIHGGssVF8Q8pzti5pvr9BZWez7Fu+faOeYzyu QF4A== X-Gm-Message-State: AJIora9uFbFVi2VLaXsCUgflfFXU3xU4Ah1XaH2Unm/kUVFT4iGbE/Iq xTGbQmFUoj4/7X5SdLRdE12vrCDBPjGGKi3rpaW/86YnpgV2ZPiG054KVF0V5FiMXw8Zp0+FTp1 QJhSkUhqZ+NteCAo891oxtQ== X-Received: by 2002:a05:6000:156f:b0:21b:a702:d595 with SMTP id 15-20020a056000156f00b0021ba702d595mr2306351wrz.341.1656496722442; Wed, 29 Jun 2022 02:58:42 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uk4QspjcoMaEjUL0CA7IYMuMg0SnuYHvDgFNCSVt1DqdahJSYLWwW9I+0Afc/mVl+mGCJw2g== X-Received: by 2002:a05:6000:156f:b0:21b:a702:d595 with SMTP id 15-20020a056000156f00b0021ba702d595mr2306324wrz.341.1656496722020; Wed, 29 Jun 2022 02:58:42 -0700 (PDT) Received: from localhost (15.72.115.87.dyn.plus.net. [87.115.72.15]) by smtp.gmail.com with ESMTPSA id c3-20020adfef43000000b0021bab0ba755sm16739760wrp.106.2022.06.29.02.58.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jun 2022 02:58:41 -0700 (PDT) From: Andrew Burgess To: Carl Love , Carl Love via Gdb-patches , will schmidt , Ulrich Weigand Subject: RE: [PATCH] Fix for gdb.base/break-idempotent.exp In-Reply-To: <3f116734745ecd168d45584c0686b0eca3406eb4.camel@us.ibm.com> References: <8338e122e114bb9091f2f06cd0012db826ece6cb.camel@us.ibm.com> <87letidy26.fsf@redhat.com> <3f116734745ecd168d45584c0686b0eca3406eb4.camel@us.ibm.com> Date: Wed, 29 Jun 2022 10:58:40 +0100 Message-ID: <87zghvdc4v.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_LOW, 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 09:58:46 -0000 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" }