This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] hardware watchpoints turned off, inferior not yet started
- From: Pedro Alves <palves at redhat dot com>
- To: Andrew Burgess <aburgess at broadcom dot com>
- Cc: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Wed, 16 Oct 2013 13:32:33 +0100
- Subject: Re: [PATCH] hardware watchpoints turned off, inferior not yet started
- Authentication-results: sourceware.org; auth=none
- References: <525E5EB6 dot 4070305 at broadcom dot com>
On 10/16/2013 10:39 AM, Andrew Burgess wrote:
> The following seems confusing to me:
>
> $ gdb -q watch.x
> Reading symbols from /some/path/to/watch.x...done.
> (gdb) set can-use-hw-watchpoints 0
> (gdb) watch -l my_var
> Hardware watchpoint 1: -location my_var
> (gdb)
>
> Notice that despite turning hardware watchpoints off
> the watchpoint created is reported to be a hardware
> watchpoint. Once I actually start the inferior the
> watchpoint is downgraded to a software watchpoint,
> but still, this feels like it might cause confusion,
> and is pretty easy to fix.
It seems wrong to me to create it as bp_hardware_watchpoint
in the first place. That's done in watch_command_1, with:
if (accessflag == hw_read)
bp_type = bp_read_watchpoint;
else if (accessflag == hw_access)
bp_type = bp_access_watchpoint;
else
bp_type = bp_hardware_watchpoint;
If "can-use-hw-watchpoints" is off, then I think it'd
be also better to prohibit creating read and access
watchpoints around here.
> @@ -1800,6 +1800,8 @@ update_watchpoint (struct watchpoint *b, int reparse)
> /* Without execution, memory can't change. No use to try and
> set watchpoint locations. The watchpoint will be reset when
> the target gains execution, through breakpoint_re_set. */
> + if (!can_use_hw_watchpoints)
> + b->base.type = bp_watchpoint;
> }
... this change I think makes it so that access/read
watchpoints get converted to software watchpoints, which is wrong.
--
Pedro Alves