From cb1709aeac4e07ce89f6d9a520cdc0fa83847a92 Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Fri, 28 Jun 1996 12:27:08 +0000 Subject: [PATCH] * remote-e7000.c,remote.c,target.h,top.c: Add set option "remote_timeout" for setting remote_timeout. Add set option "use_hard_breakpoints" for setting hardware .vs. memory breakpoints. --- gdb/ChangeLog | 7 ++++++ gdb/remote-e7000.c | 32 +++++++++++++++++------ gdb/remote.c | 6 +++-- gdb/target.h | 63 +++++++++++++++++++++++++++++++++++++++++++++- gdb/top.c | 11 ++++++++ 5 files changed, 108 insertions(+), 11 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 152d7c3a34a..a93622639f5 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +Fri Jun 28 05:25:18 1996 Dawn Perchik + + * remote-e7000.c,remote.c,target.h,top.c: + Add set option "remote_timeout" for setting remote_timeout. + Add set option "use_hard_breakpoints" for setting hardware + .vs. memory breakpoints. + Fri Jun 28 04:32:18 1996 Dawn Perchik * remote-e7000.c (e7000_parse_device): New function. diff --git a/gdb/remote-e7000.c b/gdb/remote-e7000.c index 9897207634e..0e5ee8e4af2 100644 --- a/gdb/remote-e7000.c +++ b/gdb/remote-e7000.c @@ -40,15 +40,16 @@ #include "command.h" #include #include "gdb_string.h" +#include "gdbcmd.h" #include #include "serial.h" #include "remote-utils.h" #include "symfile.h" #include -#if 0 -#define HARD_BREAKPOINTS -#define BC_BREAKPOINTS 0 +#if 1 +#define HARD_BREAKPOINTS /* Now handled by set option. */ +#define BC_BREAKPOINTS use_hard_breakpoints #endif #define CTRLC 0x03 @@ -89,6 +90,9 @@ static void expect_prompt PARAMS ((void)); static serial_t e7000_desc; +/* Allow user to chose between using hardware breakpoints or memory. */ +static int use_hard_breakpoints = 0; /* use sw breakpoints by default */ + /* Nonzero if using the tcp serial driver. */ static int using_tcp; /* direct tcp connection to target */ @@ -110,7 +114,7 @@ static int echo; static int ctrl_c; -static int timeout = 5; +static int timeout = 20; /* Send data to e7000debug. */ @@ -469,7 +473,7 @@ e7000_ftp_command (args, from_tty) char buf[200]; int oldtimeout = timeout; - timeout = 10; + timeout = remote_timeout; sprintf (buf, "ftp %s\r", machine); puts_e7000debug (buf); @@ -1460,6 +1464,9 @@ e7000_load (args, from_tty) int nostart; time_t start_time, end_time; /* Start and end times of download */ unsigned long data_count; /* Number of bytes transferred to memory */ + int oldtimeout = timeout; + + timeout = remote_timeout; /* FIXME! change test to test for type of download */ @@ -1618,6 +1625,7 @@ e7000_load (args, from_tty) report_transfer_performance (data_count, start_time, end_time); do_cleanups (old_chain); + timeout = oldtimeout; } /* Clean up when a program exits. @@ -1634,15 +1642,18 @@ e7000_mourn_inferior () generic_mourn_inferior (); /* Do all the proper things now */ } +#define MAX_BREAKPOINTS 200 #ifdef HARD_BREAKPOINTS -#define MAX_E7000DEBUG_BREAKPOINTS (BC_BREAKPOINTS ? 5 : 200) +#define MAX_E7000DEBUG_BREAKPOINTS (BC_BREAKPOINTS ? 5 : MAX_BREAKPOINTS) #else -#define MAX_E7000DEBUG_BREAKPOINTS 200 +#define MAX_E7000DEBUG_BREAKPOINTS MAX_BREAKPOINTS #endif extern int memory_breakpoint_size; -static CORE_ADDR breakaddr[MAX_E7000DEBUG_BREAKPOINTS] = {0}; +/* Since we can change to soft breakpoints dynamically, we must define + more than enough. Was breakaddr[MAX_E7000DEBUG_BREAKPOINTS]. */ +static CORE_ADDR breakaddr[MAX_BREAKPOINTS] = {0}; static int e7000_insert_breakpoint (addr, shadow) @@ -2134,4 +2145,9 @@ _initialize_remote_e7000 () add_com ("drain", class_obscure, e7000_drain_command, "Drain pending e7000 text buffers."); + + add_show_from_set (add_set_cmd ("usehardbreakpoints", no_class, + var_integer, (char *)&use_hard_breakpoints, + "Set use of hardware breakpoints for all breakpoints.\n", &setlist), + &showlist); } diff --git a/gdb/remote.c b/gdb/remote.c index 25c873427c9..1f3b279403e 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -188,7 +188,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "gdbcmd.h" #include "objfiles.h" #include "gdb-stabs.h" -#include "thread.h" +#include "gdbthread.h" #include "dcache.h" @@ -274,7 +274,9 @@ extern struct target_ops extended_remote_ops; /* Forward decl */ other form of hairy serial connection, I would think 2 seconds would be plenty. */ -static int remote_timeout = 2; +/* Changed to allow option to set timeout value. + was static int remote_timeout = 2; */ +extern int remote_timeout; /* This variable chooses whether to send a ^C or a break when the user requests program interruption. Although ^C is usually what remote diff --git a/gdb/target.h b/gdb/target.h index 4ef430e175e..2f204090797 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -16,7 +16,7 @@ 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #if !defined (TARGET_H) #define TARGET_H @@ -291,6 +291,7 @@ struct target_ops void (*to_mourn_inferior) PARAMS ((void)); int (*to_can_run) PARAMS ((void)); void (*to_notice_signals) PARAMS ((int pid)); + int (*to_thread_alive) PARAMS ((int pid)); void (*to_stop) PARAMS ((void)); enum strata to_stratum; struct target_ops @@ -549,6 +550,11 @@ print_section_info PARAMS ((struct target_ops *, bfd *)); #define target_notice_signals(pid) \ (*current_target.to_notice_signals) (pid) +/* Check to see if a thread is still alive. */ + +#define target_thread_alive(pid) \ + (*current_target.to_thread_alive) (pid) + /* Make target stop in a continuable fashion. (For instance, under Unix, this should act like SIGSTOP). This function is normally used by GUIs to implement a stop button. */ @@ -605,6 +611,23 @@ extern void target_link PARAMS ((char *, CORE_ADDR *)); extern char *normal_pid_to_str PARAMS ((int pid)); #endif +#ifndef target_new_objfile +#define target_new_objfile(OBJFILE) +#endif + +/* Hook to call target-dependant code after reading in a new symbol table. */ + +#ifndef TARGET_SYMFILE_POSTREAD +#define TARGET_SYMFILE_POSTREAD(OBJFILE) +#endif + +/* Hook to call target dependant code just after inferior target process has + started. */ + +#ifndef TARGET_CREATE_INFERIOR_HOOK +#define TARGET_CREATE_INFERIOR_HOOK(PID) +#endif + /* Hardware watchpoint interfaces. */ /* Returns non-zero if we were stopped by a hardware watchpoint (memory read or @@ -614,6 +637,42 @@ extern char *normal_pid_to_str PARAMS ((int pid)); #define STOPPED_BY_WATCHPOINT(w) 0 #endif +/* Provide defaults for systems that don't support hardware watchpoints. */ + +#ifndef TARGET_HAS_HARDWARE_WATCHPOINTS + +/* 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 + +/* Set/clear a hardware watchpoint starting at ADDR, for LEN bytes. TYPE is 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 + +#endif /* TARGET_HAS_HARDWARE_WATCHPOINTS */ + +#ifndef target_insert_hw_breakpoint +#define target_remove_hw_breakpoint(ADDR,SHADOW) -1 +#define target_insert_hw_breakpoint(ADDR,SHADOW) -1 +#endif + +#ifndef target_stopped_data_address +#define target_stopped_data_address() 0 +#endif + +/* If defined, then we need to decr pc by this much after a hardware break- + point. Presumably this overrides DECR_PC_AFTER_BREAK... */ + +#ifndef DECR_PC_AFTER_HW_BREAK +#define DECR_PC_AFTER_HW_BREAK 0 +#endif + /* Routines for maintenance of the target structures... add_target: Add a target to the list of all possible targets. @@ -694,6 +753,8 @@ extern int remote_debug; /* Speed in bits per second, or -1 which means don't mess with the speed. */ extern int baud_rate; +/* Timeout limit for response from target. */ +extern int remote_timeout; /* Functions for helping to write a native target. */ diff --git a/gdb/top.c b/gdb/top.c index bfab3f7306b..ea217c21599 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -319,6 +319,10 @@ int server_command; int baud_rate = -1; +/* Timeout limit for response from target. */ + +int remote_timeout = 20; /* Set default to 20 */ + /* Non-zero tells remote* modules to output debugging info. */ int remote_debug = 0; @@ -3589,4 +3593,11 @@ using remote targets.", &setlist), When enabled, each packet sent or received with the remote target\n\ is displayed.", &setlist), &showlist); + + add_show_from_set ( + add_set_cmd ("remotetimeout", no_class, var_integer, (char *)&remote_timeout, + "Set timeout limit to wait for target to respond.\n\ +This value is used to set the time limit for gdb to wait for a response\n\ +from he target.", &setlist), + &showlist); } -- 2.30.2