From fa88f6772de4b169c1651d73fc956cda828fb1b6 Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Mon, 17 Jun 2002 23:32:36 +0000 Subject: [PATCH] * gdbarch.sh (REGISTER_NAME): Change return type a constant string pointer. * gdbarch.h, gdbarch.c: Regenerate. * config/mips/tm-mips.h (mips_register_name): Update. * i386-tdep.h (i386_register_name): Update. * mips-tdep.c (mips_register_name): Update * alpha-tdep.c (alpha_register_name): Update. * arch-utils.c (legacy_register_name): Update. * arch-utils.h (legacy_register_name): Update. * avr-tdep.c (avr_register_name): Update. * ia64-tdep.c (ia64_register_name): Update. * i386-tdep.c (i386_register_name): Update. * sparc-tdep.c (sparc32_register_name): Update. (sparc64_register_name): Update. (sparclite_register_name): Update. (sparclet_register_name): * sh-tdep.c (sh_generic_register_name): Update. (sh_sh_register_name): Update. (sh_sh3_register_name): Update. (sh_sh3e_register_name): Update. (sh_sh_dsp_register_name): Update. (sh_sh3_dsp_register_name): Update. (sh_sh4_register_name): Update. (sh_sh64_register_name): Update. * s390-tdep.c (s390_register_name): Update. * rs6000-tdep.c (rs6000_register_name): Update. * ns32k-tdep.c (ns32k_register_name_32082): Update. (ns32k_register_name_32382): Update. * d10v-tdep.c (d10v_ts2_register_name): Update. (d10v_ts3_register_name): Update. * xstormy16-tdep.c (xstormy16_register_name): Update. * vax-tdep.c (vax_register_name): Update. * v850-tdep.c (v850_register_name): Update. * m68hc11-tdep.c (m68hc11_register_name): Update. * mn10300-tdep.c (mn10300_generic_register_name): Update. (am33_register_name): Update. --- gdb/ChangeLog | 39 +++++++++++++++++++++++++++++++++++++++ gdb/alpha-tdep.c | 2 +- gdb/arch-utils.c | 2 +- gdb/arch-utils.h | 2 +- gdb/avr-tdep.c | 2 +- gdb/config/mips/tm-mips.h | 2 +- gdb/d10v-tdep.c | 4 ++-- gdb/gdbarch.c | 2 +- gdb/gdbarch.h | 4 ++-- gdb/gdbarch.sh | 2 +- gdb/i386-tdep.c | 2 +- gdb/i386-tdep.h | 2 +- gdb/ia64-tdep.c | 2 +- gdb/m68hc11-tdep.c | 2 +- gdb/mips-tdep.c | 2 +- gdb/mn10300-tdep.c | 4 ++-- gdb/ns32k-tdep.c | 4 ++-- gdb/rs6000-tdep.c | 2 +- gdb/s390-tdep.c | 2 +- gdb/sh-tdep.c | 16 ++++++++-------- gdb/sparc-tdep.c | 8 ++++---- gdb/v850-tdep.c | 2 +- gdb/vax-tdep.c | 2 +- gdb/xstormy16-tdep.c | 2 +- 24 files changed, 76 insertions(+), 37 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 590ae21..54abec0 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,42 @@ +2002-06-17 Andrew Cagney + + * gdbarch.sh (REGISTER_NAME): Change return type a constant string + pointer. + * gdbarch.h, gdbarch.c: Regenerate. + * config/mips/tm-mips.h (mips_register_name): Update. + * i386-tdep.h (i386_register_name): Update. + * mips-tdep.c (mips_register_name): Update + * alpha-tdep.c (alpha_register_name): Update. + * arch-utils.c (legacy_register_name): Update. + * arch-utils.h (legacy_register_name): Update. + * avr-tdep.c (avr_register_name): Update. + * ia64-tdep.c (ia64_register_name): Update. + * i386-tdep.c (i386_register_name): Update. + * sparc-tdep.c (sparc32_register_name): Update. + (sparc64_register_name): Update. + (sparclite_register_name): Update. + (sparclet_register_name): Update. + * sh-tdep.c (sh_generic_register_name): Update. + (sh_sh_register_name): Update. + (sh_sh3_register_name): Update. + (sh_sh3e_register_name): Update. + (sh_sh_dsp_register_name): Update. + (sh_sh3_dsp_register_name): Update. + (sh_sh4_register_name): Update. + (sh_sh64_register_name): Update. + * s390-tdep.c (s390_register_name): Update. + * rs6000-tdep.c (rs6000_register_name): Update. + * ns32k-tdep.c (ns32k_register_name_32082): Update. + (ns32k_register_name_32382): Update. + * d10v-tdep.c (d10v_ts2_register_name): Update. + (d10v_ts3_register_name): Update. + * xstormy16-tdep.c (xstormy16_register_name): Update. + * vax-tdep.c (vax_register_name): Update. + * v850-tdep.c (v850_register_name): Update. + * m68hc11-tdep.c (m68hc11_register_name): Update. + * mn10300-tdep.c (mn10300_generic_register_name): Update. + (am33_register_name): Update. + 2002-06-17 Grace Sainsbury * m68k-tdep.c: Reindented. diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c index 8a87a8a..4dc3e8e 100644 --- a/gdb/alpha-tdep.c +++ b/gdb/alpha-tdep.c @@ -277,7 +277,7 @@ push_sigtramp_desc (CORE_ADDR low_addr) } -static char * +static const char * alpha_register_name (int regno) { static char *register_names[] = diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c index 887aa9d..2237fe1 100644 --- a/gdb/arch-utils.c +++ b/gdb/arch-utils.c @@ -137,7 +137,7 @@ generic_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc) return 0; } -char * +const char * legacy_register_name (int i) { #ifdef REGISTER_NAMES diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h index 0b397af..8b997fb 100644 --- a/gdb/arch-utils.h +++ b/gdb/arch-utils.h @@ -48,7 +48,7 @@ extern gdbarch_frameless_function_invocation_ftype generic_frameless_function_in extern gdbarch_return_value_on_stack_ftype generic_return_value_on_stack_not; /* Map onto old REGISTER_NAMES. */ -extern char *legacy_register_name (int i); +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/avr-tdep.c b/gdb/avr-tdep.c index 43ac309..79f8d6b 100644 --- a/gdb/avr-tdep.c +++ b/gdb/avr-tdep.c @@ -158,7 +158,7 @@ struct gdbarch_tdep /* Lookup the name of a register given it's number. */ -static char * +static const char * avr_register_name (int regnum) { static char *register_names[] = { diff --git a/gdb/config/mips/tm-mips.h b/gdb/config/mips/tm-mips.h index f573e96..d53156c 100644 --- a/gdb/config/mips/tm-mips.h +++ b/gdb/config/mips/tm-mips.h @@ -93,7 +93,7 @@ extern int in_sigtramp (CORE_ADDR, char *); /* Given the register index, return the name of the corresponding register. */ -extern char *mips_register_name (int regnr); +extern const char *mips_register_name (int regnr); #define REGISTER_NAME(i) mips_register_name (i) /* Initializer for an array of names of registers. diff --git a/gdb/d10v-tdep.c b/gdb/d10v-tdep.c index 4fe1c62..856e18e 100644 --- a/gdb/d10v-tdep.c +++ b/gdb/d10v-tdep.c @@ -187,7 +187,7 @@ enum ts2_regnums TS2_A0_REGNUM = 35 }; -static char * +static const char * d10v_ts2_register_name (int reg_nr) { static char *register_names[] = @@ -213,7 +213,7 @@ enum ts3_regnums TS3_A0_REGNUM = 32 }; -static char * +static const char * d10v_ts3_register_name (int reg_nr) { static char *register_names[] = diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 57b6004..24a80ab 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -2806,7 +2806,7 @@ set_gdbarch_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, gdbarch->dwarf2_reg_to_regnum = dwarf2_reg_to_regnum; } -char * +const char * gdbarch_register_name (struct gdbarch *gdbarch, int regnr) { gdb_assert (gdbarch != NULL); diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index 018e22a..aeb4747 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -658,8 +658,8 @@ extern void set_gdbarch_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, gdbarch_d #define REGISTER_NAME(regnr) (legacy_register_name (regnr)) #endif -typedef char * (gdbarch_register_name_ftype) (int regnr); -extern char * gdbarch_register_name (struct gdbarch *gdbarch, int regnr); +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); #if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (REGISTER_NAME) #error "Non multi-arch definition of REGISTER_NAME" diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 5735d20..b4eb29b 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -458,7 +458,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:char *:register_name:int regnr:regnr:::legacy_register_name::0 +f:2:REGISTER_NAME:const char *:register_name:int regnr:regnr:::legacy_register_name::0 v:2:REGISTER_SIZE:int:register_size::::0:-1 v:2:REGISTER_BYTES:int:register_bytes::::0:-1 f:2:REGISTER_BYTE:int:register_byte:int reg_nr:reg_nr::0:0 diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index c50059b..1a838f2 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -78,7 +78,7 @@ static int i386_register_size[I386_SSE_NUM_REGS] = { /* Return the name of register REG. */ -char * +const char * i386_register_name (int reg) { if (reg < 0) diff --git a/gdb/i386-tdep.h b/gdb/i386-tdep.h index 64af99d..61a8178 100644 --- a/gdb/i386-tdep.h +++ b/gdb/i386-tdep.h @@ -157,7 +157,7 @@ struct gdbarch_tdep + I386_SIZEOF_XREGS) /* Return the name of register REG. */ -extern char *i386_register_name (int reg); +extern char const *i386_register_name (int reg); /* Return the offset into the register array of the start of register number REG. */ diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c index 44210d7..89009de 100644 --- a/gdb/ia64-tdep.c +++ b/gdb/ia64-tdep.c @@ -243,7 +243,7 @@ struct gdbarch_tdep #define FIND_GLOBAL_POINTER \ (gdbarch_tdep (current_gdbarch)->find_global_pointer) -static char * +static const char * ia64_register_name (int reg) { return ia64_register_names[reg]; diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c index 38ec7e3..eb8fb74 100644 --- a/gdb/m68hc11-tdep.c +++ b/gdb/m68hc11-tdep.c @@ -255,7 +255,7 @@ m68hc11_store_pseudo_register (int regno) } } -static char * +static const char * m68hc11_register_name (int reg_nr) { if (reg_nr < 0) diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index 8b1e6d5..712ac63 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -270,7 +270,7 @@ static struct cmd_list_element *showmipscmdlist = NULL; char *mips_generic_reg_names[] = MIPS_REGISTER_NAMES; char **mips_processor_reg_names = mips_generic_reg_names; -char * +const char * mips_register_name (int i) { return mips_processor_reg_names[i]; diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c index 5d3da69..3530101 100644 --- a/gdb/mn10300-tdep.c +++ b/gdb/mn10300-tdep.c @@ -89,7 +89,7 @@ register_name (int reg, char **regs, long sizeof_regs) return regs[reg]; } -static char * +static const char * mn10300_generic_register_name (int reg) { static char *regs[] = @@ -102,7 +102,7 @@ mn10300_generic_register_name (int reg) } -static char * +static const char * am33_register_name (int reg) { static char *regs[] = diff --git a/gdb/ns32k-tdep.c b/gdb/ns32k-tdep.c index 4e9f9608..ae81ebe 100644 --- a/gdb/ns32k-tdep.c +++ b/gdb/ns32k-tdep.c @@ -36,7 +36,7 @@ static CORE_ADDR ns32k_get_enter_addr (CORE_ADDR); static int ns32k_localcount (CORE_ADDR enter_pc); static void flip_bytes (void *, int); -static char * +static const char * ns32k_register_name_32082 (int regno) { static char *register_names[] = @@ -55,7 +55,7 @@ ns32k_register_name_32082 (int regno) return (register_names[regno]); } -static char * +static const char * ns32k_register_name_32382 (int regno) { static char *register_names[] = diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index ee66d6b..c001252 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -1575,7 +1575,7 @@ regsize (const struct reg *reg, int wordsize) /* Return the name of register number N, or null if no such register exists in the current architecture. */ -static char * +static const char * rs6000_register_name (int n) { struct gdbarch_tdep *tdep = TDEP; diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c index 8add495..cb3b81d 100644 --- a/gdb/s390-tdep.c +++ b/gdb/s390-tdep.c @@ -150,7 +150,7 @@ s390_memset_extra_info (struct frame_extra_info *fextra_info) -char * +const char * s390_register_name (int reg_nr) { static char *register_names[] = { diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c index 375b55a..a0117f0 100644 --- a/gdb/sh-tdep.c +++ b/gdb/sh-tdep.c @@ -68,7 +68,7 @@ struct frame_extra_info int f_offset; }; -static char * +static const char * sh_generic_register_name (int reg_nr) { static char *register_names[] = @@ -90,7 +90,7 @@ sh_generic_register_name (int reg_nr) return register_names[reg_nr]; } -static char * +static const char * sh_sh_register_name (int reg_nr) { static char *register_names[] = @@ -112,7 +112,7 @@ sh_sh_register_name (int reg_nr) return register_names[reg_nr]; } -static char * +static const char * sh_sh3_register_name (int reg_nr) { static char *register_names[] = @@ -134,7 +134,7 @@ sh_sh3_register_name (int reg_nr) return register_names[reg_nr]; } -static char * +static const char * sh_sh3e_register_name (int reg_nr) { static char *register_names[] = @@ -156,7 +156,7 @@ sh_sh3e_register_name (int reg_nr) return register_names[reg_nr]; } -static char * +static const char * sh_sh_dsp_register_name (int reg_nr) { static char *register_names[] = @@ -178,7 +178,7 @@ sh_sh_dsp_register_name (int reg_nr) return register_names[reg_nr]; } -static char * +static const char * sh_sh3_dsp_register_name (int reg_nr) { static char *register_names[] = @@ -201,7 +201,7 @@ sh_sh3_dsp_register_name (int reg_nr) return register_names[reg_nr]; } -static char * +static const char * sh_sh4_register_name (int reg_nr) { static char *register_names[] = @@ -236,7 +236,7 @@ sh_sh4_register_name (int reg_nr) return register_names[reg_nr]; } -static char * +static const char * sh_sh64_register_name (int reg_nr) { static char *register_names[] = diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c index 6ad95c4..2ca35b1 100644 --- a/gdb/sparc-tdep.c +++ b/gdb/sparc-tdep.c @@ -2551,7 +2551,7 @@ sparc_print_extra_frame_info (struct frame_info *fi) /* MULTI_ARCH support */ -static char * +static const char * sparc32_register_name (int regno) { static char *register_names[] = @@ -2575,7 +2575,7 @@ sparc32_register_name (int regno) return register_names[regno]; } -static char * +static const char * sparc64_register_name (int regno) { static char *register_names[] = @@ -2607,7 +2607,7 @@ sparc64_register_name (int regno) return register_names[regno]; } -static char * +static const char * sparclite_register_name (int regno) { static char *register_names[] = @@ -2632,7 +2632,7 @@ sparclite_register_name (int regno) return register_names[regno]; } -static char * +static const char * sparclet_register_name (int regno) { static char *register_names[] = diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c index dc3bc6b..c4f6bd9 100644 --- a/gdb/v850-tdep.c +++ b/gdb/v850-tdep.c @@ -205,7 +205,7 @@ static CORE_ADDR v850_scan_prologue (CORE_ADDR pc, struct prologue_info *fs); /* Function: v850_register_name Returns the name of the v850/v850e register N. */ -static char * +static const char * v850_register_name (int regnum) { if (regnum < 0 || regnum >= E_NUM_REGS) diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c index 2e82d92..a723a6d 100644 --- a/gdb/vax-tdep.c +++ b/gdb/vax-tdep.c @@ -83,7 +83,7 @@ static gdbarch_fix_call_dummy_ftype vax_fix_call_dummy; static unsigned char *print_insn_arg (); -static char * +static const char * vax_register_name (int regno) { static char *register_names[] = diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c index 9be5971..8e283b8 100644 --- a/gdb/xstormy16-tdep.c +++ b/gdb/xstormy16-tdep.c @@ -97,7 +97,7 @@ enum /* Function: xstormy16_register_name Returns the name of the standard Xstormy16 register N. */ -static char * +static const char * xstormy16_register_name (int regnum) { static char *register_names[] = { -- 2.7.4