From: Andrew Cagney <ac131313@cygnus.com>
To: gdb@sources.redhat.com
Subject: G packet format ...
Date: Thu, 01 Nov 2001 09:37:00 -0000 [thread overview]
Message-ID: <3BEF5CF4.4010201@cygnus.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 2731 bytes --]
Hello,
For those that don't know, GDB's remote protocol G packet currently
determins the layout of GDB's internal register cache. Doh!
As part of breaking^D^D^Dfixing this, I'd like to introduce a new CLI
command that allows the user to specify the G packet (and in fact the
entire remote protocol numbering) at runtime.
The commands are:
set remote registers <spec>
and
show remote registers
(better names welcome). The interesting thing is the spec:
<spec> ::= <entry> { <sep> <entry> }* ;;
<entry> ::= <size> [ ":" <name> [ ":" <pnum> ] ] ;;
<sep> ::= ";" | "\n" ;;
Where:
<name> is the name of a raw register
<size> is the byte size of a register
<pnum> is the [Pp] register number
Eg:
8:r0
8:r1
4:r2
4
8:r3
4:spr0:1000
4:spr1
or:
8:r0;8:r1;4:r2;4;8:r3;;4:spr0:1000;4:spr1
GDBserver might use the first form (\n) while GDB's CLI would use the
second form.
For want of a better way to define the semantics, try the attached shell
script. What follows is an attempt at an english description:
The spec is divided into two parts separated by a blank entry.
Additional blank entries, after the first, are ignored.
The first part describes registers that are transfered via either the
[Gg] packets or the [Pp] packets. Each entry specifies a number of bytes
in the [Gg] packet and then, optionally, the GDB internal name
corresponding to those bytes. Unnamed entries are written as zero.
The second part describes registers that are only transferable via the
[Pp] packets. Size entries in this part of the spec are ignored.
The [Pp] packet register number of the first register is zero (unless
explicitly specified). The [Pp] packet register number of succeeding
registers, if not explicitly specified, is determined by adding one to
the previous register's number. (Yes ``1:r1:1000;;4:r0;0'', while
stupid, is still legal.)
If GDB's internal register is smaller than the packet specification then
high bits are discarded to fit.
If GDB's internal register is larger than the packet specification then
we've got a problem. A guess is zero extend unless a -ve size is
specified which would imply sign extend. Worry about this when it
actually happens.
--
NB: If you didn't catch on. GDB currently doesn't implement the ``read
single register'' packet yet this spec assumes this.
--
NB: Why do this?
The objective is to decouple the remote protocol's G packet from the
rest of GDB. That way, GDB has greater flexability in how it implements
its regcache. For instance, with the MIPS, it will be possible to have
a single internal register layout while still being able to connect to
all the remote MIPS targets.
--
comments, better suggestions, code?
Andrew
[-- Attachment #2: reg.sh --]
[-- Type: text/plain, Size: 430 bytes --]
#!/bin/sh
pnum=0
offset=0
IFS=:
printf "name\tsize\tpnum\toffset\n"
while read size name num
do
if test x"${size}" = x; then
echo "--- END -- OF -- G -- PACKET --"
offset=
continue
fi
if test x"${num}" = x; then
num=${pnum}
fi
if test x"${name}" != x; then
printf "${name}\t${size}\t${num}\t${offset}\n"
fi
pnum=`expr ${num} + 1`
test "${offset}" && offset=`expr ${offset} + ${size}`
done
next reply other threads:[~2001-11-12 5:24 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-11-01 9:37 Andrew Cagney [this message]
2001-11-01 10:18 ` Daniel Jacobowitz
2001-11-01 10:30 ` Andrew Cagney
2001-11-01 10:58 ` Daniel Jacobowitz
2001-11-05 8:04 ` Andrew Cagney
2001-11-01 12:30 ` Fernando Nasser
2001-11-01 12:51 ` Andrew Cagney
2001-11-01 16:51 ` Frank Ch. Eigler
2001-11-02 0:37 ` Andrew Cagney
2001-11-05 8:19 ` 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=3BEF5CF4.4010201@cygnus.com \
--to=ac131313@cygnus.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