diff options
author | Grace Sainsbury <graces@redhat.com> | 2002-08-01 21:20:14 +0000 |
---|---|---|
committer | Grace Sainsbury <graces@redhat.com> | 2002-08-01 21:20:14 +0000 |
commit | ccaa32c7e8122cea2014dd13cffd8d495ab48bf0 (patch) | |
tree | d58334ca8743e92c49d39c3f7656f4f5bfb7a781 /gdb | |
parent | 9860559818f2a3fe6306660aa37e3e9bbf3cfe0b (diff) | |
download | gdb-ccaa32c7e8122cea2014dd13cffd8d495ab48bf0.zip gdb-ccaa32c7e8122cea2014dd13cffd8d495ab48bf0.tar.gz gdb-ccaa32c7e8122cea2014dd13cffd8d495ab48bf0.tar.bz2 |
* target.h: Add to_insert_hw_breakpoint, to_remove_hw_breakpoint,
to_insert_watchpoint, to_remove_watchpoint,
to_stopped_by_watchpoint, to_stopped_data_address,
to_region_size_ok_for_hw_watchpoint, to_can_use_hw_breakpoint to
target vecctor. Define their corresponding macros so they call
them.
* target.c: Add default and debug versions of for
to_insert_hw_breakpoint, to_remove_hw_breakpoint,
to_insert_watchpoint, to_remove_watchpoint,
to_stopped_by_watchpoint, to_stopped_data_address,
to_region_size_ok_for_hw_watchpoint, to_can_use_hw_breakpoint.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 16 | ||||
-rw-r--r-- | gdb/target.c | 181 | ||||
-rw-r--r-- | gdb/target.h | 42 |
3 files changed, 228 insertions, 11 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 14c000d..e604813 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,18 @@ +2002-08-01 Grace Sainsbury <graces@redhat.com> + + * target.h: Add to_insert_hw_breakpoint, to_remove_hw_breakpoint, + to_insert_watchpoint, to_remove_watchpoint, + to_stopped_by_watchpoint, to_stopped_data_address, + to_region_size_ok_for_hw_watchpoint, to_can_use_hw_breakpoint to + target vecctor. Define their corresponding macros so they call + them. + + * target.c: Add default and debug versions of for + to_insert_hw_breakpoint, to_remove_hw_breakpoint, + to_insert_watchpoint, to_remove_watchpoint, + to_stopped_by_watchpoint, to_stopped_data_address, + to_region_size_ok_for_hw_watchpoint, to_can_use_hw_breakpoint. + 2002-08-01 Kevin Buettner <kevinb@redhat.com> * mips-tdep.c (mips_register_virtual_type): New function. @@ -119,6 +134,7 @@ * configure.host (gdb_host): Set to aix432 on AIX 4.3.2+. * config/powerpc/aix432.mh: New file. +>>>>>>> 1.2978 2002-07-30 Daniel Jacobowitz <drow@mvista.com> * ppc-linux-tdep.c (ELF_NGREG, ELF_NFPREG, ELF_NVRREG) diff --git a/gdb/target.c b/gdb/target.c index 9d9819b..ec1979b 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -52,6 +52,8 @@ static void kill_or_be_killed (int); static void default_terminal_info (char *, int); +static int default_region_size_ok_for_hw_watchpoint (int); + static int nosymbol (char *, CORE_ADDR *); static void tcomplain (void); @@ -62,6 +64,8 @@ static int return_zero (void); static int return_one (void); +static int return_minus_one (void); + void target_ignore (void); static void target_command (char *, int); @@ -112,6 +116,22 @@ static int debug_to_insert_breakpoint (CORE_ADDR, char *); static int debug_to_remove_breakpoint (CORE_ADDR, char *); +static int debug_to_can_use_hw_breakpoint (int, int, int); + +static int debug_to_insert_hw_breakpoint (CORE_ADDR, char *); + +static int debug_to_remove_hw_breakpoint (CORE_ADDR, char *); + +static int debug_to_insert_watchpoint (CORE_ADDR, int, int); + +static int debug_to_remove_watchpoint (CORE_ADDR, int, int); + +static int debug_to_stopped_by_watchpoint (void); + +static CORE_ADDR debug_to_stopped_data_address (void); + +static int debug_to_region_size_ok_for_hw_watchpoint (int); + static void debug_to_terminal_init (void); static void debug_to_terminal_inferior (void); @@ -390,6 +410,29 @@ cleanup_target (struct target_ops *t) memory_insert_breakpoint); de_fault (to_remove_breakpoint, memory_remove_breakpoint); + de_fault (to_can_use_hw_breakpoint, + (int (*) (int, int, int)) + return_zero); + de_fault (to_insert_hw_breakpoint, + (int (*) (CORE_ADDR, char *)) + return_minus_one); + de_fault (to_remove_hw_breakpoint, + (int (*) (CORE_ADDR, char *)) + return_minus_one); + de_fault (to_insert_watchpoint, + (int (*) (CORE_ADDR, int, int)) + return_minus_one); + de_fault (to_remove_watchpoint, + (int (*) (CORE_ADDR, int, int)) + return_minus_one); + de_fault (to_stopped_by_watchpoint, + (int (*) (void)) + return_zero); + de_fault (to_stopped_data_address, + (CORE_ADDR (*) (void)) + return_zero); + de_fault (to_region_size_ok_for_hw_watchpoint, + default_region_size_ok_for_hw_watchpoint); de_fault (to_terminal_init, (void (*) (void)) target_ignore); @@ -553,6 +596,14 @@ update_current_target (void) INHERIT (to_files_info, t); INHERIT (to_insert_breakpoint, t); INHERIT (to_remove_breakpoint, t); + INHERIT (to_can_use_hw_breakpoint, t); + INHERIT (to_insert_hw_breakpoint, t); + INHERIT (to_remove_hw_breakpoint, t); + INHERIT (to_insert_watchpoint, t); + INHERIT (to_remove_watchpoint, t); + INHERIT (to_stopped_data_address, t); + INHERIT (to_stopped_by_watchpoint, t); + INHERIT (to_region_size_ok_for_hw_watchpoint, t); INHERIT (to_terminal_init, t); INHERIT (to_terminal_inferior, t); INHERIT (to_terminal_ours_for_output, t); @@ -1227,6 +1278,12 @@ find_default_clone_and_follow_inferior (int child_pid, int *followed_child) } static int +default_region_size_ok_for_hw_watchpoint (int byte_count) +{ + return (byte_count <= REGISTER_SIZE); +} + +static int return_zero (void) { return 0; @@ -1238,6 +1295,12 @@ return_one (void) return 1; } +static int +return_minus_one (void) +{ + return -1; +} + /* * Resize the to_sections pointer. Also make sure that anyone that * was holding on to an old value of it gets updated. @@ -1774,6 +1837,116 @@ debug_to_remove_breakpoint (CORE_ADDR addr, char *save) return retval; } +static int +debug_to_can_use_hw_breakpoint (int type, int cnt, int from_tty) +{ + int retval; + + retval = debug_target.to_can_use_hw_breakpoint (type, cnt, from_tty); + + fprintf_unfiltered (gdb_stdlog, + "target_can_use_hw_breakpoint (%ld, %ld, %ld) = %ld\n", + (unsigned long) type, + (unsigned long) cnt, + (unsigned long) from_tty, + (unsigned long) retval); + return retval; +} + +static int +debug_to_region_size_ok_for_hw_watchpoint (int byte_count) +{ + CORE_ADDR retval; + + retval = debug_target.to_region_size_ok_for_hw_watchpoint (byte_count); + + fprintf_unfiltered (gdb_stdlog, + "TARGET_REGION_SIZE_OK_FOR_HW_WATCHPOINT (%ld) = 0x%lx\n", + (unsigned long) byte_count, + (unsigned long) retval); + return retval; +} + +static int +debug_to_stopped_by_watchpoint (void) +{ + int retval; + + retval = debug_target.to_stopped_by_watchpoint (); + + fprintf_unfiltered (gdb_stdlog, + "STOPPED_BY_WATCHPOINT () = %ld\n", + (unsigned long) retval); + return retval; +} + +static CORE_ADDR +debug_to_stopped_data_address (void) +{ + CORE_ADDR retval; + + retval = debug_target.to_stopped_data_address (); + + fprintf_unfiltered (gdb_stdlog, + "target_stopped_data_address () = 0x%lx\n", + (unsigned long) retval); + return retval; +} + +static int +debug_to_insert_hw_breakpoint (CORE_ADDR addr, char *save) +{ + int retval; + + retval = debug_target.to_insert_hw_breakpoint (addr, save); + + fprintf_unfiltered (gdb_stdlog, + "target_insert_hw_breakpoint (0x%lx, xxx) = %ld\n", + (unsigned long) addr, + (unsigned long) retval); + return retval; +} + +static int +debug_to_remove_hw_breakpoint (CORE_ADDR addr, char *save) +{ + int retval; + + retval = debug_target.to_remove_hw_breakpoint (addr, save); + + fprintf_unfiltered (gdb_stdlog, + "target_remove_hw_breakpoint (0x%lx, xxx) = %ld\n", + (unsigned long) addr, + (unsigned long) retval); + return retval; +} + +static int +debug_to_insert_watchpoint (CORE_ADDR addr, int len, int type) +{ + int retval; + + retval = debug_target.to_insert_watchpoint (addr, len, type); + + fprintf_unfiltered (gdb_stdlog, + "target_insert_watchpoint (0x%lx, %d, %d) = %ld\n", + (unsigned long) addr, len, type, (unsigned long) retval); + return retval; +} + +static int +debug_to_remove_watchpoint (CORE_ADDR addr, int len, int type) +{ + int retval; + + retval = debug_target.to_insert_watchpoint (addr, len, type); + + fprintf_unfiltered (gdb_stdlog, + "target_insert_watchpoint (0x%lx, %d, %d) = %ld\n", + (unsigned long) addr, len, type, (unsigned long) retval); + return retval; +} + static void debug_to_terminal_init (void) { @@ -2220,6 +2393,14 @@ setup_target_debug (void) current_target.to_files_info = debug_to_files_info; current_target.to_insert_breakpoint = debug_to_insert_breakpoint; current_target.to_remove_breakpoint = debug_to_remove_breakpoint; + current_target.to_can_use_hw_breakpoint = debug_to_can_use_hw_breakpoint; + current_target.to_insert_hw_breakpoint = debug_to_insert_hw_breakpoint; + current_target.to_remove_hw_breakpoint = debug_to_remove_hw_breakpoint; + current_target.to_insert_watchpoint = debug_to_insert_watchpoint; + current_target.to_remove_watchpoint = debug_to_remove_watchpoint; + current_target.to_stopped_by_watchpoint = debug_to_stopped_by_watchpoint; + current_target.to_stopped_data_address = debug_to_stopped_data_address; + current_target.to_region_size_ok_for_hw_watchpoint = debug_to_region_size_ok_for_hw_watchpoint; current_target.to_terminal_init = debug_to_terminal_init; current_target.to_terminal_inferior = debug_to_terminal_inferior; current_target.to_terminal_ours_for_output = debug_to_terminal_ours_for_output; diff --git a/gdb/target.h b/gdb/target.h index 1797fc1..c165801 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -252,6 +252,14 @@ struct target_ops void (*to_files_info) (struct target_ops *); int (*to_insert_breakpoint) (CORE_ADDR, char *); int (*to_remove_breakpoint) (CORE_ADDR, char *); + int (*to_can_use_hw_breakpoint) (int, int, int); + int (*to_insert_hw_breakpoint) (CORE_ADDR, char *); + int (*to_remove_hw_breakpoint) (CORE_ADDR, char *); + int (*to_remove_watchpoint) (CORE_ADDR, int, int); + int (*to_insert_watchpoint) (CORE_ADDR, int, int); + int (*to_stopped_by_watchpoint) (void); + CORE_ADDR (*to_stopped_data_address) (void); + int (*to_region_size_ok_for_hw_watchpoint) (int); void (*to_terminal_init) (void); void (*to_terminal_inferior) (void); void (*to_terminal_ours_for_output) (void); @@ -1041,7 +1049,8 @@ extern void (*target_new_objfile_hook) (struct objfile *); write). */ #ifndef STOPPED_BY_WATCHPOINT -#define STOPPED_BY_WATCHPOINT(w) 0 +#define STOPPED_BY_WATCHPOINT(w) \ + (*current_target.to_stopped_by_watchpoint) () #endif /* HP-UX supplies these operations, which respectively disable and enable @@ -1056,20 +1065,24 @@ extern void (*target_new_objfile_hook) (struct objfile *); #define TARGET_ENABLE_HW_WATCHPOINTS(pid) #endif -/* Provide defaults for systems that don't support hardware watchpoints. */ +/* Provide defaults for hardware watchpoint functions. */ -#ifndef TARGET_HAS_HARDWARE_WATCHPOINTS +/* If the *_hw_beakpoint functions have not been defined + elsewhere use the definitions in the target vector. */ /* Returns non-zero if we can set a hardware watchpoint of type TYPE. TYPE is one of bp_hardware_watchpoint, bp_read_watchpoint, bp_write_watchpoint, or bp_hardware_breakpoint. CNT is the number of such watchpoints used so far (including this one?). OTHERTYPE is who knows what... */ -#define TARGET_CAN_USE_HARDWARE_WATCHPOINT(TYPE,CNT,OTHERTYPE) 0 +#ifndef TARGET_CAN_USE_HARDWARE_WATCHPOINT +#define TARGET_CAN_USE_HARDWARE_WATCHPOINT(TYPE,CNT,OTHERTYPE) \ + (*current_target.to_can_use_hw_breakpoint) (TYPE, CNT, OTHERTYPE); +#endif #if !defined(TARGET_REGION_SIZE_OK_FOR_HW_WATCHPOINT) #define TARGET_REGION_SIZE_OK_FOR_HW_WATCHPOINT(byte_count) \ - ((LONGEST)(byte_count) <= REGISTER_SIZE) + (*current_target.to_region_size_ok_for_hw_watchpoint) (byte_count) #endif @@ -1077,18 +1090,25 @@ extern void (*target_new_objfile_hook) (struct objfile *); for write, 1 for read, and 2 for read/write accesses. Returns 0 for success, non-zero for failure. */ -#define target_remove_watchpoint(ADDR,LEN,TYPE) -1 -#define target_insert_watchpoint(ADDR,LEN,TYPE) -1 +#ifndef target_insert_watchpoint +#define target_insert_watchpoint(addr, len, type) \ + (*current_target.to_insert_watchpoint) (addr, len, type) -#endif /* TARGET_HAS_HARDWARE_WATCHPOINTS */ +#define target_remove_watchpoint(addr, len, type) \ + (*current_target.to_remove_watchpoint) (addr, len, type) +#endif #ifndef target_insert_hw_breakpoint -#define target_remove_hw_breakpoint(ADDR,SHADOW) -1 -#define target_insert_hw_breakpoint(ADDR,SHADOW) -1 +#define target_insert_hw_breakpoint(addr, save) \ + (*current_target.to_insert_hw_breakpoint) (addr, save) + +#define target_remove_hw_breakpoint(addr, save) \ + (*current_target.to_remove_hw_breakpoint) (addr, save) #endif #ifndef target_stopped_data_address -#define target_stopped_data_address() 0 +#define target_stopped_data_address() \ + (*current_target.to_stopped_data_address) () #endif /* If defined, then we need to decr pc by this much after a hardware break- |