This is the mail archive of the gdb@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: Why no hwatch command in gdb ?


On Thu, 10 Mar 2011 08:25:18 +0100, robert song wrote:
> In gdb command line, we can use break or hbreak to set breakpoint or
> hardware breakpoint.
> 
> But I can only find watch command without hardware watch command, so
> why watchpoint and breakpoint command are not united?

Watchpoints are normally created by default as hardware ones.  They should
fallback to their software variants when you get out of the number of debug
registers but that does not work well now.

You can request hardware vs. software watchpoints by using:
(gdb) help set can-use-hw-watchpoints 
Set debugger's willingness to use watchpoint hardware.
If zero, gdb will not use hardware for new watchpoints, even if
such is available.  (However, any hardware watchpoints that were
created before setting this to nonzero, will continue to use watchpoint
hardware.)

The difference is that software breakpoints are very cheap so GDB does not even
attempt to create hardware breakpoints.  While software watchpoints are very
expensive so - in fact GDB does not normally try to fallback to software ones.
When you have to use software watchpoints it is commonly even not viable to
wait for so long.


Thanks,
Jan


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