* config/i386/tm-i386.h (REGISTER_NAMES): Remove.
authorMark Kettenis <kettenis@gnu.org>
Wed, 31 Oct 2001 22:24:06 +0000 (22:24 +0000)
committerMark Kettenis <kettenis@gnu.org>
Wed, 31 Oct 2001 22:24:06 +0000 (22:24 +0000)
(REGISTER_NAME): New define.
(i386_register_name): New prototype.
* i386-tdep.c (i386_register_names): New variable.
(i386_register_name): New function.
* config/i386/tm-i386os9k.h, config/i386/tm-ptx.h,
config/i386/tm-symmetry.h: Undefine REGISTER_NAME instead of
REGISTER_NAMES.

gdb/ChangeLog
gdb/config/i386/tm-i386.h
gdb/config/i386/tm-i386os9k.h
gdb/config/i386/tm-ptx.h
gdb/config/i386/tm-symmetry.h
gdb/i386-tdep.c

index fca30f1f35791203970180a6bcab65a328184fab..36df6e7b9c751bd057fd462271e2bb6dbbf45dc6 100644 (file)
@@ -1,3 +1,14 @@
+2001-10-31  Mark Kettenis  <kettenis@gnu.org>
+
+       * config/i386/tm-i386.h (REGISTER_NAMES): Remove.
+       (REGISTER_NAME): New define.
+       (i386_register_name): New prototype.
+       * i386-tdep.c (i386_register_names): New variable.
+       (i386_register_name): New function.
+       * config/i386/tm-i386os9k.h, config/i386/tm-ptx.h,
+       config/i386/tm-symmetry.h: Undefine REGISTER_NAME instead of
+       REGISTER_NAMES.
+
 2001-10-31  Christopher Faylor  <cgf@redhat.com>
 
        * win32-nat.c (register_loaded_dll): Attempt to ensure that the case of
index 5f2386cca2ff7f66cb349c6c659982ed3ea503ed..e821700fdee0da979e2caba912288d5ab72d14f8 100644 (file)
@@ -127,25 +127,6 @@ extern CORE_ADDR i386_saved_pc_after_call (struct frame_info *frame);
 /* Largest number of registers we could have in any configuration.  */
 #define MAX_NUM_REGS (16 + 16 + 9)
 
-/* Initializer for an array of names of registers.  There should be at least
-   NUM_REGS strings in this initializer.  Any excess ones are simply ignored.
-   The order of the first 8 registers must match the compiler's numbering
-   scheme (which is the same as the 386 scheme) and also regmap in the various
-   *-nat.c files. */
-
-#define REGISTER_NAMES { "eax",   "ecx",    "edx",   "ebx",    \
-                        "esp",   "ebp",    "esi",   "edi",     \
-                        "eip",   "eflags", "cs",    "ss",      \
-                        "ds",    "es",     "fs",    "gs",      \
-                        "st0",   "st1",    "st2",   "st3",     \
-                        "st4",   "st5",    "st6",   "st7",     \
-                        "fctrl", "fstat",  "ftag",  "fiseg",   \
-                         "fioff", "foseg",  "fooff", "fop",    \
-                        "xmm0",  "xmm1",   "xmm2",  "xmm3",    \
-                        "xmm4",  "xmm5",   "xmm6",  "xmm7",    \
-                         "mxcsr"                               \
-                      }
-
 /* Register numbers of various important registers.
    Note that some of these values are "real" register numbers,
    and correspond to the general registers of the machine,
@@ -195,6 +176,11 @@ extern CORE_ADDR i386_saved_pc_after_call (struct frame_info *frame);
 
 #define FPU_REG_RAW_SIZE (10)
 
+/* Return the name of register REG.  */
+
+#define REGISTER_NAME(reg) i386_register_name ((reg))
+extern char *i386_register_name (int reg);
+
 /* Use the "default" register numbering scheme for stabs and COFF.  */
 
 #define STAB_REG_TO_REGNUM(reg) i386_stab_reg_to_regnum ((reg))
index 10fbdb490e306bd27f557b5801641e6f21149626..78fbc21a7c6f5bd7136aeb060ad552d23fe32f41 100644 (file)
@@ -34,7 +34,7 @@
    scheme (which is the same as the 386 scheme) and also regmap in the various
    *-nat.c files. */
 
-#undef  REGISTER_NAMES
+#undef REGISTER_NAME
 #define REGISTER_NAMES { "eax", "ecx", "edx", "ebx", \
                          "esp", "ebp", "esi", "edi", \
                          "eip", "eflags", "cs", "ss", \
index 50bfe4b1475f82bf048ab5feb3b64462a1d0d798..2a1731a161c8d0ea4a6632c474752bbce2ce5b49 100644 (file)
@@ -69,7 +69,7 @@ since it uses host specific ptrace calls.
    scheme (which is the same as the 386 scheme) and also regmap in the various
    *-nat.c files. */
 
-#undef  REGISTER_NAMES
+#undef REGISTER_NAME
 #define REGISTER_NAMES { "eax",  "ecx",    "edx",  "ebx",  \
                         "esp",  "ebp",    "esi",  "edi",  \
                         "eip",  "eflags", "st0",  "st1",  \
index a335ba92cf5c10f4bc3a6bc6cd856ff9a7f6fdaa..78281819dfa9ec3774741e72879cca30b7d11794 100644 (file)
@@ -66,7 +66,7 @@
    break mysteriously for no apparent reason.  Also note that the st(0)...
    st(7) 387 registers are represented as st0...st7.  */
 
-#undef  REGISTER_NAMES
+#undef REGISTER_NAME
 #define REGISTER_NAMES {     "eax",  "edx",  "ecx",   "st0",  "st1", \
                             "ebx",  "esi",  "edi",   "st2",  "st3", \
                             "st4",  "st5",  "st6",   "st7",  "esp", \
index 700ae25b2f20335a1f4ee7dd52f6db3cbc7f8d57..4035e93187daa67d46e96f273b83b346cdc646e7 100644 (file)
 
 #include "gdb_assert.h"
 
+/* Names of the registers.  The first 10 registers match the register
+   numbering scheme used by GCC for stabs and DWARF.  */
+static char *i386_register_names[] =
+{
+  "eax",   "ecx",    "edx",   "ebx",
+  "esp",   "ebp",    "esi",   "edi",
+  "eip",   "eflags", "cs",    "ss",
+  "ds",    "es",     "fs",    "gs",
+  "st0",   "st1",    "st2",   "st3",
+  "st4",   "st5",    "st6",   "st7",
+  "fctrl", "fstat",  "ftag",  "fiseg",
+  "fioff", "foseg",  "fooff", "fop",
+  "xmm0",  "xmm1",   "xmm2",  "xmm3",
+  "xmm4",  "xmm5",   "xmm6",  "xmm7",
+  "mxcsr"
+};
+
 /* i386_register_byte[i] is the offset into the register file of the
    start of register number i.  We initialize this from
    i386_register_raw_size.  */
@@ -62,6 +79,19 @@ int i386_register_raw_size[MAX_NUM_REGS] = {
    type of register i.  */
 int i386_register_virtual_size[MAX_NUM_REGS];
 
+/* Return the name of register REG.  */
+
+char *
+i386_register_name (int reg)
+{
+  if (reg < 0)
+    return NULL;
+  if (reg >= sizeof (i386_register_names) / sizeof (*i386_register_names))
+    return NULL;
+
+  return i386_register_names[reg];
+}
+
 /* Convert stabs register number REG to the appropriate register
    number used by GDB.  */