This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] hardware watchpoints turned off, inferior not yet started


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]