From a94abe5bb7a71b207691f8b50406166eefda8186 Mon Sep 17 00:00:00 2001 From: "K. Richard Pixley" Date: Tue, 14 Sep 1993 19:34:15 +0000 Subject: [PATCH] use remote-utils facilities for baud_rate --- gdb/ChangeLog | 9 +++++++++ gdb/remote-es.c | 5 +++-- gdb/remote-mon.c | 13 ++++--------- gdb/remote-nindy.c | 9 ++++++--- gdb/remote.c | 16 ++++------------ 5 files changed, 26 insertions(+), 26 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index ecb459d57f0..a72d2e96291 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,12 @@ +Tue Sep 14 12:21:49 1993 K. Richard Pixley (rich@sendai.cygnus.com) + + * remote.c, remote-nindy.c, remote-mon.c, remote-es.c: include + remote-utils.h. + + * remote.c (remote_open), remote-nindy.c (nindy_open, + nindy_files_info), remote-mon.c (general_open), remote-es.c + (es1800_open): use remote-utils facilities for baud rate. + Tue Sep 14 09:12:17 1993 Jim Kingdon (kingdon@cirdan.cygnus.com) * paread.c, coffread.c, elfread.c: Include before libbfd.h. diff --git a/gdb/remote-es.c b/gdb/remote-es.c index f61c1eb3db0..e9108169b54 100644 --- a/gdb/remote-es.c +++ b/gdb/remote-es.c @@ -106,6 +106,7 @@ STP #include "wait.h" #include "terminal.h" #include "command.h" +#include "remote-utils.h" #ifdef USG #include @@ -364,7 +365,7 @@ es1800_open (name, from_tty) char buf[PBUFSIZ]; char *p; int i, fcflag; - char *baudrate; + char baudrate[1024]; m68020 = 0; @@ -372,7 +373,7 @@ es1800_open (name, from_tty) { error_no_arg ("serial port device name"); } - baudrate = baud_rate ? baud_rate : "19200"; /* default baudrate = 19200 */ + sprintf(baudrate, "%d", sr_get_baud_rate()); target_preopen (from_tty); es1800_close (0); diff --git a/gdb/remote-mon.c b/gdb/remote-mon.c index d9367a8517d..989729ce1eb 100644 --- a/gdb/remote-mon.c +++ b/gdb/remote-mon.c @@ -49,6 +49,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "command.h" #include "serial.h" #include "monitor.h" +#include "remote-utils.h" #ifdef HAVE_TERMIO # define TERMINAL struct termios @@ -337,16 +338,10 @@ general_open(args, name, from_tty) perror_with_name(dev_name); /* The baud rate was specified when GDB was started. */ - if (baud_rate) + if (SERIAL_SETBAUDRATE (monitor_desc, sr_get_baud_rate())) { - int rate; - - if (sscanf (baud_rate, "%d", &rate) == 1) - if (SERIAL_SETBAUDRATE (monitor_desc, rate)) - { - SERIAL_CLOSE (monitor_desc); - perror_with_name (name); - } + SERIAL_CLOSE (monitor_desc); + perror_with_name (name); } SERIAL_RAW(monitor_desc); diff --git a/gdb/remote-nindy.c b/gdb/remote-nindy.c index 3329e49724c..c8ac0ec9cac 100644 --- a/gdb/remote-nindy.c +++ b/gdb/remote-nindy.c @@ -117,6 +117,7 @@ NINDY ROM monitor at the other end of the line. #include "nindy-share/stop.h" #include "dcache.h" +#include "remote-utils.h" static DCACHE *nindy_dcache; @@ -179,6 +180,7 @@ nindy_open (name, from_tty) char *name; /* "/dev/ttyXX", "ttyXX", or "XX": tty to be opened */ int from_tty; { + char baudrate[1024]; if (!name) error_no_arg ("serial port device name"); @@ -193,7 +195,8 @@ nindy_open (name, from_tty) /* Allow user to interrupt the following -- we could hang if there's no NINDY at the other end of the remote tty. */ immediate_quit++; - ninConnect(name, baud_rate ? baud_rate : "9600", + sprintf(baudrate, "%d", sr_get_baud_rate()); + ninConnect(name, baudrate, nindy_initial_brk, !from_tty, nindy_old_protocol); immediate_quit--; @@ -222,8 +225,8 @@ nindy_detach (name, from_tty) static void nindy_files_info () { - printf("\tAttached to %s at %s bps%s%s.\n", savename, - baud_rate? baud_rate: "9600", + printf("\tAttached to %s at %d bps%s%s.\n", savename, + sr_get_baud_rate(), nindy_old_protocol? " in old protocol": "", nindy_initial_brk? " with initial break": ""); } diff --git a/gdb/remote.c b/gdb/remote.c index 7775b628641..efdc7d94a07 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -133,6 +133,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "gdb-stabs.h" #include "dcache.h" +#include "remote-utils.h" #if !defined(DONT_USE_REMOTE) #ifdef USG @@ -297,20 +298,11 @@ device is attached to the remote system (e.g. /dev/ttya)."); if (!remote_desc) perror_with_name (name); -#if 0 - /* FIXME: This should be using remote-utils.c. */ - if (baud_rate) + if (SERIAL_SETBAUDRATE (remote_desc, sr_get_baud_rate())) { - int rate; - - if (sscanf (baud_rate, "%d", &rate) == 1) - if (SERIAL_SETBAUDRATE (remote_desc, rate)) - { - SERIAL_CLOSE (remote_desc); - perror_with_name (name); - } + SERIAL_CLOSE (remote_desc); + perror_with_name (name); } -#endif SERIAL_RAW (remote_desc); -- 2.30.2