Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Mark Kettenis <kettenis@wins.uva.nl>
To: gdb@sources.redhat.com
Cc: eliz@delorie.com
Subject: Register cache
Date: Sat, 10 Feb 2001 14:37:00 -0000	[thread overview]
Message-ID: <200102102237.f1AMbnJ00230@delius.kettenis.local> (raw)

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


             reply	other threads:[~2001-02-10 14:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-02-10 14:37 Mark Kettenis [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200102102237.f1AMbnJ00230@delius.kettenis.local \
    --to=kettenis@wins.uva.nl \
    --cc=eliz@delorie.com \
    --cc=gdb@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox