Re: [RFA]: Modified Watchthreads Patch

Daniel Jacobowitz
2004-12-11T18:07:47Z

On Sat, Dec 11, 2004 at 08:00:54PM +0200, Eli Zaretskii wrote:
> > Date: Sat, 11 Dec 2004 12:32:56 -0500
> > From: Daniel Jacobowitz <drow@false.org>
> > Cc: jjohnstn@redhat.com, gdb-patches@sources.redhat.com
> >
> > I think that every current use of observers is in this sense "we don't
> > really know in advance what needs to be done". For instance, we've got
> > observer_notify_inferior_created, which is uesd for actions that we
> > don't know statically will be necessary at inferior creation - vsyscall
> > DSO loading on targets which have one, and some HP/UX specific code
> > that I don't recall the purpose of.
> >
> > Or consider target_changed, which is attached by the frame code (always
> > part of GDB!) and the regcache (likewise!) and notified by valops.c
> > (likewise!).
>
> What about solib_unloaded?

Same deal, almost. It's used by the common breakpoint code. It's
notified by the "common" solib code - it's not actually common, but
we're trying to make it so.

> > Observe, we're back to the core question of the role of observers here.
> > I prefer #2 to #1. But #2 is _functionally_ equivalent to providing an
> > observer named linux_enable_watchpoints_for_new_threads.
>
> It is functionally equivalent, but ideologically different: it's a
> detail of GDB internals as opposed to a general-purpose extension
> mechanism.

I do not consider GDB's observer mechanism to be a general-purpose
extension mechanism. Some day, if there is a revival of libgdb, then
maybe it will be usable as one - and at that point, perhaps we'll need
a second copy with different events. I think the current observers are
a mechanism for nominally independent internal modules of GDB to
communicate.

Are "breakpoint" and "shared library" any more independent than
"common Linux support" and "some particular Linux backend"? Maybe so,
but the line seems pretty shaky to me. Certainly the breakpoint module
has a lot of code to handle shared libraries, and the shared library
code makes use of breakpoints.

--
Daniel Jacobowitz