This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [PATCH]: Make Linux use the new unified x86 watchpoint support
Eli Zaretskii wrote:
>
> > Date: Tue, 27 Mar 2001 08:54:14 -0800
> > From: Michael Snyder <msnyder@redhat.com>
> >
> > > > This possibility has been discussed back in November, but the
> > > > conclusion was that it's not a good idea. I don't remember the
> > > > details, but the reasons had something to do with threads and how
> > > > the register cache is used in conjunction with threads. (I can dig
> > > > out the URLs of the relevant messages, if you want to read them.)
> > > >
> > > > I suggested doing this, but several people objected to exposing the
> > > > debug registers in this way. Threads have nothing to do with it
> > >
> > > I'm quite sure they did. IIRC, the issue was that debug registers are
> > > global, whereas normal registers are per thread.
> >
> > Mmmmm... that's probably true. However the effect would just be
> > that all threads appear to have the same values for debug regs.
> > If you change them in one, they'll change in all.
>
> As far as I understood, GDB's regcache cannot do such magic. It
> assumes that all the registers are per thread, so if you change them
> in one thread, the other threads' registers remain unchanged in the
> cache.
Currently there is only one cache (not one per thread).
When you change threads, the cache is flushed. However,
there are plans for a per-thread cache, so your concern
is not ill-placed.
> In other words, this kind of global registers is (or was when we
> discussed it) incompatible with how regcache works. That is why I was
> advised not to introduce the debug registers into the regcache.
They could be pseudo-registers, which means the debugger would
have the opportunity to handle them specially.