diff options
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/remote-sim.c | 33 | ||||
-rw-r--r-- | include/gdb/ChangeLog | 9 | ||||
-rw-r--r-- | include/gdb/remote-sim.h | 18 | ||||
-rw-r--r-- | sim/common/ChangeLog | 13 | ||||
-rw-r--r-- | sim/common/Make-common.in | 6 | ||||
-rw-r--r-- | sim/common/sim-base.h | 11 | ||||
-rw-r--r-- | sim/common/sim-break.c | 278 | ||||
-rw-r--r-- | sim/common/sim-break.h | 38 | ||||
-rw-r--r-- | sim/common/sim-module.c | 7 |
10 files changed, 35 insertions, 384 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index c1a8533..0857a2f 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,11 @@ 2003-02-20 Andrew Cagney <ac131313@redhat.com> + * remote-sim.c (gdbsim_insert_breakpoint) + (gdbsim_remove_breakpoint): Delete #ifdef SIM_HAS_BREAKPOINTS + code. + +2003-02-20 Andrew Cagney <ac131313@redhat.com> + * remote.c (_initialize_remote): Add commands "set/show remote hardware-watchpoint-limit" and "set/show remote hardware-breakpoint-limit". diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c index cc21649..f934bd4 100644 --- a/gdb/remote-sim.c +++ b/gdb/remote-sim.c @@ -814,46 +814,13 @@ gdbsim_mourn_inferior (void) static int gdbsim_insert_breakpoint (CORE_ADDR addr, char *contents_cache) { -#ifdef SIM_HAS_BREAKPOINTS - SIM_RC retcode; - - retcode = sim_set_breakpoint (gdbsim_desc, addr); - - switch (retcode) - { - case SIM_RC_OK: - return 0; - case SIM_RC_INSUFFICIENT_RESOURCES: - return ENOMEM; - default: - return EIO; - } -#else return memory_insert_breakpoint (addr, contents_cache); -#endif } static int gdbsim_remove_breakpoint (CORE_ADDR addr, char *contents_cache) { -#ifdef SIM_HAS_BREAKPOINTS - SIM_RC retcode; - - retcode = sim_clear_breakpoint (gdbsim_desc, addr); - - switch (retcode) - { - case SIM_RC_OK: - case SIM_RC_UNKNOWN_BREAKPOINT: - return 0; - case SIM_RC_INSUFFICIENT_RESOURCES: - return ENOMEM; - default: - return EIO; - } -#else return memory_remove_breakpoint (addr, contents_cache); -#endif } /* Pass the command argument through to the simulator verbatim. The diff --git a/include/gdb/ChangeLog b/include/gdb/ChangeLog index b36341d..1cb37d7 100644 --- a/include/gdb/ChangeLog +++ b/include/gdb/ChangeLog @@ -1,3 +1,12 @@ +2003-02-20 Andrew Cagney <ac131313@redhat.com> + + * remote-sim.h (SIM_RC): Delete unused SIM_RC_UNKNOWN_BREAKPOINT, + SIM_RC_INSUFFICIENT_RESOURCES and SIM_RC_DUPLICATE_BREAKPOINT. + (sim_set_breakpoint, sim_clear_breakpoint): Delete declarations. + (sim_clear_all_breakpoints, sim_enable_breakpoint): Ditto. + (sim_enable_all_breakpoints, sim_disable_breakpoint): Ditto. + (sim_disable_all_breakpoints): Ditto. + 2002-12-26 Kazu Hirata <kazu@cs.umass.edu> * sim-h8300.h: Remove ^M. diff --git a/include/gdb/remote-sim.h b/include/gdb/remote-sim.h index 14d90b4..c6acabd 100644 --- a/include/gdb/remote-sim.h +++ b/include/gdb/remote-sim.h @@ -58,10 +58,7 @@ typedef enum { typedef enum { SIM_RC_FAIL = 0, - SIM_RC_OK = 1, - SIM_RC_UNKNOWN_BREAKPOINT = 2, - SIM_RC_INSUFFICIENT_RESOURCES = 3, - SIM_RC_DUPLICATE_BREAKPOINT = 4 + SIM_RC_OK = 1 } SIM_RC; @@ -278,19 +275,6 @@ void sim_stop_reason PARAMS ((SIM_DESC sd, enum sim_stop *reason, int *sigrc)); void sim_do_command PARAMS ((SIM_DESC sd, char *cmd)); -/* Call these functions to set and clear breakpoints at ADDR. */ - -SIM_RC sim_set_breakpoint PARAMS ((SIM_DESC sd, SIM_ADDR addr)); -SIM_RC sim_clear_breakpoint PARAMS ((SIM_DESC sd, SIM_ADDR addr)); -SIM_RC sim_clear_all_breakpoints PARAMS ((SIM_DESC sd)); - -/* These functions are used to enable and disable breakpoints. */ - -SIM_RC sim_enable_breakpoint PARAMS ((SIM_DESC sd, SIM_ADDR addr)); -SIM_RC sim_disable_breakpoint PARAMS ((SIM_DESC sd, SIM_ADDR addr)); -SIM_RC sim_enable_all_breakpoints PARAMS ((SIM_DESC sd)); -SIM_RC sim_disable_all_breakpoints PARAMS ((SIM_DESC sd)); - #ifdef __cplusplus } #endif diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog index 46a2cc8..2d5f7b8 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,3 +1,16 @@ +2003-02-20 Andrew Cagney <ac131313@redhat.com> + + * Make-common.in (SIM_NEW_COMMON_OBJS): Remove sim-break.o + (sim-break_h): Delete macro. + (sim-break.o): Delete rule. + * sim-break.c: Delete file. + * sim-break.h: Delete file. + * sim-base.h [SIM_HAVE_BREAKPOINTS]: Don't include "sim-break.h". + (STATE_BREAKPOINTS): Delete macro. + (sim_state_base): Delete field breakpoints. + * sim-module.c (modules) [SIM_HAVE_BREAKPOINTS]: Don't add + sim_break_install to array. + 2003-01-08 Kazu Hirata <kazu@cs.umass.edu> * run.c (usage): Fix typos. diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in index e3e1239..9e2c7c4 100644 --- a/sim/common/Make-common.in +++ b/sim/common/Make-common.in @@ -161,7 +161,6 @@ SIM_COMMON_HW_OBJS = \ SIM_NEW_COMMON_OBJS = \ sim-arange.o \ sim-bits.o \ - sim-break.o \ sim-config.o \ sim-core.o \ sim-endian.o \ @@ -335,7 +334,6 @@ sim-events_h = $(srccom)/sim-events.h sim-fpu_h = $(srccom)/sim-fpu.h sim-io_h = $(srccom)/sim-io.h sim-options_h = $(srccom)/sim-options.h -sim-break_h = $(srccom)/sim-break.h sim-signal_h = $(srccom)/sim-signal.h hw-alloc_h = $(srccom)/hw-alloc.h @@ -477,10 +475,6 @@ sim-watch.o: $(srccom)/sim-watch.c $(sim_main_headers) sim-load.o: $(srccom)/sim-load.c $(callback_h) $(CC) -c $(srccom)/sim-load.c $(ALL_CFLAGS) -sim-break.o: $(srccom)/sim-break.c $(sim_main_headers) \ - $(sim_break_h) - $(CC) -c $(srccom)/sim-break.c $(ALL_CFLAGS) - # FIXME This is one very simple-minded way of generating the file hw-config.h hw-config.h: Makefile.in $(srccom)/Make-common.in config.status Makefile diff --git a/sim/common/sim-base.h b/sim/common/sim-base.h index 420b137..1fbd9b2 100644 --- a/sim/common/sim-base.h +++ b/sim/common/sim-base.h @@ -1,5 +1,7 @@ /* Simulator pseudo baseclass. - Copyright (C) 1997-1998 Free Software Foundation, Inc. + + Copyright 1997, 1998, 2003 Free Software Foundation, Inc. + Contributed by Cygnus Support. This file is part of GDB, the GNU debugger. @@ -90,9 +92,6 @@ typedef struct _sim_cpu sim_cpu; #include "sim-engine.h" #include "sim-watch.h" #include "sim-memopt.h" -#ifdef SIM_HAVE_BREAKPOINTS -#include "sim-break.h" -#endif #include "sim-cpu.h" /* Global pointer to current state while sim_resume is running. @@ -227,10 +226,6 @@ typedef struct { sim_watchpoints watchpoints; #define STATE_WATCHPOINTS(sd) (&(sd)->base.watchpoints) - /* Pointer to list of breakpoints */ - struct sim_breakpoint *breakpoints; -#define STATE_BREAKPOINTS(sd) ((sd)->base.breakpoints) - #if WITH_HW struct sim_hw *hw; #define STATE_HW(sd) ((sd)->base.hw) diff --git a/sim/common/sim-break.c b/sim/common/sim-break.c deleted file mode 100644 index 3b89560..0000000 --- a/sim/common/sim-break.c +++ /dev/null @@ -1,278 +0,0 @@ -/* Simulator breakpoint support. - Copyright (C) 1997 Free Software Foundation, Inc. - Contributed by Cygnus Support. - -This file is part of GDB, the GNU debugger. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program; if not, write to the Free Software Foundation, Inc., -59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#include <stdio.h> - -#include "sim-main.h" -#include "sim-assert.h" -#include "sim-break.h" - -#ifndef SIM_BREAKPOINT -#define SIM_BREAKPOINT {0x00} -#define SIM_BREAKPOINT_SIZE (1) -#endif - -struct -sim_breakpoint -{ - struct sim_breakpoint *next; - SIM_ADDR addr; /* Address of this breakpoint */ - int flags; - unsigned char loc_contents[SIM_BREAKPOINT_SIZE]; /* Contents of addr while - BP is enabled */ -}; - -#define SIM_BREAK_INSERTED 0x1 /* Breakpoint has been inserted */ -#define SIM_BREAK_DISABLED 0x2 /* Breakpoint is disabled */ - -static unsigned char sim_breakpoint [] = SIM_BREAKPOINT; - -static void insert_breakpoint PARAMS ((SIM_DESC sd, - struct sim_breakpoint *bp)); -static void remove_breakpoint PARAMS ((SIM_DESC sd, - struct sim_breakpoint *bp)); -static SIM_RC resume_handler PARAMS ((SIM_DESC sd)); -static SIM_RC suspend_handler PARAMS ((SIM_DESC sd)); - - -/* Do the actual work of inserting a breakpoint into the instruction - stream. */ - -static void -insert_breakpoint (sd, bp) - SIM_DESC sd; - struct sim_breakpoint *bp; -{ - if (bp->flags & (SIM_BREAK_INSERTED | SIM_BREAK_DISABLED)) - return; - - sim_core_read_buffer (sd, NULL, exec_map, bp->loc_contents, - bp->addr, SIM_BREAKPOINT_SIZE); - sim_core_write_buffer (sd, NULL, exec_map, sim_breakpoint, - bp->addr, SIM_BREAKPOINT_SIZE); - bp->flags |= SIM_BREAK_INSERTED; -} - -/* Do the actual work of removing a breakpoint. */ - -static void -remove_breakpoint (sd, bp) - SIM_DESC sd; - struct sim_breakpoint *bp; -{ - if (!(bp->flags & SIM_BREAK_INSERTED)) - return; - - sim_core_write_buffer (sd, NULL, exec_map, bp->loc_contents, - bp->addr, SIM_BREAKPOINT_SIZE); - bp->flags &= ~SIM_BREAK_INSERTED; -} - -/* Come here when a breakpoint insn is hit. If it's really a breakpoint, we - halt things, and never return. If it's a false hit, we return to let the - caller handle things. */ - -void -sim_handle_breakpoint (sd, cpu, cia) - SIM_DESC sd; - sim_cpu *cpu; - sim_cia cia; -{ - struct sim_breakpoint *bp; - - for (bp = STATE_BREAKPOINTS (sd); bp; bp = bp->next) - if (bp->addr == CIA_ADDR (cia)) - break; - - if (!bp || !(bp->flags & SIM_BREAK_INSERTED)) - return; - - sim_engine_halt (sd, STATE_CPU (sd, 0), NULL, cia, sim_stopped, SIM_SIGTRAP); -} - -/* Handler functions for simulator resume and suspend events. */ - -static SIM_RC -resume_handler (sd) - SIM_DESC sd; -{ - struct sim_breakpoint *bp; - - for (bp = STATE_BREAKPOINTS (sd); bp; bp = bp->next) - insert_breakpoint (sd, bp); - - return SIM_RC_OK; -} - -static SIM_RC -suspend_handler (sd) - SIM_DESC sd; -{ - struct sim_breakpoint *bp; - - for (bp = STATE_BREAKPOINTS (sd); bp; bp = bp->next) - remove_breakpoint (sd, bp); - - return SIM_RC_OK; -} - -/* Called from simulator module initialization. */ - -SIM_RC -sim_break_install (sd) - SIM_DESC sd; -{ - sim_module_add_resume_fn (sd, resume_handler); - sim_module_add_suspend_fn (sd, suspend_handler); - - return SIM_RC_OK; -} - -/* Install a breakpoint. This is a user-function. The breakpoint isn't - actually installed here. We just record it. Resume_handler does the - actual work. -*/ - -SIM_RC -sim_set_breakpoint (sd, addr) - SIM_DESC sd; - SIM_ADDR addr; -{ - struct sim_breakpoint *bp; - - for (bp = STATE_BREAKPOINTS (sd); bp; bp = bp->next) - if (bp->addr == addr) - return SIM_RC_DUPLICATE_BREAKPOINT; /* Already there */ - else - break; /* FIXME: why not scan all bp's? */ - - bp = ZALLOC (struct sim_breakpoint); - - bp->addr = addr; - bp->next = STATE_BREAKPOINTS (sd); - bp->flags = 0; - STATE_BREAKPOINTS (sd) = bp; - - return SIM_RC_OK; -} - -/* Delete a breakpoint. All knowlege of the breakpoint is removed from the - simulator. -*/ - -SIM_RC -sim_clear_breakpoint (sd, addr) - SIM_DESC sd; - SIM_ADDR addr; -{ - struct sim_breakpoint *bp, *bpprev; - - for (bp = STATE_BREAKPOINTS (sd), bpprev = NULL; - bp; - bpprev = bp, bp = bp->next) - if (bp->addr == addr) - break; - - if (!bp) - return SIM_RC_UNKNOWN_BREAKPOINT; - - remove_breakpoint (sd, bp); - - if (bpprev) - bpprev->next = bp->next; - else - STATE_BREAKPOINTS (sd) = NULL; - - zfree (bp); - - return SIM_RC_OK; -} - -SIM_RC -sim_clear_all_breakpoints (sd) - SIM_DESC sd; -{ - while (STATE_BREAKPOINTS (sd)) - sim_clear_breakpoint (sd, STATE_BREAKPOINTS (sd)->addr); - - return SIM_RC_OK; -} - -SIM_RC -sim_enable_breakpoint (sd, addr) - SIM_DESC sd; - SIM_ADDR addr; -{ - struct sim_breakpoint *bp; - - for (bp = STATE_BREAKPOINTS (sd); bp; bp = bp->next) - if (bp->addr == addr) - break; - - if (!bp) - return SIM_RC_UNKNOWN_BREAKPOINT; - - bp->flags &= ~SIM_BREAK_DISABLED; - - return SIM_RC_OK; -} - -SIM_RC -sim_disable_breakpoint (sd, addr) - SIM_DESC sd; - SIM_ADDR addr; -{ - struct sim_breakpoint *bp; - - for (bp = STATE_BREAKPOINTS (sd); bp; bp = bp->next) - if (bp->addr == addr) - break; - - if (!bp) - return SIM_RC_UNKNOWN_BREAKPOINT; - - bp->flags |= SIM_BREAK_DISABLED; - - return SIM_RC_OK; -} - -SIM_RC -sim_enable_all_breakpoints (sd) - SIM_DESC sd; -{ - struct sim_breakpoint *bp; - - for (bp = STATE_BREAKPOINTS (sd); bp; bp = bp->next) - bp->flags &= ~SIM_BREAK_DISABLED; - - return SIM_RC_OK; -} - -SIM_RC -sim_disable_all_breakpoints (sd) - SIM_DESC sd; -{ - struct sim_breakpoint *bp; - - for (bp = STATE_BREAKPOINTS (sd); bp; bp = bp->next) - bp->flags |= SIM_BREAK_DISABLED; - - return SIM_RC_OK; -} diff --git a/sim/common/sim-break.h b/sim/common/sim-break.h deleted file mode 100644 index 8b0338f..0000000 --- a/sim/common/sim-break.h +++ /dev/null @@ -1,38 +0,0 @@ -/* Simulator breakpoint support. - Copyright (C) 1997 Free Software Foundation, Inc. - Contributed by Cygnus Support. - -This file is part of GDB, the GNU debugger. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program; if not, write to the Free Software Foundation, Inc., -59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - - -#ifndef SIM_BREAK_H -#define SIM_BREAK_H - -/* Call this to install the resume and suspend handlers for the breakpoint - module. */ - -MODULE_INSTALL_FN sim_break_install; - -/* Call this inside the simulator when we execute the potential - breakpoint insn. If the breakpoint system knows about it, the - breakpoint is handled, and this routine never returns. If this - isn't really a breakpoint, then it returns to allow the caller to - handle things. */ - -void sim_handle_breakpoint PARAMS ((SIM_DESC sd, sim_cpu *cpu, sim_cia cia)); - -#endif /* SIM_BREAK_H */ diff --git a/sim/common/sim-module.c b/sim/common/sim-module.c index 35eb32a..8f01723 100644 --- a/sim/common/sim-module.c +++ b/sim/common/sim-module.c @@ -1,5 +1,7 @@ /* Module support. - Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. + + Copyright 1996, 1997, 1998, 2003 Free Software Foundation, Inc. + Contributed by Cygnus Support. This file is part of GDB, the GNU debugger. @@ -56,9 +58,6 @@ static MODULE_INSTALL_FN * const modules[] = { #if WITH_SCACHE scache_install, #endif -#ifdef SIM_HAVE_BREAKPOINTS - sim_break_install, -#endif #if WITH_HW sim_hw_install, #endif |