aboutsummaryrefslogtreecommitdiff
path: root/gdb/monitor.c
diff options
context:
space:
mode:
authorStan Shebs <shebs@codesourcery.com>1995-06-20 19:13:20 +0000
committerStan Shebs <shebs@codesourcery.com>1995-06-20 19:13:20 +0000
commit4a4307947e623d46d9641e7e9ae519272f646649 (patch)
tree68fe58a6f93217fd705778c4b95de723a5a79897 /gdb/monitor.c
parent34308df7a356a049c3bbd396ed5852810991857e (diff)
downloadfsf-binutils-gdb-4a4307947e623d46d9641e7e9ae519272f646649.zip
fsf-binutils-gdb-4a4307947e623d46d9641e7e9ae519272f646649.tar.gz
fsf-binutils-gdb-4a4307947e623d46d9641e7e9ae519272f646649.tar.bz2
* monitor.c (monitor_wait): Don't use the watchdog timeout
if its value is 0. * w89k-rom.c (w89k_open): Define to be static.
Diffstat (limited to 'gdb/monitor.c')
-rw-r--r--gdb/monitor.c30
1 files changed, 24 insertions, 6 deletions
diff --git a/gdb/monitor.c b/gdb/monitor.c
index ba54719..83073ff 100644
--- a/gdb/monitor.c
+++ b/gdb/monitor.c
@@ -32,7 +32,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "gdbcore.h"
#include "target.h"
#include "wait.h"
-#ifdef __STDC__
+#ifdef ANSI_PROTOTYPES
#include <stdarg.h>
#else
#include <varargs.h>
@@ -89,6 +89,8 @@ static int hashmark; /* flag set by "set hash" */
static int timeout = 30;
+static int in_monitor_wait = 0; /* Non-zero means we are in monitor_wait() */
+
static void (*ofunc)(); /* Old SIGINT signal handler */
/* Descriptor for I/O to remote machine. Initialize it to NULL so
@@ -115,7 +117,7 @@ static int dump_reg_flag; /* Non-zero means do a dump_registers cmd when
Works just like printf. */
void
-#ifdef __STDC__
+#ifdef ANSI_PROTOTYPES
monitor_printf_noecho (char *pattern, ...)
#else
monitor_printf_noecho (va_alist)
@@ -126,7 +128,7 @@ monitor_printf_noecho (va_alist)
char sndbuf[2000];
int len;
-#if __STDC__
+#if ANSI_PROTOTYPES
va_start (args, pattern);
#else
char *pattern;
@@ -152,7 +154,7 @@ monitor_printf_noecho (va_alist)
printf. */
void
-#ifdef __STDC__
+#ifdef ANSI_PROTOTYPES
monitor_printf (char *pattern, ...)
#else
monitor_printf (va_alist)
@@ -164,7 +166,7 @@ monitor_printf (va_alist)
int len;
int i, c;
-#ifdef __STDC__
+#ifdef ANSI_PROTOTYPES
va_start (args, pattern);
#else
char *pattern;
@@ -221,7 +223,15 @@ readchar (timeout)
return c & 0x7f;
if (c == SERIAL_TIMEOUT)
- error ("Timeout reading from remote system.");
+#ifdef MAINTENANCE_CMDS
+ if (in_monitor_wait) /* Watchdog went off */
+ {
+ target_mourn_inferior ();
+ error ("Watchdog has expired. Target detached.\n");
+ }
+ else
+#endif
+ error ("Timeout reading from remote system.");
perror_with_name ("remote-monitor");
}
@@ -603,6 +613,7 @@ monitor_wait_cleanup (old_timeout)
{
timeout = old_timeout;
signal (SIGINT, ofunc);
+ in_monitor_wait = 0;
}
/* Wait until the remote machine stops, then return, storing status in
@@ -623,7 +634,12 @@ monitor_wait (pid, status)
old_chain = make_cleanup (monitor_wait_cleanup, old_timeout);
+#ifdef MAINTENANCE_CMDS
+ in_monitor_wait = 1;
+ timeout = watchdog > 0 ? watchdog : -1;
+#else
timeout = -1; /* Don't time out -- user program is running. */
+#endif
ofunc = (void (*)()) signal (SIGINT, monitor_interrupt);
@@ -656,6 +672,8 @@ monitor_wait (pid, status)
discard_cleanups (old_chain);
+ in_monitor_wait = 0;
+
return inferior_pid;
}