Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <ac131313@cygnus.com>
To: Daniel Jacobowitz <dmj+@andrew.cmu.edu>
Cc: gdb@sources.redhat.com
Subject: Re: parcelling up struct gdbarch
Date: Mon, 16 Jul 2001 15:15:00 -0000	[thread overview]
Message-ID: <3B536764.1000508@cygnus.com> (raw)
In-Reply-To: <20010716130559.B25488@nevyn.them.org>

> The definition of the remote protocol, such as it is, says:
> 
>    In general, the raw representation is determined by the
> architecture, or GDB's interface to the architecture, while the virtual
> representation can be chosen for GDB's convenience.  GDB's register
> file, `registers', holds the register contents in raw format, and the
> GDB remote protocol transmits register values in raw format.
> 
> The G packet is defined as the format of the register cache.
> 
> Are you saying you want to change that?  How do you envision doing this
> without slaughtering the protocol?  That's where I'm confused.


The documentation reflects the current state of play, good^D^D^D or^D^D 
bad.  If you alter the layout of the register cache, you change the 
remote protocol.  Hmm, something wrong here.


>> The thing the *-nat and GDB server code shouldn't be doing is trying to 
>> map registers onto internal-to-GDB cooked registers.  (Keep in mind that 
>> the existing code base largely doesn't follow this :-( ).
> 
> Largely?  I'd say completely.


remote-sim.h has a mapping mechanism - it needs to map between GDB's 
internal register layout and that of the simulator.

Originally GDB's register cache (and hence the G-packet) was defined by 
the layout of the raw register bytes returned by ptrace() fortunatly 
*-nat.c files are at least unpacking those structure and using 
supply_register() to fill the register cache.


>> No, something completly outside of *.h that defines the G-packet layout 
>> (and possibly the register cache) and how *-nat.c should map registers 
>> onto it.
> 
> 
> I don't see the need for this profusion of register formats.  We've got
> too many already.  Yes, the existing MIPS architectures all have


You've lost me here.  The reason for separating out and more formally 
specifying the G-packet layout is so that it is set in stone.  No matter 
what someone does to the register cache, or any other part of GDB, the 
remote protocol continues to work.

In the case of MIPS, this means that GDB will need to publish several 
different G-packets and support all of them.  Such is life, if long ago 
someone had thought to separate out and publish the G-packet layouts 
then we wouldn't be in this mess.

Regarding the register cache (or GDB's RAW registers).  A *-nat.c 
something needs to correctly map between raw registers (as stored in the 
register cache) and ptrace/... registers as supplied by the OS.  By 
formalizing the raw register layout, that process should be simplified. 
  (See posts from earlier this year).

> separate G packet formats; but what can be done about that, and what
> needs to be?  GDB and gdbserver need to agree about this anyway,
> because it also affects things like which registers can successfully be
> set.
> 
> If anything, gdbserver should just be sending the registers in the same
> format that *-nat.c gets them, and then they should pass through the
> same conversion function.  I'm thinking gdb_gregset_t here and
> REGISTER_U_ADDR here.  But again, I don't see what to do without
> introducing a new packet type; and most architectures are not ready to
> parse a gdb_gregset_t in a cross-debugger.


I think we're getting somewhere :-)

I take it you're proposing that G-packet layout would be defined by what 
was returned in the ptrace() buffer.  Don't forget that every OS has a 
different buffer layout - that means that they all have different 
G-packet layouts (I thought we already had too many).  This also means 
that you need to be very careful to not change anything that affects 
that packet for a given target.

It would give the layering:

   ptrace buffer
     |
   no-change (by gdbserver)
     |
   g register layout (including T registers)
     |
   remote.c uses some sort of unpack code
     |  (possibly in nat.c, this was always
     |   going to be needed and is clearly
     |   mising at present)
     |
   raw register layout
     .
     .

Remember that for the T and [Pp] packets to work, gdbserver will need to 
know something about that buffer.

	Andrew


  reply	other threads:[~2001-07-16 15:15 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-13  0:16 Daniel Jacobowitz
2001-07-13 12:35 ` Andrew Cagney
2001-07-13 14:53   ` Daniel Jacobowitz
2001-07-14  8:33     ` Andrew Cagney
2001-07-16 11:25       ` Daniel Jacobowitz
2001-07-16 11:27         ` H . J . Lu
2001-07-16 12:04         ` Andrew Cagney
2001-07-16 12:34           ` J.T. Conklin
2001-07-16 15:30             ` Andrew Cagney
2001-07-16 15:40               ` Daniel Jacobowitz
2001-07-16 17:24                 ` gdbserver (was Re: parcelling up struct gdbarch) Fabrice Gautier
2001-07-16 21:17                   ` Daniel Jacobowitz
2001-07-16 22:22                     ` Fabrice Gautier
2001-07-16 22:28                       ` Daniel Jacobowitz
2001-07-17 10:00                   ` Andrew Cagney
2001-07-17 10:11                     ` Daniel Jacobowitz
2001-07-17 11:10                       ` Andrew Cagney
2001-07-17 11:21                         ` Daniel Jacobowitz
2001-07-17 11:46                           ` Andrew Cagney
2001-07-17 10:36                   ` Quality Quorum
2001-07-16 13:05           ` parcelling up struct gdbarch Daniel Jacobowitz
2001-07-16 15:15             ` Andrew Cagney [this message]
2001-07-16 15:49               ` Daniel Jacobowitz
2001-07-17 10:46                 ` Andrew Cagney
2001-07-17 11:03                   ` Daniel Jacobowitz
2001-07-17 11:37                     ` Andrew Cagney
2001-07-18 13:21                       ` Daniel Jacobowitz
2001-07-18 22:53                         ` Andrew Cagney
2001-07-18 23:22                           ` Daniel Jacobowitz
2001-07-19  0:23                             ` Daniel Jacobowitz
2001-07-19  7:51                               ` Andrew Cagney
2001-07-19  7:44                             ` Andrew Cagney
2001-07-18  8:09 ` Andrew Cagney

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=3B536764.1000508@cygnus.com \
    --to=ac131313@cygnus.com \
    --cc=dmj+@andrew.cmu.edu \
    --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