diff options
-rw-r--r-- | gdb/ChangeLog | 23 | ||||
-rw-r--r-- | gdb/Makefile.in | 8 | ||||
-rw-r--r-- | gdb/frv-tdep.c | 1 | ||||
-rw-r--r-- | gdb/gdbarch.c | 19 | ||||
-rw-r--r-- | gdb/gdbarch.h | 22 | ||||
-rwxr-xr-x | gdb/gdbarch.sh | 2 | ||||
-rw-r--r-- | gdb/ia64-tdep.c | 17 | ||||
-rw-r--r-- | gdb/inferior.h | 2 | ||||
-rw-r--r-- | gdb/m68hc11-tdep.c | 1 | ||||
-rw-r--r-- | gdb/mn10300-tdep.c | 11 | ||||
-rw-r--r-- | gdb/regcache.c | 21 | ||||
-rw-r--r-- | gdb/rs6000-tdep.c | 1 | ||||
-rw-r--r-- | gdb/sh-tdep.c | 1 | ||||
-rw-r--r-- | gdb/sparc-tdep.c | 1 |
14 files changed, 96 insertions, 34 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 558b424..e154e34 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,28 @@ 2003-06-07 Andrew Cagney <cagney@redhat.com> + * gdbarch.sh (TARGET_READ_SP): Add predicate, delete default. + * gdbarch.h, gdbarch.c: Regenerate. + * mn10300-tdep.c: Include "gdb_assert.h". + (mn10300_read_fp): New function. + (mn10300_gdbarch_init): Set deprecated_target_read_fp to + mn10300_read_fp. Do not set read_sp to generic_target_read_sp. + * ia64-tdep.c: Include "gdb_assert.h". + (ia64_read_fp): New function. + (ia64_gdbarch_init): Set deprecated_target_read_fp to + ia64_read_sp. Do not set read_sp to generic_target_read_sp. + * regcache.c (generic_target_read_sp): Delete function. + (read_sp): Try TARGET_READ_SP and SP_REGNUM for the SP register. + * inferior.h (generic_target_read_sp): Delete declaration. + * frv-tdep.c (frv_gdbarch_init): Do not set read_sp to + generic_target_read_sp. + * m68hc11-tdep.c (m68hc11_gdbarch_init): Ditto. + * sparc-tdep.c (sparc_gdbarch_init): Ditto + * sh-tdep.c (sh_gdbarch_init): Ditto. + * rs6000-tdep.c (rs6000_gdbarch_init): Ditto. + * Makefile.in (mn10300-tdep.o, ia64-tdep.o): Update dependencies. + +2003-06-07 Andrew Cagney <cagney@redhat.com> + * gdbarch.sh: Comment each field of startup_gdbarch. * gdbarch.h, gdbarch.c: Re-generate. diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 823fa46..3ade36f 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -1844,7 +1844,7 @@ ia64-linux-nat.o: ia64-linux-nat.c $(defs_h) $(gdb_string_h) $(inferior_h) \ ia64-linux-tdep.o: ia64-linux-tdep.c $(defs_h) $(arch_utils_h) ia64-tdep.o: ia64-tdep.c $(defs_h) $(inferior_h) $(symfile_h) $(gdbcore_h) \ $(arch_utils_h) $(floatformat_h) $(regcache_h) $(doublest_h) \ - $(value_h) $(objfiles_h) $(elf_common_h) $(elf_bfd_h) + $(value_h) $(gdb_assert_h) $(objfiles_h) $(elf_common_h) $(elf_bfd_h) inf-loop.o: inf-loop.c $(defs_h) $(inferior_h) $(target_h) $(event_loop_h) \ $(event_top_h) $(inf_loop_h) $(remote_h) infcall.o: infcall.c $(defs_h) $(breakpoint_h) $(target_h) $(regcache_h) \ @@ -1998,9 +1998,9 @@ mipsv4-nat.o: mipsv4-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) $(target_h) \ mn10200-tdep.o: mn10200-tdep.c $(defs_h) $(frame_h) $(inferior_h) \ $(target_h) $(value_h) $(bfd_h) $(gdb_string_h) $(gdbcore_h) \ $(symfile_h) $(regcache_h) -mn10300-tdep.o: mn10300-tdep.c $(defs_h) $(frame_h) $(inferior_h) \ - $(target_h) $(value_h) $(bfd_h) $(gdb_string_h) $(gdbcore_h) \ - $(symfile_h) $(regcache_h) $(arch_utils_h) +mn10300-tdep.o: mn10300-tdep.c $(defs_h) $(frame_h) $(inferior_h) $(target_h) \ + $(value_h) $(bfd_h) $(gdb_string_h) $(gdbcore_h) $(symfile_h) \ + $(regcache_h) $(arch_utils_h) $(gdb_assert_h) monitor.o: monitor.c $(defs_h) $(gdbcore_h) $(target_h) $(gdb_string_h) \ $(command_h) $(serial_h) $(monitor_h) $(gdbcmd_h) $(inferior_h) \ $(gdb_regex_h) $(srec_h) $(regcache_h) diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c index 763be72..a2edfb3 100644 --- a/gdb/frv-tdep.c +++ b/gdb/frv-tdep.c @@ -1100,7 +1100,6 @@ frv_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_inner_than (gdbarch, core_addr_lessthan); set_gdbarch_write_pc (gdbarch, generic_target_write_pc); - set_gdbarch_read_sp (gdbarch, generic_target_read_sp); set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp); set_gdbarch_deprecated_pc_in_call_dummy (gdbarch, deprecated_pc_in_call_dummy_at_entry_point); diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 8f5c48f..eeea625 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -502,7 +502,6 @@ gdbarch_alloc (const struct gdbarch_info *info, current_gdbarch->bfd_vma_bit = TARGET_ARCHITECTURE->bits_per_address; current_gdbarch->char_signed = -1; current_gdbarch->write_pc = generic_target_write_pc; - current_gdbarch->read_sp = generic_target_read_sp; current_gdbarch->virtual_frame_pointer = legacy_virtual_frame_pointer; current_gdbarch->num_regs = -1; current_gdbarch->sp_regnum = -1; @@ -622,7 +621,7 @@ verify_gdbarch (struct gdbarch *gdbarch) /* Skip verify of read_pc, has predicate */ /* Skip verify of write_pc, invalid_p == 0 */ /* Skip verify of deprecated_target_read_fp, has predicate */ - /* Skip verify of read_sp, invalid_p == 0 */ + /* Skip verify of read_sp, has predicate */ /* Skip verify of deprecated_dummy_write_sp, has predicate */ /* Skip verify of virtual_frame_pointer, invalid_p == 0 */ /* Skip verify of pseudo_register_read, has predicate */ @@ -2565,6 +2564,15 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) current_gdbarch->read_pc /*TARGET_READ_PC ()*/); #endif +#ifdef TARGET_READ_SP_P + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "TARGET_READ_SP_P()", + XSTRING (TARGET_READ_SP_P ())); + fprintf_unfiltered (file, + "gdbarch_dump: TARGET_READ_SP_P() = %d\n", + TARGET_READ_SP_P ()); +#endif #ifdef TARGET_READ_SP fprintf_unfiltered (file, "gdbarch_dump: %s # %s\n", @@ -2955,6 +2963,13 @@ set_gdbarch_deprecated_target_read_fp (struct gdbarch *gdbarch, gdbarch->deprecated_target_read_fp = deprecated_target_read_fp; } +int +gdbarch_read_sp_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->read_sp != 0; +} + CORE_ADDR gdbarch_read_sp (struct gdbarch *gdbarch) { diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index db40c66..092f487 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -371,9 +371,29 @@ extern void set_gdbarch_deprecated_target_read_fp (struct gdbarch *gdbarch, gdba #define DEPRECATED_TARGET_READ_FP() (gdbarch_deprecated_target_read_fp (current_gdbarch)) #endif +#if defined (TARGET_READ_SP) +/* Legacy for systems yet to multi-arch TARGET_READ_SP */ +#if !defined (TARGET_READ_SP_P) +#define TARGET_READ_SP_P() (1) +#endif +#endif + +/* Default predicate for non- multi-arch targets. */ +#if (!GDB_MULTI_ARCH) && !defined (TARGET_READ_SP_P) +#define TARGET_READ_SP_P() (0) +#endif + +extern int gdbarch_read_sp_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (TARGET_READ_SP_P) +#error "Non multi-arch definition of TARGET_READ_SP" +#endif +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (TARGET_READ_SP_P) +#define TARGET_READ_SP_P() (gdbarch_read_sp_p (current_gdbarch)) +#endif + /* Default (function) for non- multi-arch platforms. */ #if (!GDB_MULTI_ARCH) && !defined (TARGET_READ_SP) -#define TARGET_READ_SP() (generic_target_read_sp ()) +#define TARGET_READ_SP() (internal_error (__FILE__, __LINE__, "TARGET_READ_SP"), 0) #endif typedef CORE_ADDR (gdbarch_read_sp_ftype) (void); diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 0bb7144..3f2bbee 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -431,7 +431,7 @@ f:2:TARGET_WRITE_PC:void:write_pc:CORE_ADDR val, ptid_t ptid:val, ptid::0:generi # This is simply not needed. See value_of_builtin_frame_fp_reg and # call_function_by_hand. F::DEPRECATED_TARGET_READ_FP:CORE_ADDR:deprecated_target_read_fp:void -f:2:TARGET_READ_SP:CORE_ADDR:read_sp:void:::0:generic_target_read_sp::0 +F:2:TARGET_READ_SP:CORE_ADDR:read_sp:void # The dummy call frame SP should be set by push_dummy_call. F:2:DEPRECATED_DUMMY_WRITE_SP:void:deprecated_dummy_write_sp:CORE_ADDR val:val # Function for getting target's idea of a frame pointer. FIXME: GDB's diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c index 4697574..89d623f 100644 --- a/gdb/ia64-tdep.c +++ b/gdb/ia64-tdep.c @@ -28,7 +28,7 @@ #include "regcache.h" #include "doublest.h" #include "value.h" - +#include "gdb_assert.h" #include "objfiles.h" #include "elf/common.h" /* for DT_PLTGOT value */ #include "elf-bfd.h" @@ -623,6 +623,18 @@ ia64_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr) return breakpoint; } +static CORE_ADDR +ia64_read_fp (void) +{ + /* We won't necessarily have a frame pointer and even if we do, it + winds up being extraordinarly messy when attempting to find the + frame chain. So for the purposes of creating frames (which is + all deprecated_read_fp() is used for), simply use the stack + pointer value instead. */ + gdb_assert (SP_REGNUM >= 0); + return read_register (SP_REGNUM); +} + CORE_ADDR ia64_read_pc (ptid_t ptid) { @@ -2296,12 +2308,11 @@ ia64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) frame chain. So for the purposes of creating frames (which is all deprecated_read_fp() is used for), simply use the stack pointer value instead. */ - set_gdbarch_deprecated_target_read_fp (gdbarch, generic_target_read_sp); + set_gdbarch_deprecated_target_read_fp (gdbarch, ia64_read_fp); /* Settings that should be unnecessary. */ set_gdbarch_inner_than (gdbarch, core_addr_lessthan); - set_gdbarch_read_sp (gdbarch, generic_target_read_sp); set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp); set_gdbarch_decr_pc_after_break (gdbarch, 0); diff --git a/gdb/inferior.h b/gdb/inferior.h index 4f3db64..df85cc3 100644 --- a/gdb/inferior.h +++ b/gdb/inferior.h @@ -176,8 +176,6 @@ extern void generic_target_write_pc (CORE_ADDR, ptid_t); extern CORE_ADDR read_sp (void); -extern CORE_ADDR generic_target_read_sp (void); - extern void generic_target_write_sp (CORE_ADDR); extern CORE_ADDR deprecated_read_fp (void); diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c index 133ef05..fbeb5e7 100644 --- a/gdb/m68hc11-tdep.c +++ b/gdb/m68hc11-tdep.c @@ -1366,7 +1366,6 @@ m68hc11_gdbarch_init (struct gdbarch_info info, set_gdbarch_frame_args_skip (gdbarch, 0); set_gdbarch_write_pc (gdbarch, generic_target_write_pc); - set_gdbarch_read_sp (gdbarch, generic_target_read_sp); set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp); set_gdbarch_sp_regnum (gdbarch, HARD_SP_REGNUM); diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c index 76f0245..dbb1a6b 100644 --- a/gdb/mn10300-tdep.c +++ b/gdb/mn10300-tdep.c @@ -31,6 +31,7 @@ #include "symfile.h" #include "regcache.h" #include "arch-utils.h" +#include "gdb_assert.h" #define D0_REGNUM 0 #define D2_REGNUM 2 @@ -1091,6 +1092,14 @@ mn10300_do_registers_info (int regnum, int fpregs) } } +static CORE_ADDR +mn10300_read_fp (void) +{ + /* That's right, we're using the stack pointer as our frame pointer. */ + gdb_assert (SP_REGNUM >= 0); + return read_register (SP_REGNUM); +} + /* Dump out the mn10300 speciic architecture information. */ static void @@ -1184,7 +1193,7 @@ mn10300_gdbarch_init (struct gdbarch_info info, set_gdbarch_frame_args_skip (gdbarch, 0); set_gdbarch_frame_num_args (gdbarch, frame_num_args_unknown); /* That's right, we're using the stack pointer as our frame pointer. */ - set_gdbarch_deprecated_target_read_fp (gdbarch, generic_target_read_sp); + set_gdbarch_deprecated_target_read_fp (gdbarch, mn10300_read_fp); /* Calling functions in the inferior from GDB. */ set_gdbarch_deprecated_call_dummy_words (gdbarch, mn10300_call_dummy_words); diff --git a/gdb/regcache.c b/gdb/regcache.c index 6493fbb..2d3c987 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -1273,9 +1273,6 @@ regcache_collect (int regnum, void *buf) they will use the contextual information provided by the FRAME. These functions do not belong in the register cache. */ -/* NOTE: cagney/2003-06-07: The function generic_target_read_sp() - should be deleted. */ - /* NOTE: cagney/2003-06-07: The function generic_target_write_sp() should be deleted. */ @@ -1353,20 +1350,14 @@ write_pc (CORE_ADDR pc) /* Cope with strage ways of getting to the stack and frame pointers */ CORE_ADDR -generic_target_read_sp (void) -{ -#ifdef SP_REGNUM - if (SP_REGNUM >= 0) - return read_register (SP_REGNUM); -#endif - internal_error (__FILE__, __LINE__, - "generic_target_read_sp"); -} - -CORE_ADDR read_sp (void) { - return TARGET_READ_SP (); + if (TARGET_READ_SP_P ()) + return TARGET_READ_SP (); + /* Else return SP from get_current_frame. */ + else if (SP_REGNUM >= 0) + return read_register (SP_REGNUM); + internal_error (__FILE__, __LINE__, "read_sp: Unable to find SP"); } void diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 03946d3..719d575 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -2911,7 +2911,6 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_print_insn (gdbarch, gdb_print_insn_powerpc); set_gdbarch_write_pc (gdbarch, generic_target_write_pc); - set_gdbarch_read_sp (gdbarch, generic_target_read_sp); set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp); set_gdbarch_num_regs (gdbarch, v->nregs); diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c index af23ffb..ad036b5 100644 --- a/gdb/sh-tdep.c +++ b/gdb/sh-tdep.c @@ -4638,7 +4638,6 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) } set_gdbarch_write_pc (gdbarch, generic_target_write_pc); - set_gdbarch_read_sp (gdbarch, generic_target_read_sp); set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp); set_gdbarch_register_name (gdbarch, sh_register_name); diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c index 4b7279c..8462a18 100644 --- a/gdb/sparc-tdep.c +++ b/gdb/sparc-tdep.c @@ -3423,7 +3423,6 @@ sparc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_pc_regnum (gdbarch, SPARC32_PC_REGNUM); set_gdbarch_ptr_bit (gdbarch, 4 * TARGET_CHAR_BIT); set_gdbarch_deprecated_push_arguments (gdbarch, sparc32_push_arguments); - set_gdbarch_read_sp (gdbarch, generic_target_read_sp); set_gdbarch_register_byte (gdbarch, sparc32_register_byte); set_gdbarch_register_raw_size (gdbarch, sparc32_register_size); |