Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Register cache
@ 2001-02-10 14:37 Mark Kettenis
  2001-02-11 12:07 ` Nick Duffek
  2001-02-13 13:38 ` Andrew Cagney
  0 siblings, 2 replies; 10+ messages in thread
From: Mark Kettenis @ 2001-02-10 14:37 UTC (permalink / raw)
  To: gdb; +Cc: eliz

A few days ago Eli proposed the following patch:

   http://sources.redhat.com/ml/gdb-patches/2001-02/msg00140.html

It proposes a new interface to supply a single i387 register to GDB's
internal register cache in addition to the existing interface that
supplies the whole FPU state.

In a perhaps overly pedantic mood, I raised some objections to the
patch.  I would prefer not to add yet another interface, and I
suggested to Eli that he'd simply use the existing interface, to which
he responded that that would implicate violating the
target_fetch_registers() API.  Let me explain:

We have the following comment on target_fetch_registers() in target.h:

   /* Fetch register REGNO, or all regs if regno == -1.  No result.  */

This suggests that target_fetch_registers() will fetch exactly one
register if REGNO != -1.  However, quite a few targets do something
different, that is, they fetch at least register REGNO, but actually
fetch a whole bunch of them.  This probably started with SVR4-ish
systems that have a /proc filesystem.  On those systems it isn't
possible to fetch a single register.  Instead one get a whole bunch
and procfs_fetch_registers() supplies them all to GDB's register
cache.  Comments in procfs.c suggest that this is an optimization; by
caching the whole register set on possibly saves a few system calls in
the future.  Other targets like the modern BSDs and GNU/Linux that
have appropriate ptrace() requests followed this example and do the
same thing.

Is this really a good idea?  I think it is, at least on targets where
getting at the registers is relatively expensive since it involves a
system call.  Therefore I propose to make this "official" and change
the comment on target_fetch_registers() to:

   /* Fetch at least register REGNO, or all regs if REGNO == -1.  */

Another question is whether we should make this behaviour (I mean
having target_fetch_registers() supply all registers it managed to get
in one go) recommended practice.

Mark


^ permalink raw reply	[flat|nested] 10+ messages in thread
[parent not found: <8AE4B526B977D411841F00A0CC334020052C28@cuz-exchange.sdesigns.net>]

end of thread, other threads:[~2001-03-26  7:22 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-02-10 14:37 Register cache Mark Kettenis
2001-02-11 12:07 ` Nick Duffek
2001-02-11 23:26   ` Eli Zaretskii
     [not found]     ` <200102121753.f1CHr9t11723@rtl.cygnus.com>
2001-02-12 10:37       ` Eli Zaretskii
2001-02-16 15:21         ` Mark Kettenis
2001-02-17  0:28           ` Eli Zaretskii
2001-02-17  3:19             ` Mark Kettenis
2001-02-13 13:38 ` Andrew Cagney
     [not found] <8AE4B526B977D411841F00A0CC334020052C28@cuz-exchange.sdesigns.net>
     [not found] ` <39AC598A.DFAF67E9@ozemail.com.au>
2001-03-26  6:46   ` Register Cache Andrew Cagney
2001-03-26  7:22     ` Fernando Nasser

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox