Re: adjust watchpoint testing

Daniel Jacobowitz
2006-06-14T02:52:01Z

On Wed, Jun 14, 2006 at 09:21:52AM +0800, Wu Zhou wrote:
>
> On Tue, 13 Jun 2006, Eli Zaretskii wrote:
>
> > > Date: Tue, 13 Jun 2006 14:43:13 +0800 (CST)
> > > From: Wu Zhou <woodzltc@cn.ibm.com>
> > > cc: gdb-patches@sourceware.org
> > >
> > > Do you mean to hard-wire the number of the hw watchpoint the underlying target
> > > support into these base board files, or just set the number to 1?
> > >
> > > I guess that we might need to work out a way to detect the number
> > > automatically. Any thought?
> >
> > I don't think there's any practical way to detect the number of
> > supported watchpoints. It depends on the particulars of the watched
> > regions, and different targets have different peculiarities. For
> > example, x86 can set an unlimited number of watchpoints provided that
> > they watch the same address and length.

I'm not entirely sure why this would be specific to x86. The
x86-specific code handles it, but any other target could too
(I'd rather it were handled at a higher layer, but the current
breakpoint.c layer is too high for that; there may be a middle layer
someday; we've discussed this recently, I think.)

> What about adding a gdbarch specific member function to do this? If this
> is still target dependent, we can overwrite it in the relevant tdep file.

The problem is that it is not architecture-specific, but
board-specific.

I think that, if someone wanted, we could write a features
description which explained what hardware watchpoint and breakpoint
resources were available. While there are quite a variety of types in
existance, they follow some basic templates, which could be stored
in GDB. I spoke briefly with Nathan about this earlier. My general
opinion is that it's a big project with relatively little return, so
until I have a target board where it would be particularly valuable,
I'm not planning to think about it too hard. But if anyone else thinks
this sounds like an interesting project, and wants to learn a whole lot
about the different sorts of watchpoints out there and about XML
schemas, ask me about it and I'll try to put my thoughts in order :-)

--
Daniel Jacobowitz
CodeSourcery