From: Daniel Jacobowitz <drow@mvista.com>
To: gdb-patches@sources.redhat.com, ac131313@cygnus.com
Subject: [RFA] Basic structure to describe register formats
Date: Fri, 01 Feb 2002 12:22:00 -0000 [thread overview]
Message-ID: <20020201152209.A17528@nevyn.them.org> (raw)
This patch adds a new directory, gdb/regformats. It adds a shell script to
read the data files therein and generate something useful for gdbserver; GDB
can use the same or a different script. You could argue that the script and
header contained in this patch belong in the gdbserver directory; I'll do
whichever the first person who feels like approving this prefers :) I
include data files for the current remote packets for MIPS, ARM, SH, i386,
PowerPC, M68k, and ia64. Adding others is pretty easy.
This is one of the big steps in cleaning up gdbserver. They're not quite
right yet - I think that perhaps the sizes should be in bits rather than
bytes. I can fix that up before commiting, though, and I can't think of any
other issues.
I'd like to commit this so that I can then re-arrange gdbserver to use them.
OK? Preferences?
--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer
diff -uNr -x blah regformats.old/reg-arm.dat regformats/reg-arm.dat
--- regformats.old/reg-arm.dat Wed Dec 31 19:00:00 1969
+++ regformats/reg-arm.dat Fri Feb 1 15:09:56 2002
@@ -0,0 +1,28 @@
+name:arm
+resume:r11,sp,pc
+4:r0
+4:r1
+4:r2
+4:r3
+4:r4
+4:r5
+4:r6
+4:r7
+4:r8
+4:r9
+4:r10
+4:r11
+4:r12
+4:sp
+4:lr
+4:pc
+12:f0
+12:f1
+12:f2
+12:f3
+12:f4
+12:f5
+12:f6
+12:f7
+4:fps
+4:cpsr
diff -uNr -x blah regformats.old/reg-i386.dat regformats/reg-i386.dat
--- regformats.old/reg-i386.dat Wed Dec 31 19:00:00 1969
+++ regformats/reg-i386.dat Fri Feb 1 15:09:56 2002
@@ -0,0 +1,43 @@
+name:i386
+resume:ebp,esp,eip
+4:eax
+4:ecx
+4:edx
+4:ebx
+4:esp
+4:ebp
+4:esi
+4:edi
+4:eip
+4:eflags
+4:cs
+4:ss
+4:ds
+4:es
+4:fs
+4:gs
+10:st0
+10:st1
+10:st2
+10:st3
+10:st4
+10:st5
+10:st6
+10:st7
+4:fctrl
+4:fstat
+4:ftag
+4:fiseg
+4:fioff
+4:foseg
+4:fooff
+4:fop
+16:xmm0
+16:xmm1
+16:xmm2
+16:xmm3
+16:xmm4
+16:xmm5
+16:xmm6
+16:xmm7
+4:mxcsr
diff -uNr -x blah regformats.old/reg-ia64.dat regformats/reg-ia64.dat
--- regformats.old/reg-ia64.dat Wed Dec 31 19:00:00 1969
+++ regformats/reg-ia64.dat Fri Feb 1 15:09:56 2002
@@ -0,0 +1,603 @@
+name:ia64
+resume:ip,psr,r12,bsp,cfm
+8:r0
+8:r1
+8:r2
+8:r3
+8:r4
+8:r5
+8:r6
+8:r7
+8:r8
+8:r9
+8:r10
+8:r11
+8:r12
+8:r13
+8:r14
+8:r15
+8:r16
+8:r17
+8:r18
+8:r19
+8:r20
+8:r21
+8:r22
+8:r23
+8:r24
+8:r25
+8:r26
+8:r27
+8:r28
+8:r29
+8:r30
+8:r31
+8:r32
+8:r33
+8:r34
+8:r35
+8:r36
+8:r37
+8:r38
+8:r39
+8:r40
+8:r41
+8:r42
+8:r43
+8:r44
+8:r45
+8:r46
+8:r47
+8:r48
+8:r49
+8:r50
+8:r51
+8:r52
+8:r53
+8:r54
+8:r55
+8:r56
+8:r57
+8:r58
+8:r59
+8:r60
+8:r61
+8:r62
+8:r63
+8:r64
+8:r65
+8:r66
+8:r67
+8:r68
+8:r69
+8:r70
+8:r71
+8:r72
+8:r73
+8:r74
+8:r75
+8:r76
+8:r77
+8:r78
+8:r79
+8:r80
+8:r81
+8:r82
+8:r83
+8:r84
+8:r85
+8:r86
+8:r87
+8:r88
+8:r89
+8:r90
+8:r91
+8:r92
+8:r93
+8:r94
+8:r95
+8:r96
+8:r97
+8:r98
+8:r99
+8:r100
+8:r101
+8:r102
+8:r103
+8:r104
+8:r105
+8:r106
+8:r107
+8:r108
+8:r109
+8:r110
+8:r111
+8:r112
+8:r113
+8:r114
+8:r115
+8:r116
+8:r117
+8:r118
+8:r119
+8:r120
+8:r121
+8:r122
+8:r123
+8:r124
+8:r125
+8:r126
+8:r127
+
+16:f0
+16:f1
+16:f2
+16:f3
+16:f4
+16:f5
+16:f6
+16:f7
+16:f8
+16:f9
+16:f10
+16:f11
+16:f12
+16:f13
+16:f14
+16:f15
+16:f16
+16:f17
+16:f18
+16:f19
+16:f20
+16:f21
+16:f22
+16:f23
+16:f24
+16:f25
+16:f26
+16:f27
+16:f28
+16:f29
+16:f30
+16:f31
+16:f32
+16:f33
+16:f34
+16:f35
+16:f36
+16:f37
+16:f38
+16:f39
+16:f40
+16:f41
+16:f42
+16:f43
+16:f44
+16:f45
+16:f46
+16:f47
+16:f48
+16:f49
+16:f50
+16:f51
+16:f52
+16:f53
+16:f54
+16:f55
+16:f56
+16:f57
+16:f58
+16:f59
+16:f60
+16:f61
+16:f62
+16:f63
+16:f64
+16:f65
+16:f66
+16:f67
+16:f68
+16:f69
+16:f70
+16:f71
+16:f72
+16:f73
+16:f74
+16:f75
+16:f76
+16:f77
+16:f78
+16:f79
+16:f80
+16:f81
+16:f82
+16:f83
+16:f84
+16:f85
+16:f86
+16:f87
+16:f88
+16:f89
+16:f90
+16:f91
+16:f92
+16:f93
+16:f94
+16:f95
+16:f96
+16:f97
+16:f98
+16:f99
+16:f100
+16:f101
+16:f102
+16:f103
+16:f104
+16:f105
+16:f106
+16:f107
+16:f108
+16:f109
+16:f110
+16:f111
+16:f112
+16:f113
+16:f114
+16:f115
+16:f116
+16:f117
+16:f118
+16:f119
+16:f120
+16:f121
+16:f122
+16:f123
+16:f124
+16:f125
+16:f126
+16:f127
+
+8:p0
+8:p1
+8:p2
+8:p3
+8:p4
+8:p5
+8:p6
+8:p7
+8:p8
+8:p9
+8:p10
+8:p11
+8:p12
+8:p13
+8:p14
+8:p15
+8:p16
+8:p17
+8:p18
+8:p19
+8:p20
+8:p21
+8:p22
+8:p23
+8:p24
+8:p25
+8:p26
+8:p27
+8:p28
+8:p29
+8:p30
+8:p31
+8:p32
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at20
+8:nat21
+8:nat22
+8:nat23
+8:nat24
+8:nat25
+8:nat26
+8:nat27
+8:nat28
+8:nat29
+8:nat30
+8:nat31
+8:nat32
+8:nat33
+8:nat34
+8:nat35
+8:nat36
+8:nat37
+8:nat38
+8:nat39
+8:nat40
+8:nat41
+8:nat42
+8:nat43
+8:nat44
+8:nat45
+8:nat46
+8:nat47
+8:nat48
+8:nat49
+8:nat50
+8:nat51
+8:nat52
+8:nat53
+8:nat54
+8:nat55
+8:nat56
+8:nat57
+8:nat58
+8:nat59
+8:nat60
+8:nat61
+8:nat62
+8:nat63
+8:nat64
+8:nat65
+8:nat66
+8:nat67
+8:nat68
+8:nat69
+8:nat70
+8:nat71
+8:nat72
+8:nat73
+8:nat74
+8:nat75
+8:nat76
+8:nat77
+8:nat78
+8:nat79
+8:nat80
+8:nat81
+8:nat82
+8:nat83
+8:nat84
+8:nat85
+8:nat86
+8:nat87
+8:nat88
+8:nat89
+8:nat90
+8:nat91
+8:nat92
+8:nat93
+8:nat94
+8:nat95
+8:nat96
+8:nat97
+8:nat98
+8:nat99
+8:nat100
+8:nat101
+8:nat102
+8:nat103
+8:nat104
+8:nat105
+8:nat106
+8:nat107
+8:nat108
+8:nat109
+8:nat110
+8:nat111
+8:nat112
+8:nat113
+8:nat114
+8:nat115
+8:nat116
+8:nat117
+8:nat118
+8:nat119
+8:nat120
+8:nat121
+8:nat122
+8:nat123
+8:nat124
+8:nat125
+8:nat126
+8:nat127
diff -uNr -x blah regformats.old/reg-m68k.dat regformats/reg-m68k.dat
--- regformats.old/reg-m68k.dat Wed Dec 31 19:00:00 1969
+++ regformats/reg-m68k.dat Fri Feb 1 15:09:56 2002
@@ -0,0 +1,35 @@
+name:m68k
+resume:sp,fp,pc
+4:d0
+4:d1
+4:d2
+4:d3
+4:d4
+4:d5
+4:d6
+4:d7
+4:a0
+4:a1
+4:a2
+4:a3
+4:a4
+4:a5
+4:fp
+4:sp
+4:ps
+4:pc
+
+12:fp0
+12:fp1
+12:fp2
+12:fp3
+12:fp4
+12:fp5
+12:fp6
+12:fp7
+
+4:fpcontrol
+4:fpstatus
+4:fpiaddr
+4:fpcode
+4:fpflags
diff -uNr -x blah regformats.old/reg-mips.dat regformats/reg-mips.dat
--- regformats.old/reg-mips.dat Wed Dec 31 19:00:00 1969
+++ regformats/reg-mips.dat Fri Feb 1 15:09:56 2002
@@ -0,0 +1,112 @@
+name:mips
+resume:pc,sp
+4:zero
+4:at
+4:v0
+4:v1
+
+4:a0
+4:a1
+4:a2
+4:a3
+
+4:t0
+4:t1
+4:t2
+4:t3
+
+4:t4
+4:t5
+4:t6
+4:t7
+
+4:s0
+4:s1
+4:s2
+4:s3
+
+4:s4
+4:s5
+4:s6
+4:s7
+
+4:t8
+4:t9
+4:k0
+4:k1
+
+4:gp
+4:sp
+4:s8
+4:ra
+
+4:sr
+4:lo
+4:hi
+4:bad
+
+4:cause
+4:pc
+
+4:f0
+4:f1
+4:f2
+4:f3
+
+4:f4
+4:f5
+4:f6
+4:f7
+
+4:f8
+4:f9
+4:f10
+4:f11
+
+4:f12
+4:f13
+4:f14
+4:f15
+
+4:f16
+4:f17
+4:f18
+4:f19
+
+4:f20
+4:f21
+4:f22
+4:f23
+
+4:f24
+4:f25
+4:f26
+4:f27
+
+4:f28
+4:f29
+4:f30
+4:f31
+
+4:fsr
+4:fir
+
+4:fp
+4:
+
+4:
+4:
+4:
+4:
+4:
+4:
+4:
+4:
+4:
+4:
+4:
+4:
+4:
+4:
+4:
+4:
diff -uNr -x blah regformats.old/reg-ppc.dat regformats/reg-ppc.dat
--- regformats.old/reg-ppc.dat Wed Dec 31 19:00:00 1969
+++ regformats/reg-ppc.dat Fri Feb 1 15:09:56 2002
@@ -0,0 +1,76 @@
+name:ppc
+resume:r1,pc
+4:r0
+4:r1
+4:r2
+4:r3
+4:r4
+4:r5
+4:r6
+4:r7
+4:r8
+4:r9
+4:r10
+4:r11
+4:r12
+4:r13
+4:r14
+4:r15
+4:r16
+4:r17
+4:r18
+4:r19
+4:r20
+4:r21
+4:r22
+4:r23
+4:r24
+4:r25
+4:r26
+4:r27
+4:r28
+4:r29
+4:r30
+4:r31
+
+8:f0
+8:f1
+8:f2
+8:f3
+8:f4
+8:f5
+8:f6
+8:f7
+8:f8
+8:f9
+8:f10
+8:f11
+8:f12
+8:f13
+8:f14
+8:f15
+8:f16
+8:f17
+8:f18
+8:f19
+8:f20
+8:f21
+8:f22
+8:f23
+8:f24
+8:f25
+8:f26
+8:f27
+8:f28
+8:f29
+8:f30
+8:f31
+
+4:pc
+4:ps
+
+4:cr
+4:lr
+4:ctr
+4:xer
+0:
diff -uNr -x blah regformats.old/reg-sh.dat regformats/reg-sh.dat
--- regformats.old/reg-sh.dat Wed Dec 31 19:00:00 1969
+++ regformats/reg-sh.dat Fri Feb 1 15:09:56 2002
@@ -0,0 +1,62 @@
+name:sh
+resume:pc,r14,r15
+4:r0
+4:r1
+4:r2
+4:r3
+4:r4
+4:r5
+4:r6
+4:r7
+4:r8
+4:r9
+4:r10
+4:r11
+4:r12
+4:r13
+4:r14
+4:r15
+4:pc
+4:pr
+4:gbr
+4:vbr
+4:mach
+4:macl
+4:sr
+4:fpul
+4:fpscr
+4:fr0
+4:fr1
+4:fr2
+4:fr3
+4:fr4
+4:fr5
+4:fr6
+4:fr7
+4:fr8
+4:fr9
+4:fr10
+4:fr11
+4:fr12
+4:fr13
+4:fr14
+4:fr15
+
+4:
+4:
+4:
+4:
+4:
+4:
+4:
+4:
+4:
+4:
+4:
+4:
+4:
+4:
+4:
+4:
+4:
+4:
diff -uNr -x blah regformats.old/regdat.sh regformats/regdat.sh
--- regformats.old/regdat.sh Wed Dec 31 19:00:00 1969
+++ regformats/regdat.sh Fri Feb 1 15:14:28 2002
@@ -0,0 +1,157 @@
+#!/bin/sh -u
+
+# Register protocol definitions for GDB, the GNU debugger.
+# Copyright 2001 Free Software Foundation, Inc.
+#
+# This file is part of GDB.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+move_if_change ()
+{
+ file=$1
+ if test -r ${file} && cmp -s "${file}" new-"${file}"
+ then
+ echo "${file} unchanged." 1>&2
+ else
+ mv new-"${file}" "${file}"
+ echo "${file} updated." 1>&2
+ fi
+}
+
+# Format of the input files
+read="type entry"
+
+do_read ()
+{
+ type=""
+ entry=""
+ while read line
+ do
+ if test "${line}" = ""
+ then
+ continue
+ elif test "${line}" = "#" -a "${comment}" = ""
+ then
+ continue
+ elif expr "${line}" : "#" > /dev/null
+ then
+ comment="${comment}
+${line}"
+ else
+
+ # The semantics of IFS varies between different SH's. Some
+ # treat ``::' as three fields while some treat it as just too.
+ # Work around this by eliminating ``::'' ....
+ line="`echo "${line}" | sed -e 's/::/: :/g' -e 's/::/: :/g'`"
+
+ OFS="${IFS}" ; IFS="[:]"
+ eval read ${read} <<EOF
+${line}
+EOF
+ IFS="${OFS}"
+
+ # .... and then going back through each field and strip out those
+ # that ended up with just that space character.
+ for r in ${read}
+ do
+ if eval test \"\${${r}}\" = \"\ \"
+ then
+ eval ${r}=""
+ fi
+ done
+
+ break
+ fi
+ done
+ if [ -n "${type}" ]
+ then
+ true
+ else
+ false
+ fi
+}
+
+if test ! -r $1; then
+ echo "$0: Could not open $1." 1>&2
+ exit 1
+fi
+
+copyright ()
+{
+cat <<EOF
+/* *INDENT-OFF* */ /* THIS FILE IS GENERATED */
+
+/* A register protocol for GDB, the GNU debugger.
+ Copyright 2001 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+/* This file was created with the aid of \`\`regdat.sh'' and \`\`$1''. */
+
+EOF
+}
+
+
+exec > new-$2
+copyright $1
+echo '#include "regdef.h"'
+echo
+offset=0
+i=0
+name=x
+resume=x
+exec < $1
+while do_read
+do
+ if test "${type}" = "name"; then
+ name="${entry}"
+ echo "struct reg regs_${name}[] = {"
+ continue
+ elif test "${type}" = "resume"; then
+ resume="${entry}"
+ continue
+ elif test "${name}" = x; then
+ echo "$0: $1 does not specify \`\`name''." 1>&2
+ exit 1
+ else
+ echo " { \"${entry}\", ${offset}, ${type} },"
+ offset=`expr ${offset} + ${type}`
+ i=`expr $i + 1`
+ fi
+done
+
+echo "};"
+echo
+echo "const char *resume_regs_${name} = { \"`echo ${resume} | sed 's/,/", "/g'`\", 0 };"
+
+# close things off
+exec 1>&2
+move_if_change $2
diff -uNr -x blah regformats.old/regdef.h regformats/regdef.h
--- regformats.old/regdef.h Wed Dec 31 19:00:00 1969
+++ regformats/regdef.h Fri Feb 1 15:16:52 2002
@@ -0,0 +1,27 @@
+/* Register protocol definition structures for the GNU Debugger
+ Copyright 2001, 2002 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+struct reg
+{
+ const char *name;
+ int offset;
+ int size;
+};
+
next reply other threads:[~2002-02-01 20:22 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-02-01 12:22 Daniel Jacobowitz [this message]
2002-02-01 13:10 ` Andrew Cagney
2002-02-01 13:21 ` Daniel Jacobowitz
2002-02-01 13:50 ` Andrew Cagney
2002-02-01 14:09 ` Daniel Jacobowitz
2002-02-01 15:28 ` Andrew Cagney
2002-02-01 14:01 ` Frank Ch. Eigler
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=20020201152209.A17528@nevyn.them.org \
--to=drow@mvista.com \
--cc=ac131313@cygnus.com \
--cc=gdb-patches@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