Bug 15902

Summary: Hardware watchpoints on remote targets do not automatically fall back to software watchpoints
Product: gdb Reporter: Jeremy Bennett <jeremy.bennett>
Component: breakpointsAssignee: Not yet assigned to anyone <unassigned>
Status: NEW ---    
Severity: normal CC: akolesov
Priority: P2    
Version: HEAD   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed:
Attachments: Patch to update user manual for this issue.

Description Jeremy Bennett 2013-08-27 17:04:11 UTC
Created attachment 7168 [details]
Patch to update user manual for this issue.

The GDB manual (section 5.1.2, "Setting Watchpoints") states: "If gdb cannot set a hardware watchpoint, it sets a software watchpoint,..."

This appears to only be true for native targets. On a remote target connecting over Remote Serial Protocol, GDB will just report that hardware breakpoints are not supported.

  Could not insert hardware breakpoints:
  You may have requested too many hardware breakpoints/watchpoints

The user must explicitly request software watchpoints using

  set can-use-hw-watchpoints 0

Problem found using GDB for ARC.

This really needs fixing in remote.c, but in the meantime, I attach a small patch to the documentation:

2013-05-13  Jeremy Bennett  <jeremy.bennett@embecosm.com>

	* doc/gdb.texinfo (Setting Watchpoints): Note that automatic
	fallback to software watchpoints does not happen with remote
	targets.
Comment 1 Anton Kolesov 2013-08-27 20:03:16 UTC
I was able to reproduce this with x86_64 host and GDB 7.6 from release tarball after I commented handling of Z2 packet in gdbserver source code.

  (gdb) watch a
  Hardware watchpoint 2: a
  (gdb) c
  Continuing.
  Warning:
  Could not insert hardware watchpoint 2.
  Could not insert hardware breakpoints:
  You may have requested too many hardware breakpoints/watchpoints.

  main () at test.c:4
  4           a = 2;
  (gdb)