aboutsummaryrefslogtreecommitdiff
path: root/gdb/i386-tdep.c
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@gnu.org>2001-07-28 17:03:38 +0000
committerMark Kettenis <kettenis@gnu.org>2001-07-28 17:03:38 +0000
commit85540d8c4ad4df82637ddc835173c80d4dcdac08 (patch)
treef037cae0508e39ab7c00b043968e51194907795a /gdb/i386-tdep.c
parent3d2615808faf9c93f0fe8a20133fa80e12163a82 (diff)
downloadgdb-85540d8c4ad4df82637ddc835173c80d4dcdac08.zip
gdb-85540d8c4ad4df82637ddc835173c80d4dcdac08.tar.gz
gdb-85540d8c4ad4df82637ddc835173c80d4dcdac08.tar.bz2
* config/i386/tm-i386.h (STAB_REG_TO_REGNUM, SDB_REG_TO_REGNUM,
DWARF_REG_TO_REGNUM, DWARF2_REG_TO_REGNUM): New defines. (i386_stab_reg_to_regnum, i386_dwarf_reg_to_regnum): New prototypes. * config/i386/tm-fbsd.h, config/i386/tm-i386gnu.h, config/i386/tm-linux.h (STAB_REG_TO_REGNUM): Redefine to call i386_dwarf_reg_to_regnum. * i386-tdep.c (i386_stab_reg_to_regnum, i386_dwarf_reg_to_regnum): New functions.
Diffstat (limited to 'gdb/i386-tdep.c')
-rw-r--r--gdb/i386-tdep.c62
1 files changed, 62 insertions, 0 deletions
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 60ca84e..3aa8cb5 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -59,6 +59,68 @@ int i386_register_raw_size[MAX_NUM_REGS] = {
/* i386_register_virtual_size[i] is the size in bytes of the virtual
type of register i. */
int i386_register_virtual_size[MAX_NUM_REGS];
+
+/* Convert stabs register number REG to the appropriate register
+ number used by GDB. */
+
+int
+i386_stab_reg_to_regnum (int reg)
+{
+ /* This implements what GCC calls the "default" register map. */
+ if (reg >= 0 && reg <= 7)
+ {
+ /* General registers. */
+ return reg;
+ }
+ else if (reg >= 12 && reg <= 19)
+ {
+ /* Floating-point registers. */
+ return reg - 12 + FP0_REGNUM;
+ }
+ else if (reg >= 21 && reg <= 28)
+ {
+ /* SSE registers. */
+ return reg - 21 + XMM0_REGNUM;
+ }
+ else if (reg >= 29 && reg <= 36)
+ {
+ /* MMX registers. */
+ /* FIXME: kettenis/2001-07-28: Should we have the MMX registers
+ as pseudo-registers? */
+ return reg - 29 + FP0_REGNUM;
+ }
+
+ /* This will hopefully provoke a warning. */
+ return NUM_REGS + NUM_PSEUDO_REGS;
+}
+
+/* Convert Dwarf register number REG to the appropriate register
+ number used by GDB. */
+
+int
+i386_dwarf_reg_to_regnum (int reg)
+{
+ /* The DWARF register numbering includes %eip and %eflags, and
+ numbers the floating point registers differently. */
+ if (reg >= 0 && reg <= 9)
+ {
+ /* General registers. */
+ return reg;
+ }
+ else if (reg >= 11 && reg <= 18)
+ {
+ /* Floating-point registers. */
+ return reg - 11 + FP0_REGNUM;
+ }
+ else if (reg >= 21)
+ {
+ /* The SSE and MMX registers have identical numbers as in stabs. */
+ return i386_stab_reg_to_regnum (reg);
+ }
+
+ /* This will hopefully provoke a warning. */
+ return NUM_REGS + NUM_PSEUDO_REGS;
+}
/* This is the variable that is set with "set disassembly-flavor", and