diff options
author | Mark Alexander <marka@cygnus> | 1998-01-24 00:52:54 +0000 |
---|---|---|
committer | Mark Alexander <marka@cygnus> | 1998-01-24 00:52:54 +0000 |
commit | 1a31a33a93c865f5f521a3a0629161979cf80b89 (patch) | |
tree | cf3038d78df65cd489183a935ceec44bc011b817 /gdb/monitor.c | |
parent | f62a42d0dc1ee3f329ea6be9c4b3a3d8848e46f5 (diff) | |
download | gdb-1a31a33a93c865f5f521a3a0629161979cf80b89.zip gdb-1a31a33a93c865f5f521a3a0629161979cf80b89.tar.gz gdb-1a31a33a93c865f5f521a3a0629161979cf80b89.tar.bz2 |
* monitor.c (monitor_write, monitor_readchar): New functions.
* monitor.h (monitor_write, monitor_readchar): Declare.
* dve3900-rom.c: Add support for fast loading on ethernet connections.
Diffstat (limited to 'gdb/monitor.c')
-rw-r--r-- | gdb/monitor.c | 49 |
1 files changed, 45 insertions, 4 deletions
diff --git a/gdb/monitor.c b/gdb/monitor.c index 1650800..03bfa59 100644 --- a/gdb/monitor.c +++ b/gdb/monitor.c @@ -178,8 +178,7 @@ monitor_printf_noecho (va_alist) if (len + 1 > sizeof sndbuf) abort (); - if (SERIAL_WRITE(monitor_desc, sndbuf, len)) - fprintf_unfiltered (stderr, "SERIAL_WRITE failed: %s\n", safe_strerror (errno)); + monitor_write (sndbuf, len); } /* monitor_printf -- Send data to monitor and check the echo. Works just like @@ -215,8 +214,7 @@ monitor_printf (va_alist) if (len + 1 > sizeof sndbuf) abort (); - if (SERIAL_WRITE(monitor_desc, sndbuf, len)) - fprintf_unfiltered (stderr, "SERIAL_WRITE failed: %s\n", safe_strerror (errno)); + monitor_write (sndbuf, len); /* We used to expect that the next immediate output was the characters we just output, but sometimes some extra junk appeared before the characters @@ -225,6 +223,49 @@ monitor_printf (va_alist) monitor_expect (sndbuf, (char *)0, 0); } + +/* Write characters to the remote system. */ + +void +monitor_write (buf, buflen) + char *buf; + int buflen; +{ + if (SERIAL_WRITE(monitor_desc, buf, buflen)) + fprintf_unfiltered (stderr, "SERIAL_WRITE failed: %s\n", safe_strerror (errno)); +} + + +/* Read a binary character from the remote system, doing all the fancy + timeout stuff, but without interpreting the character in any way, + and without printing remote debug information. */ + +int +monitor_readchar () +{ + int c; + int looping; + + do + { + looping = 0; + c = SERIAL_READCHAR (monitor_desc, timeout); + + if (c >= 0) + c &= 0xff; /* don't lose bit 7 */ + } + while (looping); + + if (c >= 0) + return c; + + if (c == SERIAL_TIMEOUT) + error ("Timeout reading from remote system."); + + perror_with_name ("remote-monitor"); +} + + /* Read a character from the remote system, doing all the fancy timeout stuff. */ |