From 0c92afe8cde4361ee019f661e94e34b363ba24e9 Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Thu, 8 May 2003 18:46:49 +0000 Subject: [PATCH] 2003-05-08 Andrew Cagney * gdbarch.sh: Add comments on MAX_REGISTER_SIZE. * gdbarch.h: Re-generate. * defs.h (MAX_REGISTER_VIRTUAL_SIZE): Delete macro. (legacy_max_register_virtual_size): Delete declaration. * infcmd.c (default_print_registers_info): Use MAX_REGISTER_SIZE. * d10v-tdep.c (d10v_print_registers_info): Ditto. * tracepoint.c (memrange_sortmerge): Ditto. * sparc-tdep.c (sparc_print_registers): Ditto. * regcache.c (legacy_max_register_virtual_size): Delete function. --- gdb/ChangeLog | 12 ++++++++++++ gdb/d10v-tdep.c | 2 +- gdb/defs.h | 12 +++++------- gdb/gdbarch.h | 32 ++++++++++++-------------------- gdb/gdbarch.sh | 32 ++++++++++++-------------------- gdb/infcmd.c | 4 ++-- gdb/mi/ChangeLog | 4 ++++ gdb/mi/mi-main.c | 4 ++-- gdb/regcache.c | 9 --------- gdb/sparc-tdep.c | 4 ++-- gdb/tracepoint.c | 2 +- 11 files changed, 53 insertions(+), 64 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index ce84ed74d3d..f0d19c4226d 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,15 @@ +2003-05-08 Andrew Cagney + + * gdbarch.sh: Add comments on MAX_REGISTER_SIZE. + * gdbarch.h: Re-generate. + * defs.h (MAX_REGISTER_VIRTUAL_SIZE): Delete macro. + (legacy_max_register_virtual_size): Delete declaration. + * infcmd.c (default_print_registers_info): Use MAX_REGISTER_SIZE. + * d10v-tdep.c (d10v_print_registers_info): Ditto. + * tracepoint.c (memrange_sortmerge): Ditto. + * sparc-tdep.c (sparc_print_registers): Ditto. + * regcache.c (legacy_max_register_virtual_size): Delete function. + 2002-05-08 J. Brobecker * fork-child.c (escape_bang_in_quoted_argument): New function. diff --git a/gdb/d10v-tdep.c b/gdb/d10v-tdep.c index 32e60f14c6e..c184b4457e7 100644 --- a/gdb/d10v-tdep.c +++ b/gdb/d10v-tdep.c @@ -865,7 +865,7 @@ d10v_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file, } { - char *num = alloca (max_register_size (gdbarch)); + char num[MAX_REGISTER_SIZE]; int a; fprintf_filtered (file, "A0-A%d", NR_A_REGS - 1); for (a = a0_regnum (gdbarch); a < a0_regnum (gdbarch) + NR_A_REGS; a++) diff --git a/gdb/defs.h b/gdb/defs.h index 6024253a17a..420cf31e811 100644 --- a/gdb/defs.h +++ b/gdb/defs.h @@ -1086,6 +1086,11 @@ extern void *alloca (); #include "arch-utils.h" #endif +/* Maximum size of a register. Something small, but large enough for + all known ISAs. If it turns out to be too small, make it bigger. */ + +enum { MAX_REGISTER_SIZE = 16 }; + /* FIXME: cagney/2003-03-01: Hack to prop up old targets while they migrate to the overhauled register cache. @@ -1102,13 +1107,6 @@ extern void *alloca (); extern int legacy_max_register_raw_size (void); #define MAX_REGISTER_RAW_SIZE legacy_max_register_raw_size () -#ifdef MAX_REGISTER_VIRTUAL_SIZE -#error MAX_REGISTER_VIRTUAL_SIZE defined -#endif -extern int legacy_max_register_virtual_size (void); -#define MAX_REGISTER_VIRTUAL_SIZE legacy_max_register_virtual_size () - - /* Static target-system-dependent parameters for GDB. */ /* Number of bits in a char or unsigned char for the target machine. diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index 10404a07341..27b1ec3b242 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -782,10 +782,8 @@ extern void set_gdbarch_register_byte (struct gdbarch *gdbarch, gdbarch_register #endif #endif -/* The methods REGISTER_VIRTUAL_TYPE, MAX_REGISTER_RAW_SIZE, - MAX_REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE, - REGISTER_VIRTUAL_SIZE and REGISTER_RAW_SIZE are all being replaced - by REGISTER_TYPE. */ +/* The methods REGISTER_VIRTUAL_TYPE, REGISTER_VIRTUAL_SIZE and + REGISTER_RAW_SIZE are all being replaced by REGISTER_TYPE. */ /* Default (function) for non- multi-arch platforms. */ #if (!GDB_MULTI_ARCH) && !defined (REGISTER_RAW_SIZE) @@ -804,10 +802,9 @@ extern void set_gdbarch_register_raw_size (struct gdbarch *gdbarch, gdbarch_regi #endif #endif -/* The methods REGISTER_VIRTUAL_TYPE, MAX_REGISTER_RAW_SIZE, - MAX_REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE, - REGISTER_VIRTUAL_SIZE and REGISTER_RAW_SIZE are all being replaced - by REGISTER_TYPE. */ +/* The methods DEPRECATED_MAX_REGISTER_RAW_SIZE, MAX_REGISTER_RAW_SIZE, + DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE, and MAX_REGISTER_VIRTUAL_SIZE + are all being replaced by MAX_REGISTER_SIZE (a constant). */ #if defined (DEPRECATED_MAX_REGISTER_RAW_SIZE) /* Legacy for systems yet to multi-arch DEPRECATED_MAX_REGISTER_RAW_SIZE */ @@ -845,10 +842,8 @@ extern void set_gdbarch_deprecated_max_register_raw_size (struct gdbarch *gdbarc #endif #endif -/* The methods REGISTER_VIRTUAL_TYPE, MAX_REGISTER_RAW_SIZE, - MAX_REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE, - REGISTER_VIRTUAL_SIZE and REGISTER_RAW_SIZE are all being replaced - by REGISTER_TYPE. */ +/* The methods REGISTER_VIRTUAL_TYPE, REGISTER_VIRTUAL_SIZE and + REGISTER_RAW_SIZE are all being replaced by REGISTER_TYPE. */ /* Default (function) for non- multi-arch platforms. */ #if (!GDB_MULTI_ARCH) && !defined (REGISTER_VIRTUAL_SIZE) @@ -867,10 +862,9 @@ extern void set_gdbarch_register_virtual_size (struct gdbarch *gdbarch, gdbarch_ #endif #endif -/* The methods REGISTER_VIRTUAL_TYPE, MAX_REGISTER_RAW_SIZE, - MAX_REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE, - REGISTER_VIRTUAL_SIZE and REGISTER_RAW_SIZE are all being replaced - by REGISTER_TYPE. */ +/* The methods DEPRECATED_MAX_REGISTER_RAW_SIZE, MAX_REGISTER_RAW_SIZE, + DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE, and MAX_REGISTER_VIRTUAL_SIZE + are all being replaced by MAX_REGISTER_SIZE (a constant). */ #if defined (DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE) /* Legacy for systems yet to multi-arch DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE */ @@ -908,10 +902,8 @@ extern void set_gdbarch_deprecated_max_register_virtual_size (struct gdbarch *gd #endif #endif -/* The methods REGISTER_VIRTUAL_TYPE, MAX_REGISTER_RAW_SIZE, - MAX_REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE, - REGISTER_VIRTUAL_SIZE and REGISTER_RAW_SIZE have all being replaced - by REGISTER_TYPE. */ +/* The methods REGISTER_VIRTUAL_TYPE, REGISTER_VIRTUAL_SIZE and + REGISTER_RAW_SIZE are all being replaced by REGISTER_TYPE. */ #if defined (REGISTER_VIRTUAL_TYPE) /* Legacy for systems yet to multi-arch REGISTER_VIRTUAL_TYPE */ diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 47271f9ea4f..f4bae4c477f 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -480,30 +480,22 @@ v::REGISTER_BYTES:int:register_bytes # migration process - old code, calling REGISTER_BYTE, doesn't need to # be modified. F::REGISTER_BYTE:int:register_byte:int reg_nr:reg_nr::generic_register_byte:generic_register_byte -# The methods REGISTER_VIRTUAL_TYPE, MAX_REGISTER_RAW_SIZE, -# MAX_REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE, -# REGISTER_VIRTUAL_SIZE and REGISTER_RAW_SIZE are all being replaced -# by REGISTER_TYPE. +# The methods REGISTER_VIRTUAL_TYPE, REGISTER_VIRTUAL_SIZE and +# REGISTER_RAW_SIZE are all being replaced by REGISTER_TYPE. f:2:REGISTER_RAW_SIZE:int:register_raw_size:int reg_nr:reg_nr::generic_register_size:generic_register_size::0 -# The methods REGISTER_VIRTUAL_TYPE, MAX_REGISTER_RAW_SIZE, -# MAX_REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE, -# REGISTER_VIRTUAL_SIZE and REGISTER_RAW_SIZE are all being replaced -# by REGISTER_TYPE. +# The methods DEPRECATED_MAX_REGISTER_RAW_SIZE, MAX_REGISTER_RAW_SIZE, +# DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE, and MAX_REGISTER_VIRTUAL_SIZE +# are all being replaced by MAX_REGISTER_SIZE (a constant). V:2:DEPRECATED_MAX_REGISTER_RAW_SIZE:int:deprecated_max_register_raw_size -# The methods REGISTER_VIRTUAL_TYPE, MAX_REGISTER_RAW_SIZE, -# MAX_REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE, -# REGISTER_VIRTUAL_SIZE and REGISTER_RAW_SIZE are all being replaced -# by REGISTER_TYPE. +# The methods REGISTER_VIRTUAL_TYPE, REGISTER_VIRTUAL_SIZE and +# REGISTER_RAW_SIZE are all being replaced by REGISTER_TYPE. f:2:REGISTER_VIRTUAL_SIZE:int:register_virtual_size:int reg_nr:reg_nr::generic_register_size:generic_register_size::0 -# The methods REGISTER_VIRTUAL_TYPE, MAX_REGISTER_RAW_SIZE, -# MAX_REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE, -# REGISTER_VIRTUAL_SIZE and REGISTER_RAW_SIZE are all being replaced -# by REGISTER_TYPE. +# The methods DEPRECATED_MAX_REGISTER_RAW_SIZE, MAX_REGISTER_RAW_SIZE, +# DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE, and MAX_REGISTER_VIRTUAL_SIZE +# are all being replaced by MAX_REGISTER_SIZE (a constant). V:2:DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE:int:deprecated_max_register_virtual_size -# The methods REGISTER_VIRTUAL_TYPE, MAX_REGISTER_RAW_SIZE, -# MAX_REGISTER_VIRTUAL_SIZE, MAX_REGISTER_RAW_SIZE, -# REGISTER_VIRTUAL_SIZE and REGISTER_RAW_SIZE have all being replaced -# by REGISTER_TYPE. +# The methods REGISTER_VIRTUAL_TYPE, REGISTER_VIRTUAL_SIZE and +# REGISTER_RAW_SIZE are all being replaced by REGISTER_TYPE. F:2:REGISTER_VIRTUAL_TYPE:struct type *:register_virtual_type:int reg_nr:reg_nr::0:0 M:2:REGISTER_TYPE:struct type *:register_type:int reg_nr:reg_nr::0: # diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 5867655b98e..de6c319608d 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -1500,8 +1500,8 @@ default_print_registers_info (struct gdbarch *gdbarch, { int i; const int numregs = NUM_REGS + NUM_PSEUDO_REGS; - char *raw_buffer = alloca (MAX_REGISTER_RAW_SIZE); - char *virtual_buffer = alloca (MAX_REGISTER_VIRTUAL_SIZE); + char raw_buffer[MAX_REGISTER_SIZE]; + char virtual_buffer[MAX_REGISTER_SIZE]; if (DEPRECATED_DO_REGISTERS_INFO_P ()) { diff --git a/gdb/mi/ChangeLog b/gdb/mi/ChangeLog index dc6669bca0a..8e6d8a827c0 100644 --- a/gdb/mi/ChangeLog +++ b/gdb/mi/ChangeLog @@ -1,3 +1,7 @@ +2003-05-08 Andrew Cagney + + * mi-main.c (get_register): Use MAX_REGISTER_SIZE. + 2003-05-05 Andrew Cagney * mi-main.c (mi_cmd_data_write_register_values): Replace diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index e13516a2dac..ac785d354ea 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -511,8 +511,8 @@ mi_cmd_data_list_register_values (char *command, char **argv, int argc) static int get_register (int regnum, int format) { - char *raw_buffer = alloca (MAX_REGISTER_RAW_SIZE); - char *virtual_buffer = alloca (MAX_REGISTER_VIRTUAL_SIZE); + char raw_buffer[MAX_REGISTER_SIZE]; + char virtual_buffer[MAX_REGISTER_SIZE]; int optim; int realnum; CORE_ADDR addr; diff --git a/gdb/regcache.c b/gdb/regcache.c index 5bfe9581501..5fa2b4a8b32 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -305,15 +305,6 @@ legacy_max_register_raw_size (void) return max_register_size (current_gdbarch); } -int -legacy_max_register_virtual_size (void) -{ - if (DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE_P ()) - return DEPRECATED_MAX_REGISTER_VIRTUAL_SIZE; - else - return max_register_size (current_gdbarch); -} - int register_size (struct gdbarch *gdbarch, int regnum) { diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c index 00f9f1687b4..b3a0f1fab65 100644 --- a/gdb/sparc-tdep.c +++ b/gdb/sparc-tdep.c @@ -2070,8 +2070,8 @@ sparc_print_registers (struct gdbarch *gdbarch, { int i; const int numregs = NUM_REGS + NUM_PSEUDO_REGS; - char *raw_buffer = alloca (MAX_REGISTER_RAW_SIZE); - char *virtual_buffer = alloca (MAX_REGISTER_VIRTUAL_SIZE); + char raw_buffer[MAX_REGISTER_SIZE]; + char virtual_buffer[MAX_REGISTER_SIZE]; for (i = 0; i < numregs; i++) { diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index 855a5b23b42..17ee07c898d 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -1115,7 +1115,7 @@ memrange_sortmerge (struct collection_list *memranges) { if (memranges->list[a].type == memranges->list[b].type && memranges->list[b].start - memranges->list[a].end <= - MAX_REGISTER_VIRTUAL_SIZE) + MAX_REGISTER_SIZE) { /* memrange b starts before memrange a ends; merge them. */ if (memranges->list[b].end > memranges->list[a].end) -- 2.30.2