From e23457df3d4154cad2d28763afa01c88a8f4d9bd Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Thu, 3 Jul 2003 22:14:42 +0000 Subject: [PATCH] 2003-07-03 Andrew Cagney * gdbarch.sh (REGISTER_NAME): Do not supply a default. * gdbarch.h, gdbarch.c: Re-generate. * config/sparc/tm-sparc.h (REGISTER_NAME): Define. (legacy_register_name): Declare. * config/sparc/tm-sp64.h (legacy_register_name): Declare. (REGISTER_NAME): Define. * sparc-tdep.c (legacy_register_name): New function. * config/pa/tm-hppa64.h (REGISTER_NAMES): Delete macro. (REGISTER_NAME): Define. (hppa64_register_name): Declare. * config/pa/tm-hppa.h (REGISTER_NAMES): Delete macro. * hppa-tdep.c (hppa_gdbarch_init): Set hppa_register_name. (hppa64_register_name): New function. (hppa_register_name): New function. * arch-utils.c (legacy_register_name): Delete. * arch-utils.h (legacy_register_name): Delete. --- gdb/ChangeLog | 19 +++++++++ gdb/arch-utils.c | 16 ------- gdb/arch-utils.h | 3 -- gdb/config/pa/tm-hppa.h | 22 ---------- gdb/config/pa/tm-hppa64.h | 16 +------ gdb/config/sparc/tm-sp64.h | 2 + gdb/config/sparc/tm-sparc.h | 2 + gdb/gdbarch.c | 2 - gdb/gdbarch.h | 5 --- gdb/gdbarch.sh | 2 +- gdb/hppa-tdep.c | 83 +++++++++++++++++++++++++++++++++++++ gdb/sparc-tdep.c | 16 +++++++ 12 files changed, 125 insertions(+), 63 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index acc0bc1379d..35a63165d35 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,22 @@ +2003-07-03 Andrew Cagney + + * gdbarch.sh (REGISTER_NAME): Do not supply a default. + * gdbarch.h, gdbarch.c: Re-generate. + * config/sparc/tm-sparc.h (REGISTER_NAME): Define. + (legacy_register_name): Declare. + * config/sparc/tm-sp64.h (legacy_register_name): Declare. + (REGISTER_NAME): Define. + * sparc-tdep.c (legacy_register_name): New function. + * config/pa/tm-hppa64.h (REGISTER_NAMES): Delete macro. + (REGISTER_NAME): Define. + (hppa64_register_name): Declare. + * config/pa/tm-hppa.h (REGISTER_NAMES): Delete macro. + * hppa-tdep.c (hppa_gdbarch_init): Set hppa_register_name. + (hppa64_register_name): New function. + (hppa_register_name): New function. + * arch-utils.c (legacy_register_name): Delete. + * arch-utils.h (legacy_register_name): Delete. + 2003-07-03 Daniel Jacobowitz * cli/cli-interp.c (cli_interpreter_resume): Update the diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c index 043600e9848..40a863b26f8 100644 --- a/gdb/arch-utils.c +++ b/gdb/arch-utils.c @@ -131,22 +131,6 @@ generic_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc) return 0; } -const char * -legacy_register_name (int i) -{ -#ifdef REGISTER_NAMES - static char *names[] = REGISTER_NAMES; - if (i < 0 || i >= (sizeof (names) / sizeof (*names))) - return NULL; - else - return names[i]; -#else - internal_error (__FILE__, __LINE__, - "legacy_register_name: called."); - return NULL; -#endif -} - #if defined (CALL_DUMMY) LONGEST legacy_call_dummy_words[] = CALL_DUMMY; #else diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h index 234257d97b2..fcea5310b25 100644 --- a/gdb/arch-utils.h +++ b/gdb/arch-utils.h @@ -55,9 +55,6 @@ extern gdbarch_frameless_function_invocation_ftype generic_frameless_function_in language family, so that case is irrelevant for C. */ extern gdbarch_return_value_on_stack_ftype generic_return_value_on_stack_not; -/* Map onto old REGISTER_NAMES. */ -extern const char *legacy_register_name (int i); - /* Accessor for old global function pointer for disassembly. */ extern int legacy_print_insn (bfd_vma vma, disassemble_info *info); diff --git a/gdb/config/pa/tm-hppa.h b/gdb/config/pa/tm-hppa.h index 1ec91d453f6..3d0d3f16588 100644 --- a/gdb/config/pa/tm-hppa.h +++ b/gdb/config/pa/tm-hppa.h @@ -54,28 +54,6 @@ const unsigned char *hppa_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr); extern int hppa_pc_requires_run_before_use (CORE_ADDR pc); #define PC_REQUIRES_RUN_BEFORE_USE(pc) hppa_pc_requires_run_before_use (pc) -/* Initializer for an array of names of registers. - There should be NUM_REGS strings in this initializer. - They are in rows of eight entries */ - -#define REGISTER_NAMES \ - {"flags", "r1", "rp", "r3", "r4", "r5", "r6", "r7", \ - "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", \ - "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", \ - "r24", "r25", "r26", "dp", "ret0", "ret1", "sp", "r31", \ - "sar", "pcoqh", "pcsqh", "pcoqt", "pcsqt", "eiem", "iir", "isr", \ - "ior", "ipsw", "goto", "sr4", "sr0", "sr1", "sr2", "sr3", \ - "sr5", "sr6", "sr7", "cr0", "cr8", "cr9", "ccr", "cr12", \ - "cr13", "cr24", "cr25", "cr26", "mpsfu_high","mpsfu_low","mpsfu_ovflo","pad",\ - "fpsr", "fpe1", "fpe2", "fpe3", "fpe4", "fpe5", "fpe6", "fpe7", \ - "fr4", "fr4R", "fr5", "fr5R", "fr6", "fr6R", "fr7", "fr7R", \ - "fr8", "fr8R", "fr9", "fr9R", "fr10", "fr10R", "fr11", "fr11R", \ - "fr12", "fr12R", "fr13", "fr13R", "fr14", "fr14R", "fr15", "fr15R", \ - "fr16", "fr16R", "fr17", "fr17R", "fr18", "fr18R", "fr19", "fr19R", \ - "fr20", "fr20R", "fr21", "fr21R", "fr22", "fr22R", "fr23", "fr23R", \ - "fr24", "fr24R", "fr25", "fr25R", "fr26", "fr26R", "fr27", "fr27R", \ - "fr28", "fr28R", "fr29", "fr29R", "fr30", "fr30R", "fr31", "fr31R"} - /* 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, diff --git a/gdb/config/pa/tm-hppa64.h b/gdb/config/pa/tm-hppa64.h index 2e5e039d7f3..cb60a13fffd 100644 --- a/gdb/config/pa/tm-hppa64.h +++ b/gdb/config/pa/tm-hppa64.h @@ -398,20 +398,8 @@ extern CORE_ADDR hppa_target_read_fp (void); /* Initializer for an array of names of registers. There should be NUM_REGS strings in this initializer. They are in rows of eight entries */ -#undef REGISTER_NAMES -#define REGISTER_NAMES \ - {"flags", "r1", "rp", "r3", "r4", "r5", "r6", "r7", \ - "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", \ - "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", \ - "r24", "r25", "r26", "dp", "ret0", "ret1", "sp", "r31", \ - "sar", "pcoqh", "pcsqh", "pcoqt", "pcsqt", "eiem", "iir", "isr", \ - "ior", "ipsw", "goto", "sr4", "sr0", "sr1", "sr2", "sr3", \ - "sr5", "sr6", "sr7", "cr0", "cr8", "cr9", "ccr", "cr12", \ - "cr13", "cr24", "cr25", "cr26", "mpsfu_high","mpsfu_low","mpsfu_ovflo","pad",\ - "fpsr", "fpe1", "fpe2", "fpe3", "fr4", "fr5", "fr6", "fr7", \ - "fr8", "fr9", "fr10", "fr11", "fr12", "fr13", "fr14", "fr15", \ - "fr16", "fr17", "fr18", "fr19", "fr20", "fr21", "fr22", "fr23", \ - "fr24", "fr25", "fr26", "fr27", "fr28", "fr29", "fr30", "fr31"} +extern const char *hppa64_register_name (int i); +#define REGISTER_NAME hppa64_register_name #undef FP0_REGNUM #undef FP4_REGNUM diff --git a/gdb/config/sparc/tm-sp64.h b/gdb/config/sparc/tm-sp64.h index 8baa66a2193..f2507d2bf75 100644 --- a/gdb/config/sparc/tm-sp64.h +++ b/gdb/config/sparc/tm-sp64.h @@ -260,6 +260,8 @@ CORE_ADDR sparc64_push_arguments (int, /* These are here at the end to simplify removing them if we have to. */ \ "icc", "xcc", "fcc0", "fcc1", "fcc2", "fcc3" \ } +extern const char *legacy_register_name (int i); +#define REGISTER_NAME legacy_register_name #undef REG_STRUCT_HAS_ADDR #define REG_STRUCT_HAS_ADDR(gcc_p,type) (TYPE_LENGTH (type) > 32) diff --git a/gdb/config/sparc/tm-sparc.h b/gdb/config/sparc/tm-sparc.h index 64ce5c72cbd..ec60c7983c2 100644 --- a/gdb/config/sparc/tm-sparc.h +++ b/gdb/config/sparc/tm-sparc.h @@ -158,6 +158,8 @@ extern int sparc_intreg_size (void); \ "y", "psr", "wim", "tbr", "pc", "npc", "fpsr", "cpsr" \ } +extern const char *legacy_register_name (int i); +#define REGISTER_NAME legacy_register_name /* Offset from address of function to start of its code. Zero on most machines. */ diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 966e373939c..c4aa9d26505 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -514,7 +514,6 @@ gdbarch_alloc (const struct gdbarch_info *info, current_gdbarch->dwarf_reg_to_regnum = no_op_reg_to_regnum; current_gdbarch->sdb_reg_to_regnum = no_op_reg_to_regnum; current_gdbarch->dwarf2_reg_to_regnum = no_op_reg_to_regnum; - current_gdbarch->register_name = legacy_register_name; current_gdbarch->deprecated_register_byte = generic_register_byte; current_gdbarch->deprecated_register_raw_size = generic_register_size; current_gdbarch->deprecated_register_virtual_size = generic_register_size; @@ -637,7 +636,6 @@ verify_gdbarch (struct gdbarch *gdbarch) /* Skip verify of dwarf_reg_to_regnum, invalid_p == 0 */ /* Skip verify of sdb_reg_to_regnum, invalid_p == 0 */ /* Skip verify of dwarf2_reg_to_regnum, invalid_p == 0 */ - /* Skip verify of register_name, invalid_p == 0 */ /* Skip verify of register_type, has predicate */ /* Skip verify of deprecated_register_virtual_type, has predicate */ /* Skip verify of deprecated_register_byte, has predicate */ diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index 0242d5b8ad4..e4252eae7e5 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -589,11 +589,6 @@ extern void set_gdbarch_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, gdbarch_d #define DWARF2_REG_TO_REGNUM(dwarf2_regnr) (gdbarch_dwarf2_reg_to_regnum (current_gdbarch, dwarf2_regnr)) #endif -/* Default (function) for non- multi-arch platforms. */ -#if (!GDB_MULTI_ARCH) && !defined (REGISTER_NAME) -#define REGISTER_NAME(regnr) (legacy_register_name (regnr)) -#endif - typedef const char * (gdbarch_register_name_ftype) (int regnr); extern const char * gdbarch_register_name (struct gdbarch *gdbarch, int regnr); extern void set_gdbarch_register_name (struct gdbarch *gdbarch, gdbarch_register_name_ftype *register_name); diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 982b8a56249..02a1dc7c6be 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -465,7 +465,7 @@ f:2:DWARF_REG_TO_REGNUM:int:dwarf_reg_to_regnum:int dwarf_regnr:dwarf_regnr:::no # to map one to one onto the sdb register numbers. f:2:SDB_REG_TO_REGNUM:int:sdb_reg_to_regnum:int sdb_regnr:sdb_regnr:::no_op_reg_to_regnum::0 f:2:DWARF2_REG_TO_REGNUM:int:dwarf2_reg_to_regnum:int dwarf2_regnr:dwarf2_regnr:::no_op_reg_to_regnum::0 -f:2:REGISTER_NAME:const char *:register_name:int regnr:regnr:::legacy_register_name::0 +f::REGISTER_NAME:const char *:register_name:int regnr:regnr # REGISTER_TYPE is a direct replacement for REGISTER_VIRTUAL_TYPE. M:2:REGISTER_TYPE:struct type *:register_type:int reg_nr:reg_nr::0: diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index 37aa44b835f..fed6cb181f8 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -678,6 +678,88 @@ hppa_breakpoint_from_pc (CORE_ADDR *pc, int *len) return breakpoint; } +/* Return the name of a register. */ + +const char * +hppa_register_name (int i) +{ + static char *names[] = { + "flags", "r1", "rp", "r3", + "r4", "r5", "r6", "r7", + "r8", "r9", "r10", "r11", + "r12", "r13", "r14", "r15", + "r16", "r17", "r18", "r19", + "r20", "r21", "r22", "r23", + "r24", "r25", "r26", "dp", + "ret0", "ret1", "sp", "r31", + "sar", "pcoqh", "pcsqh", "pcoqt", + "pcsqt", "eiem", "iir", "isr", + "ior", "ipsw", "goto", "sr4", + "sr0", "sr1", "sr2", "sr3", + "sr5", "sr6", "sr7", "cr0", + "cr8", "cr9", "ccr", "cr12", + "cr13", "cr24", "cr25", "cr26", + "mpsfu_high","mpsfu_low","mpsfu_ovflo","pad", + "fpsr", "fpe1", "fpe2", "fpe3", + "fpe4", "fpe5", "fpe6", "fpe7", + "fr4", "fr4R", "fr5", "fr5R", + "fr6", "fr6R", "fr7", "fr7R", + "fr8", "fr8R", "fr9", "fr9R", + "fr10", "fr10R", "fr11", "fr11R", + "fr12", "fr12R", "fr13", "fr13R", + "fr14", "fr14R", "fr15", "fr15R", + "fr16", "fr16R", "fr17", "fr17R", + "fr18", "fr18R", "fr19", "fr19R", + "fr20", "fr20R", "fr21", "fr21R", + "fr22", "fr22R", "fr23", "fr23R", + "fr24", "fr24R", "fr25", "fr25R", + "fr26", "fr26R", "fr27", "fr27R", + "fr28", "fr28R", "fr29", "fr29R", + "fr30", "fr30R", "fr31", "fr31R" + }; + if (i < 0 || i >= (sizeof (names) / sizeof (*names))) + return NULL; + else + return names[i]; +} + +const char * +hppa64_register_name (int i) +{ + static char *names[] = { + "flags", "r1", "rp", "r3", + "r4", "r5", "r6", "r7", + "r8", "r9", "r10", "r11", + "r12", "r13", "r14", "r15", + "r16", "r17", "r18", "r19", + "r20", "r21", "r22", "r23", + "r24", "r25", "r26", "dp", + "ret0", "ret1", "sp", "r31", + "sar", "pcoqh", "pcsqh", "pcoqt", + "pcsqt", "eiem", "iir", "isr", + "ior", "ipsw", "goto", "sr4", + "sr0", "sr1", "sr2", "sr3", + "sr5", "sr6", "sr7", "cr0", + "cr8", "cr9", "ccr", "cr12", + "cr13", "cr24", "cr25", "cr26", + "mpsfu_high","mpsfu_low","mpsfu_ovflo","pad", + "fpsr", "fpe1", "fpe2", "fpe3", + "fr4", "fr5", "fr6", "fr7", + "fr8", "fr9", "fr10", "fr11", + "fr12", "fr13", "fr14", "fr15", + "fr16", "fr17", "fr18", "fr19", + "fr20", "fr21", "fr22", "fr23", + "fr24", "fr25", "fr26", "fr27", + "fr28", "fr29", "fr30", "fr31" + }; + if (i < 0 || i >= (sizeof (names) / sizeof (*names))) + return NULL; + else + return names[i]; +} + + + /* Return the adjustment necessary to make for addresses on the stack as presented by hpread.c. @@ -4943,6 +5025,7 @@ hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_deprecated_max_register_raw_size (gdbarch, 4); set_gdbarch_deprecated_max_register_virtual_size (gdbarch, 8); set_gdbarch_deprecated_register_virtual_type (gdbarch, hppa_register_virtual_type); + set_gdbarch_register_name (gdbarch, hppa_register_name); set_gdbarch_deprecated_store_struct_return (gdbarch, hppa_store_struct_return); set_gdbarch_deprecated_extract_return_value (gdbarch, hppa_extract_return_value); diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c index 9f13e2e62ce..fb770433912 100644 --- a/gdb/sparc-tdep.c +++ b/gdb/sparc-tdep.c @@ -2871,6 +2871,22 @@ sparc_print_extra_frame_info (struct frame_info *fi) /* MULTI_ARCH support */ +const char * +legacy_register_name (int i) +{ +#ifdef REGISTER_NAMES + static char *names[] = REGISTER_NAMES; + if (i < 0 || i >= (sizeof (names) / sizeof (*names))) + return NULL; + else + return names[i]; +#else + internal_error (__FILE__, __LINE__, + "legacy_register_name: called."); + return NULL; +#endif +} + static const char * sparc32_register_name (int regno) { -- 2.30.2