From: Yao Qi <qiyaoltc@gmail.com>
To: Pedro Alves <palves@redhat.com>
Cc: Yao Qi <qiyaoltc@gmail.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH] [testsuite] Probe awatch/rwatch support
Date: Tue, 14 Apr 2015 16:06:00 -0000 [thread overview]
Message-ID: <86egnmu22g.fsf@gmail.com> (raw)
In-Reply-To: <552D2BC6.5060109@redhat.com> (Pedro Alves's message of "Tue, 14 Apr 2015 16:01:26 +0100")
Pedro Alves <palves@redhat.com> writes:
> s390 fails like this:
>
> No breakpoints or watchpoints.
> (gdb) awatch shared_var thread 12
> Target does not support this type of hardware watchpoint.
> (gdb) FAIL: gdb.base/watch_thread_num.exp: Watchpoint on shared variable
>
Since we use gdb_read_access_watchpoint, output "Target does not support
this type of hardware watchpoint." is matched and UNSUPPORTED is emitted.
>> -
>> -gdb_test "rwatch global" \
>> - "Hardware read watchpoint .*: global" \
>> - "set hardware read watchpoint on global variable"
>> +if { ![gdb_read_access_watchpoint "rwatch" "global" \
>> + "set hardware read watchpoint on global variable"] } {
>> + return
>> +}
>
> This seems to be the only case the test message was changed.
> Was that intended?
Test message isn't changed. It is:
PASS: gdb.base/watch-read.exp: set hardware read watchpoint on global variable
>
> I think that the API looks a bit awkward to use. I mean, the need to
> pass the type as parameter. Why not wrap it in a couple procedures:
>
> proc gdb_read_watchpoint { loc message } {
> gdb_read_access_watchpoint "rwatch" $loc $message
> }
>
> proc gdb_access_watchpoint { loc message } {
> gdb_read_access_watchpoint "awatch" $loc $message
> }
>
>
> or even gdb_rwatch and gdb_awatch, leaving gdb_read_access_watchpoint
> as an implementation detail.
>
I am fine to change the API to what you suggested...
>>
>> # The first read is on entry to the loop.
>>
>> diff --git a/gdb/testsuite/gdb.base/watch_thread_num.exp b/gdb/testsuite/gdb.base/watch_thread_num.exp
>> index d559f22..1995e5d 100644
>> --- a/gdb/testsuite/gdb.base/watch_thread_num.exp
>> +++ b/gdb/testsuite/gdb.base/watch_thread_num.exp
>> @@ -71,9 +71,10 @@ delete_breakpoints
>> # simultaneously, on targets with continuable watchpoints, such as
>> # x86. See PR breakpoints/10116.
>>
>> -gdb_test "awatch shared_var thread $thread_num" \
>> - "Hardware access \\(read/write\\) watchpoint .*: shared_var.*" \
>> - "Watchpoint on shared variable"
>> +if { ![gdb_read_access_watchpoint "awatch" "shared_var thread $thread_num" \
>> + "Watchpoint on shared variable"] } {
>> + return
>> +}
>>
>> gdb_test "info breakpoint \$bpnum" \
>> "stop only in thread $thread_num" \
>> diff --git a/gdb/testsuite/gdb.base/watchpoint-hw-hit-once.exp b/gdb/testsuite/gdb.base/watchpoint-hw-hit-once.exp
>> index 7ae76e0..d0aa2b9 100644
>> --- a/gdb/testsuite/gdb.base/watchpoint-hw-hit-once.exp
>> +++ b/gdb/testsuite/gdb.base/watchpoint-hw-hit-once.exp
>> @@ -27,7 +27,9 @@ if ![runto_main] {
>> return -1
>> }
>>
>> -gdb_test "rwatch watchee"
>> +if { ![gdb_read_access_watchpoint "rwatch" "watchee" "rwatch watchee"] } {
>> + return
>> +}
>>
>> gdb_breakpoint [gdb_get_line_number "dummy = 2"]
>>
>> diff --git a/gdb/testsuite/gdb.base/watchpoint-reuse-slot.exp b/gdb/testsuite/gdb.base/watchpoint-reuse-slot.exp
>> index abe81d6..d9a7cee 100644
>> --- a/gdb/testsuite/gdb.base/watchpoint-reuse-slot.exp
>> +++ b/gdb/testsuite/gdb.base/watchpoint-reuse-slot.exp
>> @@ -106,6 +106,9 @@ foreach cmd {"watch" "awatch" "rwatch"} {
>> -re "Target does not support.*$gdb_prompt $" {
>> unsupported $test
>> }
>> + -re "Expression cannot be implemented with read/access watchpoint..*$gdb_prompt $" {
>> + unsupported $test
>> + }
>
> This seems to revealing something wrong in gdb itself. This is watching
> a single byte or a global variable. Odd to see that error, which
> should mean that the expression involved non-memory values.
>
I don't see anything wrong in GDB here. If rwatch or awatch is used,
and target doesn't have hardware watchpoint, this error should be
printed. This behaviour is consistent with the doc:
Currently, the @code{awatch} and @code{rwatch} commands can only set
hardware watchpoints, because accesses to data that don't change the
value of the watched expression cannot be detected without examining
every instruction as it is being executed, and @value{GDBN} does not do
that currently. If @value{GDBN} finds that it is unable to set a
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
hardware breakpoint with the @code{awatch} or @code{rwatch} command, it
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
will print a message like this:
@smallexample
Expression cannot be implemented with read/access watchpoint.
@end smallexample
> If I'm reading the code correctly, either your board is target remote,
> and you're setting "set remote hardware-watchpoint-length-limit 0";
> or this is native and arm-linux-nat.c:arm_linux_can_use_hw_breakpoint
> isn't return 0 to indicate no support. For the remote case, seems to
I run tests on native arm-linux gdb. I don't know
target_can_use_hardware_watchpoint returns 0 is to indicate no support.
I'll update the comments to target_can_use_hardware_watchpoint.
> me that setting that setting to 0 effectively means watchpoints are
> not supported, and thus remote_check_watch_resources should be changed
> to return 0 if remote_hw_watchpoint_length_limit==0.
>
> The native case seems like a bug in the backend too -- it should
> return 0 when a watchpoint type isn't supported, which can be detected
> by arm_linux_get_hw_watchpoint_count returning 0.
>
> And then the core code is checking whether "set can-use-hw-watchpoints"
> was used to disable watchpoints, but isn't checking whether the target
> supports the watchpoint type at all.
>
> As much as I dislike the watchpoint resource accounting... I think this
> patch will make the errors more sensible, and probably trigger the
> pre-existing unsupported watchpoint detection paths in the testsuite
> (when there are any).
I'll give a try to see how errors are changes after your patch.
--
Yao (齐尧)
next prev parent reply other threads:[~2015-04-14 16:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-14 11:46 Yao Qi
2015-04-14 15:01 ` Pedro Alves
2015-04-14 16:06 ` Yao Qi [this message]
2015-04-14 16:36 ` Pedro Alves
2015-04-17 9:34 ` Yao Qi
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=86egnmu22g.fsf@gmail.com \
--to=qiyaoltc@gmail.com \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.com \
/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