Use software watchpoints if hardware watchpoints are not available when testing gdb.base/watch-bitfields.exp.
Message ID | 1428950158-15872-1-git-send-email-lgustavo@codesourcery.com |
---|---|
State | New, archived |
Headers |
Received: (qmail 23775 invoked by alias); 13 Apr 2015 18:36:08 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: <gdb-patches.sourceware.org> List-Unsubscribe: <mailto:gdb-patches-unsubscribe-##L=##H@sourceware.org> List-Subscribe: <mailto:gdb-patches-subscribe@sourceware.org> List-Archive: <http://sourceware.org/ml/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-help@sourceware.org>, <http://sourceware.org/ml/#faqs> Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 23766 invoked by uid 89); 13 Apr 2015 18:36:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 13 Apr 2015 18:36:06 +0000 Received: from svr-orw-fem-04.mgc.mentorg.com ([147.34.97.41]) by relay1.mentorg.com with esmtp id 1YhjDH-0007b4-6D from Luis_Gustavo@mentor.com for gdb-patches@sourceware.org; Mon, 13 Apr 2015 11:36:03 -0700 Received: from opsys.world.mentorg.com (147.34.91.1) by svr-orw-fem-04.mgc.mentorg.com (147.34.97.41) with Microsoft SMTP Server id 14.3.224.2; Mon, 13 Apr 2015 11:36:02 -0700 From: Luis Machado <lgustavo@codesourcery.com> To: <gdb-patches@sourceware.org> Subject: [PATCH] Use software watchpoints if hardware watchpoints are not available when testing gdb.base/watch-bitfields.exp. Date: Mon, 13 Apr 2015 15:35:58 -0300 Message-ID: <1428950158-15872-1-git-send-email-lgustavo@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes |
Commit Message
Luis Machado
April 13, 2015, 6:35 p.m. UTC
There are targets GDB thinks support hardware watchpoints, but in reality they don't. Though it may seem that hardware watchpoint creation was successful, the actual insertion of such watchpoint will fail when GDB moves the inferior. (gdb) watch -location q.a^M Hardware watchpoint 2: -location q.a^M (gdb) PASS: gdb.base/watch-bitfields.exp: -location watch against bitfields: watch -location q.a watch -location q.e^M Hardware watchpoint 3: -location q.e^M (gdb) PASS: gdb.base/watch-bitfields.exp: -location watch against bitfields: watch -location q.e print q.a^M $1 = 0^M (gdb) PASS: gdb.base/watch-bitfields.exp: -location watch against bitfields: q.a: 0->1: print expression before continue^M Continuing.^M Warning:^M Could not insert hardware watchpoint 2.^M Could not insert hardware watchpoint 3.^M Could not insert hardware breakpoints:^M You may have requested too many hardware breakpoints/watchpoints.^M ^M (gdb) FAIL: gdb.base/watch-bitfields.exp: -location watch against bitfields: q.a: 0->1: continue This leads to a number of FAILs: FAIL: gdb.base/watch-bitfields.exp: -location watch against bitfields: q.a: 0->1: continue FAIL: gdb.base/watch-bitfields.exp: -location watch against bitfields: q.a: 0->1: print expression after FAIL: gdb.base/watch-bitfields.exp: -location watch against bitfields: q.e: 0->5: continue FAIL: gdb.base/watch-bitfields.exp: -location watch against bitfields: q.e: 0->5: print expression after FAIL: gdb.base/watch-bitfields.exp: -location watch against bitfields: q.a: 1->0: print expression before FAIL: gdb.base/watch-bitfields.exp: -location watch against bitfields: q.a: 1->0: continue FAIL: gdb.base/watch-bitfields.exp: -location watch against bitfields: q.e: 5->4: print expression before FAIL: gdb.base/watch-bitfields.exp: -location watch against bitfields: q.e: 5->4: continue FAIL: gdb.base/watch-bitfields.exp: -location watch against bitfields: q.e: 5->4: print expression after FAIL: gdb.base/watch-bitfields.exp: -location watch against bitfields: continue until exit FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 0->4: continue FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 0->4: print expression after FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 4->10: print expression before FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 4->10: continue FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 4->10: print expression after FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 10->3: print expression before FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 10->3: continue FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 10->3: print expression after FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 3->2: print expression before FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 3->2: continue FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 3->2: print expression after FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 2->1: print expression before FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 2->1: continue FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 2->1: print expression after FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 1->0: print expression before FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 1->0: continue FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: continue until exit We can avoid these errors/FAILs by checking the board data and switching to software watchpoints if the board does not support hardware watchpoints. Regression tested on x86-64-linux and aarch64-linux (QEMU). Ok? 2015-04-13 Luis Machado <lgustavo@codesourcery.com> gdb/testsuite/ChangeLog/ * gdb.base/watch-bitfields.exp: Switch to software watchpoints if the target does not support hardware watchpoints. --- gdb/testsuite/gdb.base/watch-bitfields.exp | 5 +++++ 1 file changed, 5 insertions(+)
Comments
Luis Machado <lgustavo@codesourcery.com> writes: Hi Luis, > +# Disable hardware watchpoints if the target does not support it. > +if [target_info exists gdb,no_hardware_watchpoints] { > + gdb_test_no_output "set can-use-hw-watchpoints 0" > +} > + > test_watch_location > test_regular_watch The fix looks right to me, but why don't we invoke test_watch_location and test_regular_watch twice? if [target_info exists gdb,no_hardware_watchpoints] is false, set can-use-hw-watchpoints 1, and run them. Then, "set can-use-hw-watchpoints 0" and run them again. Similar to what we are doing in gdb.base/watch-vfork.exp. In this way, we can exercise software watchpoint on targets have hardware watchpoints too.
Ping? On 04/13/2015 03:35 PM, Luis Machado wrote: > There are targets GDB thinks support hardware watchpoints, but in reality they > don't. Though it may seem that hardware watchpoint creation was successful, > the actual insertion of such watchpoint will fail when GDB moves the inferior. > > (gdb) watch -location q.a^M > Hardware watchpoint 2: -location q.a^M > (gdb) PASS: gdb.base/watch-bitfields.exp: -location watch against bitfields: watch -location q.a > watch -location q.e^M > Hardware watchpoint 3: -location q.e^M > (gdb) PASS: gdb.base/watch-bitfields.exp: -location watch against bitfields: watch -location q.e > print q.a^M > $1 = 0^M > (gdb) PASS: gdb.base/watch-bitfields.exp: -location watch against bitfields: q.a: 0->1: print expression before > continue^M > Continuing.^M > Warning:^M > Could not insert hardware watchpoint 2.^M > Could not insert hardware watchpoint 3.^M > Could not insert hardware breakpoints:^M > You may have requested too many hardware breakpoints/watchpoints.^M > ^M > (gdb) FAIL: gdb.base/watch-bitfields.exp: -location watch against bitfields: q.a: 0->1: continue > > This leads to a number of FAILs: > > FAIL: gdb.base/watch-bitfields.exp: -location watch against bitfields: q.a: 0->1: continue > FAIL: gdb.base/watch-bitfields.exp: -location watch against bitfields: q.a: 0->1: print expression after > FAIL: gdb.base/watch-bitfields.exp: -location watch against bitfields: q.e: 0->5: continue > FAIL: gdb.base/watch-bitfields.exp: -location watch against bitfields: q.e: 0->5: print expression after > FAIL: gdb.base/watch-bitfields.exp: -location watch against bitfields: q.a: 1->0: print expression before > FAIL: gdb.base/watch-bitfields.exp: -location watch against bitfields: q.a: 1->0: continue > FAIL: gdb.base/watch-bitfields.exp: -location watch against bitfields: q.e: 5->4: print expression before > FAIL: gdb.base/watch-bitfields.exp: -location watch against bitfields: q.e: 5->4: continue > FAIL: gdb.base/watch-bitfields.exp: -location watch against bitfields: q.e: 5->4: print expression after > FAIL: gdb.base/watch-bitfields.exp: -location watch against bitfields: continue until exit > FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 0->4: continue > FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 0->4: print expression after > FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 4->10: print expression before > FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 4->10: continue > FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 4->10: print expression after > FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 10->3: print expression before > FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 10->3: continue > FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 10->3: print expression after > FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 3->2: print expression before > FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 3->2: continue > FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 3->2: print expression after > FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 2->1: print expression before > FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 2->1: continue > FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 2->1: print expression after > FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 1->0: print expression before > FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: q.d + q.f + q.g: 1->0: continue > FAIL: gdb.base/watch-bitfields.exp: regular watch against bitfields: continue until exit > > We can avoid these errors/FAILs by checking the board data and switching to > software watchpoints if the board does not support hardware watchpoints. > > Regression tested on x86-64-linux and aarch64-linux (QEMU). > > Ok? > > 2015-04-13 Luis Machado <lgustavo@codesourcery.com> > > gdb/testsuite/ChangeLog/ > * gdb.base/watch-bitfields.exp: Switch to software watchpoints if > the target does not support hardware watchpoints. > --- > gdb/testsuite/gdb.base/watch-bitfields.exp | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/gdb/testsuite/gdb.base/watch-bitfields.exp b/gdb/testsuite/gdb.base/watch-bitfields.exp > index 9d5293b..9f0192d 100644 > --- a/gdb/testsuite/gdb.base/watch-bitfields.exp > +++ b/gdb/testsuite/gdb.base/watch-bitfields.exp > @@ -77,5 +77,10 @@ proc test_regular_watch {} { > } > } > > +# Disable hardware watchpoints if the target does not support it. > +if [target_info exists gdb,no_hardware_watchpoints] { > + gdb_test_no_output "set can-use-hw-watchpoints 0" > +} > + > test_watch_location > test_regular_watch >
Luis Machado <lgustavo@codesourcery.com> writes: > 2015-04-13 Luis Machado <lgustavo@codesourcery.com> > > gdb/testsuite/ChangeLog/ > * gdb.base/watch-bitfields.exp: Switch to software watchpoints if > the target does not support hardware watchpoints. The patch looks good to me.
On 04/28/2015 07:42 AM, Yao Qi wrote: > Luis Machado <lgustavo@codesourcery.com> writes: > >> 2015-04-13 Luis Machado <lgustavo@codesourcery.com> >> >> gdb/testsuite/ChangeLog/ >> * gdb.base/watch-bitfields.exp: Switch to software watchpoints if >> the target does not support hardware watchpoints. > > The patch looks good to me. > I've pushed this on too. Thanks! Luis
diff --git a/gdb/testsuite/gdb.base/watch-bitfields.exp b/gdb/testsuite/gdb.base/watch-bitfields.exp index 9d5293b..9f0192d 100644 --- a/gdb/testsuite/gdb.base/watch-bitfields.exp +++ b/gdb/testsuite/gdb.base/watch-bitfields.exp @@ -77,5 +77,10 @@ proc test_regular_watch {} { } } +# Disable hardware watchpoints if the target does not support it. +if [target_info exists gdb,no_hardware_watchpoints] { + gdb_test_no_output "set can-use-hw-watchpoints 0" +} + test_watch_location test_regular_watch