Re: [RFA]: Modified Watchthreads Patch

Eli Zaretskii
2004-12-10T23:31:54Z

> Date: Fri, 10 Dec 2004 18:06:03 -0500
> From: Daniel Jacobowitz <drow@false.org>
> Cc: jjohnstn@redhat.com, gdb-patches@sources.redhat.com
>
> Does the i386 native watchpoint support work on any existing target
> with multiple threads?

I don't know, but if it does, it's more through luck than through
correct code.

> That is not a problem with the i386 native support for watchpoints; it
> is a problem with the core GDB interfaces for watchpoints

I don't know if it is a problem with the GDB interface; it might be.
For the x86 native code, I _know_ it's a problem, because the code was
designed and written assuming that watchpoints are not thread-local.

I'm not opposed to rethinking the core GDB watchpoint interface as
well, but doing that is a much harder job, because we need to analyze
how various debug interfaces on various platforms can help us know
what thread hit the watchpoint. Only then we can come up with a
viable design.

> If you don't think we can support multi-threaded watchpoints in GDB
> without doing this redesign first, do you object to Jeff's current
> patch?

You may recall that I objected to using observers for this in the
first place, but my objections were voted down. Given that, I don't
find it useful to object to Jeff's current patch. But I will
encourage any attempts to refactor the watchpoint interfaces and x86
native code to accomodate multi-threaded programs, even if in the
meantime we approve some changes that patch around the inappropriate
design to get thread-local watchpoints on some platforms.

> To get a useful level of support from the i386 watchpoint code, in
> fact, looks pretty easy.

It may be easy, but I think we still need to talk about the design.
The debug registers mirroring in i386-nat.c clearly assume that debug
registers are all global. This might not work at all with threads.