From: Jason Thorpe Date: Sun, 26 May 2002 09:29:36 +0000 (+0000) Subject: * ns32k-tdep.c: Update copyright years. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=af137673023d01905dc1353b9f84d95d78de1ce4;p=binutils-gdb.git * ns32k-tdep.c: Update copyright years. (ns32k_register_name_32082): New function. (ns32k_register_name_32382): Ditto. * config/ns32k/tm-nbsd.h (REGISTER_NAMES): Remove. (REGISTER_NAME): Define as ns32k_register_name_32382. * config/ns32k/tm-umax.h (REGISTER_NAMES): Remove. (REGISTER_NAME): Define as ns32k_register_name_32082. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index d2ffd4b6453..a54edf27d03 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +2002-05-26 Jason Thorpe + + * ns32k-tdep.c: Update copyright years. + (ns32k_register_name_32082): New function. + (ns32k_register_name_32382): Ditto. + * config/ns32k/tm-nbsd.h (REGISTER_NAMES): Remove. + (REGISTER_NAME): Define as ns32k_register_name_32382. + * config/ns32k/tm-umax.h (REGISTER_NAMES): Remove. + (REGISTER_NAME): Define as ns32k_register_name_32082. + 2002-05-24 Jim Blandy * dwarf2read.c (free_line_header): Use xfree, not free. diff --git a/gdb/config/ns32k/tm-nbsd.h b/gdb/config/ns32k/tm-nbsd.h index 3965e5d85da..a3bebbed205 100644 --- a/gdb/config/ns32k/tm-nbsd.h +++ b/gdb/config/ns32k/tm-nbsd.h @@ -47,24 +47,16 @@ /* tm-umax.h assumes a 32082 fpu. We have a 32382 fpu. */ -#undef REGISTER_NAMES -#undef NUM_REGS -#undef REGISTER_BYTES -#undef REGISTER_BYTE -/* Initializer for an array of names of registers. - There should be NUM_REGS strings in this initializer. */ -#define REGISTER_NAMES {"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \ - "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \ - "sp", "fp", "pc", "ps", \ - "fsr", \ - "l0", "l1", "l2", "l3", "l4", "l5", "l6", "l7", "xx", \ - } +#undef REGISTER_NAME +#define REGISTER_NAME(REGNUM) ns32k_register_name_32382(REGNUM) +#undef NUM_REGS #define NUM_REGS 29 /* Total amount of space needed to store our copies of the machine's register state, the array `registers'. */ +#undef REGISTER_BYTES #define REGISTER_BYTES \ ((NUM_REGS - 4) * REGISTER_RAW_SIZE(R0_REGNUM) \ + 8 * REGISTER_RAW_SIZE(LP0_REGNUM)) @@ -78,6 +70,7 @@ registers are at the end. Doing it this way is compatable for both 32081 and 32381 equiped machines. */ +#undef REGISTER_BYTE #define REGISTER_BYTE(N) (((N) < LP0_REGNUM? (N)\ : ((N) - LP0_REGNUM) & 1? (N) - 1 \ : ((N) - LP0_REGNUM + FP0_REGNUM)) * 4) diff --git a/gdb/config/ns32k/tm-umax.h b/gdb/config/ns32k/tm-umax.h index 354349ee912..ed77f3c795f 100644 --- a/gdb/config/ns32k/tm-umax.h +++ b/gdb/config/ns32k/tm-umax.h @@ -76,15 +76,10 @@ extern CORE_ADDR umax_skip_prologue (CORE_ADDR); #define NUM_GENERAL_REGS 8 -/* Initializer for an array of names of registers. - There should be NUM_REGS strings in this initializer. */ - -#define REGISTER_NAMES {"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \ - "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \ - "sp", "fp", "pc", "ps", \ - "fsr", \ - "l0", "l1", "l2", "l3", "xx", \ - } +extern char *ns32k_register_name_32082 (int); +extern char *ns32k_register_name_32382 (int); + +#define REGISTER_NAME(REGNUM) ns32k_register_name_32082(REGNUM) /* Register numbers of various important registers. Note that some of these values are "real" register numbers, diff --git a/gdb/ns32k-tdep.c b/gdb/ns32k-tdep.c index e9bbfc479a9..4c2fd0fa90c 100644 --- a/gdb/ns32k-tdep.c +++ b/gdb/ns32k-tdep.c @@ -1,6 +1,6 @@ /* Print NS 32000 instructions for GDB, the GNU debugger. - Copyright 1986, 1988, 1991, 1992, 1994, 1995, 1998, 1999, 2000, 2001 - Free Software Foundation, Inc. + Copyright 1986, 1988, 1991, 1992, 1994, 1995, 1998, 1999, 2000, 2001, + 2002 Free Software Foundation, Inc. This file is part of GDB. @@ -25,10 +25,43 @@ static int sign_extend (int value, int bits); -void -_initialize_ns32k_tdep (void) +char * +ns32k_register_name_32082 (int regno) { - tm_print_insn = print_insn_ns32k; + static char *register_names[] = + { + "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", + "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", + "sp", "fp", "pc", "ps", + "l0", "l1", "l2", "l3", "xx", + }; + + if (regno < 0) + return NULL; + if (regno >= sizeof (register_names) / sizeof (*register_names)) + return NULL; + + return (register_names[regno]); +} + +char * +ns32k_register_name_32382 (int regno) +{ + static char *register_names[] = + { + "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", + "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", + "sp", "fp", "pc", "ps", + "fsr", + "l0", "l1", "l2", "l3", "l4", "l5", "l6", "l7", "xx", + }; + + if (regno < 0) + return NULL; + if (regno >= sizeof (register_names) / sizeof (*register_names)) + return NULL; + + return (register_names[regno]); } /* Advance PC across any function entry prologue instructions @@ -188,3 +221,9 @@ ns32k_get_enter_addr (CORE_ADDR pc) return enter_addr; /* pc is between enter and exit */ } + +void +_initialize_ns32k_tdep (void) +{ + tm_print_insn = print_insn_ns32k; +}