From: Pedro Alves <palves@redhat.com>
To: Andrew Burgess <aburgess@broadcom.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [PATCH] hardware watchpoints turned off, inferior not yet started
Date: Wed, 16 Oct 2013 16:28:00 -0000 [thread overview]
Message-ID: <525EBEA7.5060205@redhat.com> (raw)
In-Reply-To: <525EB424.6010407@broadcom.com>
On 10/16/2013 04:43 PM, Andrew Burgess wrote:
> On 16/10/2013 1:32 PM, Pedro Alves wrote:
>> ... this change I think makes it so that access/read
>> watchpoints get converted to software watchpoints, which is wrong.
>
> OK I see that now, I got confused by code later within
> update_watchpoint that seems to unconditionally fallback
> to bp_watchpoint, but I see now how the read/access watchpoints
> actually result in an error. Thanks for pointing this out.
>
> I extended this code to cover this case and added tests.
> gdb/ChangeLog
>
> * breakpoint.c (update_watchpoint): Create software watchpoints if
> the inferior has not yet started and hardware watchpoints are
> turned off.
"Create" isn't really accurate. This function is called for resets too.
So, something like
"file foo; start; watch; kill; set can-use-hw-watchpoint 0; file foo"
will trigger that code path too, which I think will end up resulting
in access/read watchpoints being disabled, with something like:
"file foo; start; awatch; kill; set can-use-hw-watchpoint 0; file foo"
(Replace the last "file" with anything that triggers a reset.)
BTW, could you confirm that?
Anyway, I suggest:
* breakpoint.c (update_watchpoint): If hardware watchpoints are
forced off, downgrade them to software watchpoints if possible,
and error out if not possible.
> + # Ensure that if we turn off hardware watchpoints and set a watch point
> + # before starting the inferior the watchpoint created will not be a
> + # hardware watchpoint.
> + gdb_test_no_output "set can-use-hw-watchpoints 0" ""
> + gdb_test "watch ival1" "Watchpoint \[0-9\]+: ival1" \
> + "Set software watchpoint before starting the inferior"
> +
> + # The next tests are written to match the current state of gdb: access
> + # and read watchpoints require hardware watchpoint support, with this
> + # turned off these can't be created.
> + gdb_test "awatch ival1" \
> + "Target does not support software watchpoints of this type." \
> + "Set software watchpoint before starting the inferior"
> + gdb_test "rwatch ival1" \
> + "Target does not support software watchpoints of this type." \
> + "Set software watchpoint before starting the inferior"
The "Set software watchpoint before starting the inferior" string will
appear in gdb.sum for the three tests. Please make those unique per test.
Otherwise OK.
Thanks,
--
Pedro Alves
next prev parent reply other threads:[~2013-10-16 16:28 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-16 9:39 Andrew Burgess
2013-10-16 12:32 ` Pedro Alves
2013-10-16 15:43 ` Andrew Burgess
2013-10-16 16:28 ` Pedro Alves [this message]
2013-10-18 9:14 ` Andrew Burgess
2013-10-18 14:37 ` Andrew Burgess
2013-10-18 15:33 ` Pedro Alves
2013-10-18 16:26 ` Andrew Burgess
2013-10-18 15:26 ` Pedro Alves
2013-10-18 15:43 ` Andrew Burgess
2013-11-07 12:21 Jose E. Marchesi
2013-11-08 12:03 ` Pedro Alves
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=525EBEA7.5060205@redhat.com \
--to=palves@redhat.com \
--cc=aburgess@broadcom.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox