From 64c4637f9265ae06f5f88887afe243ac33392992 Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Sat, 24 Mar 2001 02:07:49 +0000 Subject: [PATCH] * config/sparc/tm-sp64.h (GDB_MULTI_ARCH): Down grade to GDB_MULTI_ARCH_PARTIAL from two. SOFTWARE_SINGLE_STEP is not multi-arch. * gdbarch.sh (SOFTWARE_SINGLE_STEP): Add. * gdbarch.h, gdbarch.c: Re-generate. * target.h (SOFTWARE_SINGLE_STEP_P) (SOFTWARE_SINGLE_STEP): Delete macro definitions. --- gdb/ChangeLog | 12 ++++++++++++ gdb/config/sparc/tm-sp64.h | 2 +- gdb/gdbarch.c | 41 +++++++++++++++++++++++++++++++++++++++++ gdb/gdbarch.h | 40 ++++++++++++++++++++++++++++++++++++++++ gdb/gdbarch.sh | 9 +++++++++ gdb/target.h | 6 ------ 6 files changed, 103 insertions(+), 7 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 8ab4e59..3dfb65e 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,17 @@ 2001-03-23 Andrew Cagney + * config/sparc/tm-sp64.h (GDB_MULTI_ARCH): Down grade to + GDB_MULTI_ARCH_PARTIAL from two. SOFTWARE_SINGLE_STEP is not + multi-arch. + + * gdbarch.sh (SOFTWARE_SINGLE_STEP): Add. + * gdbarch.h, gdbarch.c: Re-generate. + + * target.h (SOFTWARE_SINGLE_STEP_P) + (SOFTWARE_SINGLE_STEP): Delete macro definitions. + +2001-03-23 Andrew Cagney + * gdbarch.sh (gdbarch_register_read, gdbarch_register_write): Add. * gdbarch.h, gdbarch.c: Regenerate. diff --git a/gdb/config/sparc/tm-sp64.h b/gdb/config/sparc/tm-sp64.h index c5fc7df..423b7ec 100644 --- a/gdb/config/sparc/tm-sp64.h +++ b/gdb/config/sparc/tm-sp64.h @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#define GDB_MULTI_ARCH 2 +#define GDB_MULTI_ARCH GDB_MULTI_ARCH_PARTIAL #ifndef GDB_TARGET_IS_SPARC64 #define GDB_TARGET_IS_SPARC64 1 diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 8145d99..5735315 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -246,6 +246,7 @@ struct gdbarch const struct floatformat * double_format; const struct floatformat * long_double_format; gdbarch_convert_from_func_ptr_addr_ftype *convert_from_func_ptr_addr; + gdbarch_software_single_step_ftype *software_single_step; }; @@ -378,6 +379,7 @@ struct gdbarch startup_gdbarch = 0, 0, 0, + 0, /* startup_gdbarch() */ }; @@ -757,6 +759,7 @@ verify_gdbarch (struct gdbarch *gdbarch) if (gdbarch->long_double_format == 0) gdbarch->long_double_format = &floatformat_unknown; /* Skip verify of convert_from_func_ptr_addr, invalid_p == 0 */ + /* Skip verify of software_single_step, has predicate */ } @@ -1432,6 +1435,13 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "CONVERT_FROM_FUNC_PTR_ADDR(addr)", XSTRING (CONVERT_FROM_FUNC_PTR_ADDR (addr))); #endif +#if defined (SOFTWARE_SINGLE_STEP) && GDB_MULTI_ARCH + /* Macro might contain `[{}]' when not multi-arch */ + fprintf_unfiltered (file, + "gdbarch_dump: %s # %s\n", + "SOFTWARE_SINGLE_STEP(sig, insert_breakpoints_p)", + XSTRING (SOFTWARE_SINGLE_STEP (sig, insert_breakpoints_p))); +#endif #ifdef TARGET_ARCHITECTURE if (TARGET_ARCHITECTURE != NULL) fprintf_unfiltered (file, @@ -2150,6 +2160,13 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) current_gdbarch->convert_from_func_ptr_addr /*CONVERT_FROM_FUNC_PTR_ADDR ()*/); #endif +#ifdef SOFTWARE_SINGLE_STEP + if (GDB_MULTI_ARCH) + fprintf_unfiltered (file, + "gdbarch_dump: SOFTWARE_SINGLE_STEP = 0x%08lx\n", + (long) current_gdbarch->software_single_step + /*SOFTWARE_SINGLE_STEP ()*/); +#endif if (current_gdbarch->dump_tdep != NULL) current_gdbarch->dump_tdep (current_gdbarch, file); } @@ -4215,6 +4232,30 @@ set_gdbarch_convert_from_func_ptr_addr (struct gdbarch *gdbarch, gdbarch->convert_from_func_ptr_addr = convert_from_func_ptr_addr; } +int +gdbarch_software_single_step_p (struct gdbarch *gdbarch) +{ + return gdbarch->software_single_step != 0; +} + +void +gdbarch_software_single_step (struct gdbarch *gdbarch, enum target_signal sig, int insert_breakpoints_p) +{ + if (gdbarch->software_single_step == 0) + internal_error (__FILE__, __LINE__, + "gdbarch: gdbarch_software_single_step invalid"); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_software_single_step called\n"); + gdbarch->software_single_step (sig, insert_breakpoints_p); +} + +void +set_gdbarch_software_single_step (struct gdbarch *gdbarch, + gdbarch_software_single_step_ftype software_single_step) +{ + gdbarch->software_single_step = software_single_step; +} + /* Keep a registry of per-architecture data-pointers required by GDB modules. */ diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index a9f0e15..34891a4 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -1489,6 +1489,46 @@ extern void set_gdbarch_convert_from_func_ptr_addr (struct gdbarch *gdbarch, gdb #endif #endif +/* FIXME/cagney/2001-01-18: This should be split in two. A target method that indicates if + the target needs software single step. An ISA method to implement it. + + FIXME/cagney/2001-01-18: This should be replaced with something that inserts breakpoints + using the breakpoint system instead of blatting memory directly (as with rs6000). + + FIXME/cagney/2001-01-18: The logic is backwards. It should be asking if the target can + single step. If not, then implement single step using breakpoints. */ + +#if defined (SOFTWARE_SINGLE_STEP) +/* Legacy for systems yet to multi-arch SOFTWARE_SINGLE_STEP */ +#if !defined (SOFTWARE_SINGLE_STEP_P) +#define SOFTWARE_SINGLE_STEP_P() (1) +#endif +#endif + +/* Default predicate for non- multi-arch targets. */ +#if (!GDB_MULTI_ARCH) && !defined (SOFTWARE_SINGLE_STEP_P) +#define SOFTWARE_SINGLE_STEP_P() (0) +#endif + +extern int gdbarch_software_single_step_p (struct gdbarch *gdbarch); +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (SOFTWARE_SINGLE_STEP_P) +#define SOFTWARE_SINGLE_STEP_P() (gdbarch_software_single_step_p (current_gdbarch)) +#endif + +/* Default (function) for non- multi-arch platforms. */ +#if (!GDB_MULTI_ARCH) && !defined (SOFTWARE_SINGLE_STEP) +#define SOFTWARE_SINGLE_STEP(sig, insert_breakpoints_p) (internal_error (__FILE__, __LINE__, "SOFTWARE_SINGLE_STEP"), 0) +#endif + +typedef void (gdbarch_software_single_step_ftype) (enum target_signal sig, int insert_breakpoints_p); +extern void gdbarch_software_single_step (struct gdbarch *gdbarch, enum target_signal sig, int insert_breakpoints_p); +extern void set_gdbarch_software_single_step (struct gdbarch *gdbarch, gdbarch_software_single_step_ftype *software_single_step); +#if GDB_MULTI_ARCH +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (SOFTWARE_SINGLE_STEP) +#define SOFTWARE_SINGLE_STEP(sig, insert_breakpoints_p) (gdbarch_software_single_step (current_gdbarch, sig, insert_breakpoints_p)) +#endif +#endif + extern struct gdbarch_tdep *gdbarch_tdep (struct gdbarch *gdbarch); diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index ac6d3e9..991ea13 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -513,6 +513,15 @@ v:2:TARGET_FLOAT_FORMAT:const struct floatformat *:float_format::::::default_flo v:2:TARGET_DOUBLE_FORMAT:const struct floatformat *:double_format::::::default_double_format (gdbarch) v:2:TARGET_LONG_DOUBLE_FORMAT:const struct floatformat *:long_double_format::::::&floatformat_unknown f:2:CONVERT_FROM_FUNC_PTR_ADDR:CORE_ADDR:convert_from_func_ptr_addr:CORE_ADDR addr:addr:::default_convert_from_func_ptr_addr::0 +# FIXME/cagney/2001-01-18: This should be split in two. A target method that indicates if +# the target needs software single step. An ISA method to implement it. +# +# FIXME/cagney/2001-01-18: This should be replaced with something that inserts breakpoints +# using the breakpoint system instead of blatting memory directly (as with rs6000). +# +# FIXME/cagney/2001-01-18: The logic is backwards. It should be asking if the target can +# single step. If not, then implement single step using breakpoints. +F:2:SOFTWARE_SINGLE_STEP:void:software_single_step:enum target_signal sig, int insert_breakpoints_p:sig, insert_breakpoints_p::0:0 EOF } diff --git a/gdb/target.h b/gdb/target.h index fa80583..22c152f 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -1251,12 +1251,6 @@ extern void push_remote_target (char *name, int from_tty); /* Imported from machine dependent code */ -#ifndef SOFTWARE_SINGLE_STEP_P -#define SOFTWARE_SINGLE_STEP_P() 0 -#define SOFTWARE_SINGLE_STEP(sig,bp_p) \ - (internal_error (__FILE__, __LINE__, "SOFTWARE_SINGLE_STEP"), 0) -#endif /* SOFTWARE_SINGLE_STEP_P */ - /* Blank target vector entries are initialized to target_ignore. */ void target_ignore (void); -- 2.7.4