Bug 15902 - Hardware watchpoints on remote targets do not automatically fall back to software watchpoints
Summary: Hardware watchpoints on remote targets do not automatically fall back to soft...
Status: NEW
Alias: None
Product: gdb
Classification: Unclassified
Component: breakpoints (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-27 17:04 UTC by Jeremy Bennett
Modified: 2013-08-27 20:03 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
Patch to update user manual for this issue. (495 bytes, patch)
2013-08-27 17:04 UTC, Jeremy Bennett
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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)