projects
/
binutils-gdb.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix gdb.fortran "failed to extract expected results" errors
[binutils-gdb.git]
/
gdb
/
ser-go32.c
diff --git
a/gdb/ser-go32.c
b/gdb/ser-go32.c
index 44fea132b7e770c57073031bde611f034d8d7871..0b2fa93b9c98ee0fff52c9d5342b7899ac9ae5ec 100644
(file)
--- a/
gdb/ser-go32.c
+++ b/
gdb/ser-go32.c
@@
-1,6
+1,5
@@
/* Remote serial interface for local (hardwired) serial ports for GO32.
/* Remote serial interface for local (hardwired) serial ports for GO32.
- Copyright (C) 1992, 1993, 2000, 2001, 2007, 2008, 2009, 2010, 2011
- Free Software Foundation, Inc.
+ Copyright (C) 1992-2022 Free Software Foundation, Inc.
Contributed by Nigel Stephens, Algorithmics Ltd. (nigel@algor.co.uk).
Contributed by Nigel Stephens, Algorithmics Ltd. (nigel@algor.co.uk).
@@
-25,9
+24,6
@@
#include "defs.h"
#include "gdbcmd.h"
#include "serial.h"
#include "defs.h"
#include "gdbcmd.h"
#include "serial.h"
-#include "gdb_string.h"
-
-
/*
* NS16550 UART registers
*/
/*
* NS16550 UART registers
*/
@@
-149,7
+145,7
@@
typedef unsigned long u_long;
#define NCNT 20
static int intrcnt;
#define NCNT 20
static int intrcnt;
-static
in
t cnts[NCNT];
+static
size_
t cnts[NCNT];
static char *cntnames[NCNT] =
{
/* h/w interrupt counts. */
static char *cntnames[NCNT] =
{
/* h/w interrupt counts. */
@@
-231,7
+227,7
@@
static int dos_open (struct serial *scb, const char *name);
static void dos_raw (struct serial *scb);
static int dos_readchar (struct serial *scb, int timeout);
static int dos_setbaudrate (struct serial *scb, int rate);
static void dos_raw (struct serial *scb);
static int dos_readchar (struct serial *scb, int timeout);
static int dos_setbaudrate (struct serial *scb, int rate);
-static int dos_write (struct serial *scb, const
char *str, int len
);
+static int dos_write (struct serial *scb, const
void *buf, size_t count
);
static void dos_close (struct serial *scb);
static serial_ttystate dos_get_tty_state (struct serial *scb);
static int dos_set_tty_state (struct serial *scb, serial_ttystate state);
static void dos_close (struct serial *scb);
static serial_ttystate dos_get_tty_state (struct serial *scb);
static int dos_set_tty_state (struct serial *scb, serial_ttystate state);
@@
-597,9
+593,26
@@
dos_close (struct serial *scb)
}
\f
}
\f
+/* Implementation of the serial_ops flush_output method. */
+
+static int
+dos_flush_output (struct serial *scb)
+{
+ return 0;
+}
+
+/* Implementation of the serial_ops setparity method. */
+
+static int
+dos_setparity (struct serial *scb, int parity)
+{
+ return 0;
+}
+
+/* Implementation of the serial_ops drain_output method. */
static int
static int
-dos_
noop
(struct serial *scb)
+dos_
drain_output
(struct serial *scb)
{
return 0;
}
{
return 0;
}
@@
-620,6
+633,8
@@
dos_readchar (struct serial *scb, int timeout)
then = rawclock () + (timeout * RAWHZ);
while ((c = dos_getc (port)) < 0)
{
then = rawclock () + (timeout * RAWHZ);
while ((c = dos_getc (port)) < 0)
{
+ QUIT;
+
if (timeout >= 0 && (rawclock () - then) >= 0)
return SERIAL_TIMEOUT;
}
if (timeout >= 0 && (rawclock () - then) >= 0)
return SERIAL_TIMEOUT;
}
@@
-640,35
+655,35
@@
dos_get_tty_state (struct serial *scb)
/* We've never heard about this port. We should fail this call,
unless they are asking about one of the 3 standard handles,
in which case we pretend the handle was open by us if it is
/* We've never heard about this port. We should fail this call,
unless they are asking about one of the 3 standard handles,
in which case we pretend the handle was open by us if it is
- connected to a terminal device. This is be
ac
use Unix
+ connected to a terminal device. This is be
ca
use Unix
terminals use the serial interface, so GDB expects the
standard handles to go through here. */
if (scb->fd >= 3 || !isatty (scb->fd))
return NULL;
}
terminals use the serial interface, so GDB expects the
standard handles to go through here. */
if (scb->fd >= 3 || !isatty (scb->fd))
return NULL;
}
- state =
(struct dos_ttystate *) xmalloc (sizeof *
state);
+ state =
XNEW (struct dos_tty
state);
*state = *port;
return (serial_ttystate) state;
}
*state = *port;
return (serial_ttystate) state;
}
-static
int
-dos_
set
_tty_state (struct serial *scb, serial_ttystate ttystate)
+static
serial_ttystate
+dos_
copy
_tty_state (struct serial *scb, serial_ttystate ttystate)
{
struct dos_ttystate *state;
{
struct dos_ttystate *state;
- state = (struct dos_ttystate *) ttystate;
- dos_setbaudrate (scb, state->baudrate);
- return 0;
+ state = XNEW (struct dos_ttystate);
+ *state = *(struct dos_ttystate *) ttystate;
+
+ return (serial_ttystate) state;
}
static int
}
static int
-dos_noflush_set_tty_state (struct serial *scb, serial_ttystate new_ttystate,
- serial_ttystate old_ttystate)
+dos_set_tty_state (struct serial *scb, serial_ttystate ttystate)
{
struct dos_ttystate *state;
{
struct dos_ttystate *state;
- state = (struct dos_ttystate *)
new_
ttystate;
+ state = (struct dos_ttystate *) ttystate;
dos_setbaudrate (scb, state->baudrate);
return 0;
}
dos_setbaudrate (scb, state->baudrate);
return 0;
}
@@
-777,26
+792,29
@@
dos_setstopbits (struct serial *scb, int num)
}
static int
}
static int
-dos_write (struct serial *scb, const
char *str, int len
)
+dos_write (struct serial *scb, const
void *buf, size_t count
)
{
volatile struct dos_ttystate *port = &ports[scb->fd];
{
volatile struct dos_ttystate *port = &ports[scb->fd];
-
in
t fifosize = port->fifo ? 16 : 1;
+
size_
t fifosize = port->fifo ? 16 : 1;
long then;
long then;
- int cnt;
+ size_t cnt;
+ const char *str = (const char *) buf;
- while (
len
> 0)
+ while (
count
> 0)
{
{
+ QUIT;
+
/* Send the data, fifosize bytes at a time. */
/* Send the data, fifosize bytes at a time. */
- cnt = fifosize >
len ? len
: fifosize;
+ cnt = fifosize >
count ? count
: fifosize;
port->txbusy = 1;
/* Francisco Pastor <fpastor.etra-id@etra.es> says OUTSB messes
up the communications with UARTs with FIFOs. */
#ifdef UART_FIFO_WORKS
outportsb (port->base + com_data, str, cnt);
str += cnt;
port->txbusy = 1;
/* Francisco Pastor <fpastor.etra-id@etra.es> says OUTSB messes
up the communications with UARTs with FIFOs. */
#ifdef UART_FIFO_WORKS
outportsb (port->base + com_data, str, cnt);
str += cnt;
-
len
-= cnt;
+
count
-= cnt;
#else
#else
- for ( ; cnt > 0; cnt--,
len
--)
+ for ( ; cnt > 0; cnt--,
count
--)
outportb (port->base + com_data, *str++);
#endif
#ifdef DOS_STATS
outportb (port->base + com_data, *str++);
#endif
#ifdef DOS_STATS
@@
-837,26
+855,26
@@
dos_sendbreak (struct serial *scb)
}
}
-static struct serial_ops dos_ops =
+static
const
struct serial_ops dos_ops =
{
"hardwire",
{
"hardwire",
- 0,
dos_open,
dos_close,
NULL, /* fdopen, not implemented */
dos_readchar,
dos_write,
dos_open,
dos_close,
NULL, /* fdopen, not implemented */
dos_readchar,
dos_write,
- dos_
noop, /* flush output */
+ dos_
flush_output,
dos_flush_input,
dos_sendbreak,
dos_raw,
dos_get_tty_state,
dos_flush_input,
dos_sendbreak,
dos_raw,
dos_get_tty_state,
+ dos_copy_tty_state,
dos_set_tty_state,
dos_print_tty_state,
dos_set_tty_state,
dos_print_tty_state,
- dos_noflush_set_tty_state,
dos_setbaudrate,
dos_setstopbits,
dos_setbaudrate,
dos_setstopbits,
- dos_noop, /* Wait for output to drain. */
+ dos_setparity,
+ dos_drain_output,
(void (*)(struct serial *, int))NULL /* Change into async mode. */
};
(void (*)(struct serial *, int))NULL /* Change into async mode. */
};
@@
-869,7
+887,7
@@
gdb_pipe (int pdes[2])
}
static void
}
static void
-
dos_info (
char *arg, int from_tty)
+
info_serial_command (const
char *arg, int from_tty)
{
struct dos_ttystate *port;
#ifdef DOS_STATS
{
struct dos_ttystate *port;
#ifdef DOS_STATS
@@
-893,13
+911,13
@@
dos_info (char *arg, int from_tty)
printf_filtered ("\nTotal interrupts: %d\n", intrcnt);
for (i = 0; i < NCNT; i++)
if (cnts[i])
printf_filtered ("\nTotal interrupts: %d\n", intrcnt);
for (i = 0; i < NCNT; i++)
if (cnts[i])
- printf_filtered ("%s:\t%
d\n", cntnames[i],
cnts[i]);
+ printf_filtered ("%s:\t%
lu\n", cntnames[i], (unsigned long)
cnts[i]);
#endif
}
#endif
}
-
+void _initialize_ser_dos ();
void
void
-_initialize_ser_dos (
void
)
+_initialize_ser_dos ()
{
serial_add_interface (&dos_ops);
{
serial_add_interface (&dos_ops);
@@
-967,6
+985,6
@@
Show COM4 interrupt request."), NULL,
NULL, /* FIXME: i18n: */
&setlist, &showlist);
NULL, /* FIXME: i18n: */
&setlist, &showlist);
- add_info ("serial",
dos_info
,
+ add_info ("serial",
info_serial_command
,
_("Print DOS serial port status."));
}
_("Print DOS serial port status."));
}