Re: Why no hwatch command in gdb ?

Jan Kratochvil
2011-03-10T10:34:27Z

Hi Robert,

On Thu, 10 Mar 2011 11:09:23 +0100, robert song wrote:
> On 3/10/11, Jan Kratochvil <jan.kratochvil@redhat.com> wrote:
> > 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.
> >
> "does not work well now" means ?

GNU gdb (GDB) 7.2.50.20110310-cvs
This GDB was configured as "x86_64-unknown-linux-gnu".
(gdb) watch gdb_stdout
Hardware watchpoint 2: gdb_stdout
(gdb) watch gdb_stderr
Hardware watchpoint 3: gdb_stderr
(gdb) watch gdb_stdlog
Hardware watchpoint 4: gdb_stdlog
(gdb) watch gdb_stdin
Hardware watchpoint 5: gdb_stdin
(gdb) watch gdb_stdtargin
Hardware watchpoint 6: gdb_stdtargin
(gdb) continue
Continuing.
Warning:
Could not insert hardware watchpoint 5.
Could not insert hardware breakpoints:
You may have requested too many hardware breakpoints/watchpoints.
(gdb)

> The problem is that sometimes I just want to set only hardware
> watchpoints, and don't want to set software watchpoints. But the
> watchpoint will be changed to software ones if hardware watchpoints
> are exceeded,

When at least one watchpoint is a software one GDB has to start single-stepping
the inferior. At that moment it does not matter whether some additional
watchpoints are software or hardware ones.

Thanks,
Jan