1999-04-16 09:35:26 +08:00
|
|
|
|
/* Generic serial interface routines
|
2001-01-31 09:24:03 +08:00
|
|
|
|
|
2007-01-10 01:59:20 +08:00
|
|
|
|
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
|
2008-01-02 06:53:26 +08:00
|
|
|
|
2002, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
1999-07-08 04:19:36 +08:00
|
|
|
|
This file is part of GDB.
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
1999-07-08 04:19:36 +08:00
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
2007-08-24 02:08:50 +08:00
|
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
1999-07-08 04:19:36 +08:00
|
|
|
|
(at your option) any later version.
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
1999-07-08 04:19:36 +08:00
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
1999-07-08 04:19:36 +08:00
|
|
|
|
You should have received a copy of the GNU General Public License
|
2007-08-24 02:08:50 +08:00
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
|
|
#include "defs.h"
|
|
|
|
|
#include <ctype.h>
|
|
|
|
|
#include "serial.h"
|
|
|
|
|
#include "gdb_string.h"
|
|
|
|
|
#include "gdbcmd.h"
|
|
|
|
|
|
1999-09-22 11:28:34 +08:00
|
|
|
|
extern void _initialize_serial (void);
|
1999-05-26 02:09:09 +08:00
|
|
|
|
|
1999-10-06 07:13:56 +08:00
|
|
|
|
/* Is serial being debugged? */
|
|
|
|
|
|
|
|
|
|
static int global_serial_debug_p;
|
|
|
|
|
|
1999-04-16 09:35:26 +08:00
|
|
|
|
/* Linked list of serial I/O handlers */
|
|
|
|
|
|
|
|
|
|
static struct serial_ops *serial_ops_list = NULL;
|
|
|
|
|
|
|
|
|
|
/* This is the last serial stream opened. Used by connect command. */
|
|
|
|
|
|
2001-07-12 01:52:32 +08:00
|
|
|
|
static struct serial *last_serial_opened = NULL;
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
|
|
/* Pointer to list of scb's. */
|
|
|
|
|
|
2001-07-12 01:52:32 +08:00
|
|
|
|
static struct serial *scb_base;
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
|
|
/* Non-NULL gives filename which contains a recording of the remote session,
|
|
|
|
|
suitable for playback by gdbserver. */
|
|
|
|
|
|
|
|
|
|
static char *serial_logfile = NULL;
|
2000-02-02 08:21:19 +08:00
|
|
|
|
static struct ui_file *serial_logfp = NULL;
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
1999-09-22 11:28:34 +08:00
|
|
|
|
static struct serial_ops *serial_interface_lookup (char *);
|
2000-02-02 08:21:19 +08:00
|
|
|
|
static void serial_logchar (struct ui_file *stream, int ch_type, int ch, int timeout);
|
2000-06-08 08:52:56 +08:00
|
|
|
|
static const char logbase_hex[] = "hex";
|
|
|
|
|
static const char logbase_octal[] = "octal";
|
|
|
|
|
static const char logbase_ascii[] = "ascii";
|
|
|
|
|
static const char *logbase_enums[] =
|
1999-07-08 04:19:36 +08:00
|
|
|
|
{logbase_hex, logbase_octal, logbase_ascii, NULL};
|
2000-06-08 08:52:56 +08:00
|
|
|
|
static const char *serial_logbase = logbase_ascii;
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
1999-07-08 04:19:36 +08:00
|
|
|
|
|
1999-04-16 09:35:26 +08:00
|
|
|
|
static int serial_current_type = 0;
|
|
|
|
|
|
|
|
|
|
/* Log char CH of type CHTYPE, with TIMEOUT */
|
|
|
|
|
|
|
|
|
|
/* Define bogus char to represent a BREAK. Should be careful to choose a value
|
|
|
|
|
that can't be confused with a normal char, or an error code. */
|
|
|
|
|
#define SERIAL_BREAK 1235
|
|
|
|
|
|
|
|
|
|
static void
|
2000-02-02 08:21:19 +08:00
|
|
|
|
serial_logchar (struct ui_file *stream, int ch_type, int ch, int timeout)
|
1999-04-16 09:35:26 +08:00
|
|
|
|
{
|
|
|
|
|
if (ch_type != serial_current_type)
|
|
|
|
|
{
|
1999-10-06 07:13:56 +08:00
|
|
|
|
fprintf_unfiltered (stream, "\n%c ", ch_type);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
serial_current_type = ch_type;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (serial_logbase != logbase_ascii)
|
1999-10-06 07:13:56 +08:00
|
|
|
|
fputc_unfiltered (' ', stream);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
|
|
switch (ch)
|
|
|
|
|
{
|
|
|
|
|
case SERIAL_TIMEOUT:
|
1999-10-06 07:13:56 +08:00
|
|
|
|
fprintf_unfiltered (stream, "<Timeout: %d seconds>", timeout);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
return;
|
|
|
|
|
case SERIAL_ERROR:
|
1999-10-06 07:13:56 +08:00
|
|
|
|
fprintf_unfiltered (stream, "<Error: %s>", safe_strerror (errno));
|
1999-04-16 09:35:26 +08:00
|
|
|
|
return;
|
|
|
|
|
case SERIAL_EOF:
|
1999-10-06 07:13:56 +08:00
|
|
|
|
fputs_unfiltered ("<Eof>", stream);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
return;
|
|
|
|
|
case SERIAL_BREAK:
|
1999-10-06 07:13:56 +08:00
|
|
|
|
fputs_unfiltered ("<Break>", stream);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
return;
|
|
|
|
|
default:
|
|
|
|
|
if (serial_logbase == logbase_hex)
|
1999-10-06 07:13:56 +08:00
|
|
|
|
fprintf_unfiltered (stream, "%02x", ch & 0xff);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
else if (serial_logbase == logbase_octal)
|
1999-10-06 07:13:56 +08:00
|
|
|
|
fprintf_unfiltered (stream, "%03o", ch & 0xff);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
else
|
|
|
|
|
switch (ch)
|
|
|
|
|
{
|
1999-07-08 04:19:36 +08:00
|
|
|
|
case '\\':
|
1999-10-06 07:13:56 +08:00
|
|
|
|
fputs_unfiltered ("\\\\", stream);
|
1999-07-08 04:19:36 +08:00
|
|
|
|
break;
|
|
|
|
|
case '\b':
|
1999-10-06 07:13:56 +08:00
|
|
|
|
fputs_unfiltered ("\\b", stream);
|
1999-07-08 04:19:36 +08:00
|
|
|
|
break;
|
|
|
|
|
case '\f':
|
1999-10-06 07:13:56 +08:00
|
|
|
|
fputs_unfiltered ("\\f", stream);
|
1999-07-08 04:19:36 +08:00
|
|
|
|
break;
|
|
|
|
|
case '\n':
|
1999-10-06 07:13:56 +08:00
|
|
|
|
fputs_unfiltered ("\\n", stream);
|
1999-07-08 04:19:36 +08:00
|
|
|
|
break;
|
|
|
|
|
case '\r':
|
1999-10-06 07:13:56 +08:00
|
|
|
|
fputs_unfiltered ("\\r", stream);
|
1999-07-08 04:19:36 +08:00
|
|
|
|
break;
|
|
|
|
|
case '\t':
|
1999-10-06 07:13:56 +08:00
|
|
|
|
fputs_unfiltered ("\\t", stream);
|
1999-07-08 04:19:36 +08:00
|
|
|
|
break;
|
|
|
|
|
case '\v':
|
1999-10-06 07:13:56 +08:00
|
|
|
|
fputs_unfiltered ("\\v", stream);
|
1999-07-08 04:19:36 +08:00
|
|
|
|
break;
|
|
|
|
|
default:
|
1999-10-06 07:13:56 +08:00
|
|
|
|
fprintf_unfiltered (stream, isprint (ch) ? "%c" : "\\x%02x", ch & 0xFF);
|
1999-07-08 04:19:36 +08:00
|
|
|
|
break;
|
1999-04-16 09:35:26 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
1999-09-22 11:28:34 +08:00
|
|
|
|
serial_log_command (const char *cmd)
|
1999-04-16 09:35:26 +08:00
|
|
|
|
{
|
|
|
|
|
if (!serial_logfp)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
serial_current_type = 'c';
|
|
|
|
|
|
|
|
|
|
fputs_unfiltered ("\nc ", serial_logfp);
|
|
|
|
|
fputs_unfiltered (cmd, serial_logfp);
|
|
|
|
|
|
|
|
|
|
/* Make sure that the log file is as up-to-date as possible,
|
|
|
|
|
in case we are getting ready to dump core or something. */
|
|
|
|
|
gdb_flush (serial_logfp);
|
|
|
|
|
}
|
|
|
|
|
|
1999-09-22 11:28:34 +08:00
|
|
|
|
|
1999-04-16 09:35:26 +08:00
|
|
|
|
static struct serial_ops *
|
1999-09-22 11:28:34 +08:00
|
|
|
|
serial_interface_lookup (char *name)
|
1999-04-16 09:35:26 +08:00
|
|
|
|
{
|
|
|
|
|
struct serial_ops *ops;
|
|
|
|
|
|
|
|
|
|
for (ops = serial_ops_list; ops; ops = ops->next)
|
|
|
|
|
if (strcmp (name, ops->name) == 0)
|
|
|
|
|
return ops;
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
1999-09-22 11:28:34 +08:00
|
|
|
|
serial_add_interface (struct serial_ops *optable)
|
1999-04-16 09:35:26 +08:00
|
|
|
|
{
|
|
|
|
|
optable->next = serial_ops_list;
|
|
|
|
|
serial_ops_list = optable;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Open up a device or a network socket, depending upon the syntax of NAME. */
|
|
|
|
|
|
2001-07-12 01:52:32 +08:00
|
|
|
|
struct serial *
|
1999-09-22 11:28:34 +08:00
|
|
|
|
serial_open (const char *name)
|
1999-04-16 09:35:26 +08:00
|
|
|
|
{
|
2001-07-12 01:52:32 +08:00
|
|
|
|
struct serial *scb;
|
1999-04-16 09:35:26 +08:00
|
|
|
|
struct serial_ops *ops;
|
1999-09-22 11:28:34 +08:00
|
|
|
|
const char *open_name = name;
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
|
|
for (scb = scb_base; scb; scb = scb->next)
|
|
|
|
|
if (scb->name && strcmp (scb->name, name) == 0)
|
|
|
|
|
{
|
|
|
|
|
scb->refcnt++;
|
|
|
|
|
return scb;
|
|
|
|
|
}
|
|
|
|
|
|
2002-02-24 11:59:50 +08:00
|
|
|
|
if (strcmp (name, "pc") == 0)
|
1999-04-16 09:35:26 +08:00
|
|
|
|
ops = serial_interface_lookup ("pc");
|
|
|
|
|
else if (strncmp (name, "lpt", 3) == 0)
|
|
|
|
|
ops = serial_interface_lookup ("parallel");
|
1999-07-12 19:15:22 +08:00
|
|
|
|
else if (strncmp (name, "|", 1) == 0)
|
1999-09-22 11:28:34 +08:00
|
|
|
|
{
|
|
|
|
|
ops = serial_interface_lookup ("pipe");
|
2006-11-04 16:37:24 +08:00
|
|
|
|
/* Discard ``|'' and any space before the command itself. */
|
|
|
|
|
++open_name;
|
|
|
|
|
while (isspace (*open_name))
|
|
|
|
|
++open_name;
|
1999-09-22 11:28:34 +08:00
|
|
|
|
}
|
2006-04-12 04:33:12 +08:00
|
|
|
|
/* Check for a colon, suggesting an IP address/port pair.
|
|
|
|
|
Do this *after* checking for all the interesting prefixes. We
|
|
|
|
|
don't want to constrain the syntax of what can follow them. */
|
|
|
|
|
else if (strchr (name, ':'))
|
|
|
|
|
ops = serial_interface_lookup ("tcp");
|
1999-04-16 09:35:26 +08:00
|
|
|
|
else
|
|
|
|
|
ops = serial_interface_lookup ("hardwire");
|
|
|
|
|
|
|
|
|
|
if (!ops)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
2001-07-09 22:38:49 +08:00
|
|
|
|
scb = XMALLOC (struct serial);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
|
|
scb->ops = ops;
|
|
|
|
|
|
|
|
|
|
scb->bufcnt = 0;
|
|
|
|
|
scb->bufp = scb->buf;
|
2007-04-08 23:20:07 +08:00
|
|
|
|
scb->error_fd = -1;
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
2007-08-09 06:12:35 +08:00
|
|
|
|
/* `...->open (...)' would get expanded by an the open(2) syscall macro. */
|
|
|
|
|
if ((*scb->ops->open) (scb, open_name))
|
1999-04-16 09:35:26 +08:00
|
|
|
|
{
|
2000-12-15 09:01:51 +08:00
|
|
|
|
xfree (scb);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2001-01-31 09:24:03 +08:00
|
|
|
|
scb->name = xstrdup (name);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
scb->next = scb_base;
|
|
|
|
|
scb->refcnt = 1;
|
1999-10-06 07:13:56 +08:00
|
|
|
|
scb->debug_p = 0;
|
|
|
|
|
scb->async_state = 0;
|
1999-09-22 11:28:34 +08:00
|
|
|
|
scb->async_handler = NULL;
|
|
|
|
|
scb->async_context = NULL;
|
1999-04-16 09:35:26 +08:00
|
|
|
|
scb_base = scb;
|
|
|
|
|
|
|
|
|
|
last_serial_opened = scb;
|
|
|
|
|
|
|
|
|
|
if (serial_logfile != NULL)
|
|
|
|
|
{
|
|
|
|
|
serial_logfp = gdb_fopen (serial_logfile, "w");
|
|
|
|
|
if (serial_logfp == NULL)
|
|
|
|
|
perror_with_name (serial_logfile);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return scb;
|
|
|
|
|
}
|
|
|
|
|
|
* NEWS: Mention native Windows support.
* Makefile.in (gdb_select_h, ser_tcp_h): New.
(ALLDEPFILES): Add ser-mingw.c.
(event-loop.o, inflow.o, mingw-hdep.o, posix-hdep.o, ser-base.o)
(ser-tcp.o, ser-unix.o): Update.
(ser-mingw.o): New rule.
* configure: Regenerated.
* configure.ac: Add ser-mingw.o for mingw32.
* ser-mingw.c: New file.
* event-loop.c: Include "gdb_select.h".
(gdb_select): Remove, moved to mingw-hdep.c and posix-hdep.c.
* ser-base.c: Include "gdb_select.h".
(ser_base_wait_for): Use gdb_select.
* serial.c (serial_for_fd): New function.
(serial_fdopen): Try "terminal" before "hardwire". Initialize
the allocated struct serial.
(serial_wait_handle): New function.
* serial.h (serial_for_fd, serial_wait_handle): New prototypes.
(struct serial_ops) [USE_WIN32API]: Add wait_handle.
* gdb_select.h: New file.
* ser-tcp.c: Include "ser-tcp.h". Remove unused "ser-unix.h" include.
(net_close, net_read_prim, net_write_prim): Make global.
(net_open): Likewise. Pass an exception set to select. Whitespace fix.
Document why we can not use gdb_select.
(_initialize_ser_tcp) [USE_WIN32API]: Do not register TCP support here.
* ser-tcp.h: New file.
* inflow.c (gdb_has_a_terminal): Don't initialize stdin_serial here.
(handle_sigio): Use gdb_select.
(initialize_stdin_serial): New function.
* terminal.h (initialize_stdin_serial): New prototype.
* top.c (gdb_init): Call initialize_stdin_serial.
* mingw-hdep.c (gdb_select): New function, moved from gdb_select in
event-loop.c. Add exception condition support. Use serial_for_fd
and serial_wait_handle. Fix timeout handling.
* posix-hdep.c: Include "gdb_select.h".
(gdb_select): New function.
* remote-st.c (connect_command): Use gdb_select.
* ser-unix.c: Include "gdb_select.h".
(hardwire_send_break, wait_for): Use gdb_select.
2006-02-11 06:01:43 +08:00
|
|
|
|
/* Return the open serial device for FD, if found, or NULL if FD
|
|
|
|
|
is not already opened. */
|
|
|
|
|
|
|
|
|
|
struct serial *
|
|
|
|
|
serial_for_fd (int fd)
|
|
|
|
|
{
|
|
|
|
|
struct serial *scb;
|
|
|
|
|
struct serial_ops *ops;
|
|
|
|
|
|
|
|
|
|
for (scb = scb_base; scb; scb = scb->next)
|
|
|
|
|
if (scb->fd == fd)
|
|
|
|
|
return scb;
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2001-07-12 01:52:32 +08:00
|
|
|
|
struct serial *
|
1999-09-22 11:28:34 +08:00
|
|
|
|
serial_fdopen (const int fd)
|
1999-04-16 09:35:26 +08:00
|
|
|
|
{
|
2001-07-12 01:52:32 +08:00
|
|
|
|
struct serial *scb;
|
1999-04-16 09:35:26 +08:00
|
|
|
|
struct serial_ops *ops;
|
|
|
|
|
|
|
|
|
|
for (scb = scb_base; scb; scb = scb->next)
|
|
|
|
|
if (scb->fd == fd)
|
|
|
|
|
{
|
|
|
|
|
scb->refcnt++;
|
|
|
|
|
return scb;
|
|
|
|
|
}
|
|
|
|
|
|
* NEWS: Mention native Windows support.
* Makefile.in (gdb_select_h, ser_tcp_h): New.
(ALLDEPFILES): Add ser-mingw.c.
(event-loop.o, inflow.o, mingw-hdep.o, posix-hdep.o, ser-base.o)
(ser-tcp.o, ser-unix.o): Update.
(ser-mingw.o): New rule.
* configure: Regenerated.
* configure.ac: Add ser-mingw.o for mingw32.
* ser-mingw.c: New file.
* event-loop.c: Include "gdb_select.h".
(gdb_select): Remove, moved to mingw-hdep.c and posix-hdep.c.
* ser-base.c: Include "gdb_select.h".
(ser_base_wait_for): Use gdb_select.
* serial.c (serial_for_fd): New function.
(serial_fdopen): Try "terminal" before "hardwire". Initialize
the allocated struct serial.
(serial_wait_handle): New function.
* serial.h (serial_for_fd, serial_wait_handle): New prototypes.
(struct serial_ops) [USE_WIN32API]: Add wait_handle.
* gdb_select.h: New file.
* ser-tcp.c: Include "ser-tcp.h". Remove unused "ser-unix.h" include.
(net_close, net_read_prim, net_write_prim): Make global.
(net_open): Likewise. Pass an exception set to select. Whitespace fix.
Document why we can not use gdb_select.
(_initialize_ser_tcp) [USE_WIN32API]: Do not register TCP support here.
* ser-tcp.h: New file.
* inflow.c (gdb_has_a_terminal): Don't initialize stdin_serial here.
(handle_sigio): Use gdb_select.
(initialize_stdin_serial): New function.
* terminal.h (initialize_stdin_serial): New prototype.
* top.c (gdb_init): Call initialize_stdin_serial.
* mingw-hdep.c (gdb_select): New function, moved from gdb_select in
event-loop.c. Add exception condition support. Use serial_for_fd
and serial_wait_handle. Fix timeout handling.
* posix-hdep.c: Include "gdb_select.h".
(gdb_select): New function.
* remote-st.c (connect_command): Use gdb_select.
* ser-unix.c: Include "gdb_select.h".
(hardwire_send_break, wait_for): Use gdb_select.
2006-02-11 06:01:43 +08:00
|
|
|
|
ops = serial_interface_lookup ("terminal");
|
|
|
|
|
if (!ops)
|
|
|
|
|
ops = serial_interface_lookup ("hardwire");
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
|
|
if (!ops)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
* NEWS: Mention native Windows support.
* Makefile.in (gdb_select_h, ser_tcp_h): New.
(ALLDEPFILES): Add ser-mingw.c.
(event-loop.o, inflow.o, mingw-hdep.o, posix-hdep.o, ser-base.o)
(ser-tcp.o, ser-unix.o): Update.
(ser-mingw.o): New rule.
* configure: Regenerated.
* configure.ac: Add ser-mingw.o for mingw32.
* ser-mingw.c: New file.
* event-loop.c: Include "gdb_select.h".
(gdb_select): Remove, moved to mingw-hdep.c and posix-hdep.c.
* ser-base.c: Include "gdb_select.h".
(ser_base_wait_for): Use gdb_select.
* serial.c (serial_for_fd): New function.
(serial_fdopen): Try "terminal" before "hardwire". Initialize
the allocated struct serial.
(serial_wait_handle): New function.
* serial.h (serial_for_fd, serial_wait_handle): New prototypes.
(struct serial_ops) [USE_WIN32API]: Add wait_handle.
* gdb_select.h: New file.
* ser-tcp.c: Include "ser-tcp.h". Remove unused "ser-unix.h" include.
(net_close, net_read_prim, net_write_prim): Make global.
(net_open): Likewise. Pass an exception set to select. Whitespace fix.
Document why we can not use gdb_select.
(_initialize_ser_tcp) [USE_WIN32API]: Do not register TCP support here.
* ser-tcp.h: New file.
* inflow.c (gdb_has_a_terminal): Don't initialize stdin_serial here.
(handle_sigio): Use gdb_select.
(initialize_stdin_serial): New function.
* terminal.h (initialize_stdin_serial): New prototype.
* top.c (gdb_init): Call initialize_stdin_serial.
* mingw-hdep.c (gdb_select): New function, moved from gdb_select in
event-loop.c. Add exception condition support. Use serial_for_fd
and serial_wait_handle. Fix timeout handling.
* posix-hdep.c: Include "gdb_select.h".
(gdb_select): New function.
* remote-st.c (connect_command): Use gdb_select.
* ser-unix.c: Include "gdb_select.h".
(hardwire_send_break, wait_for): Use gdb_select.
2006-02-11 06:01:43 +08:00
|
|
|
|
scb = XCALLOC (1, struct serial);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
|
|
scb->ops = ops;
|
|
|
|
|
|
|
|
|
|
scb->bufcnt = 0;
|
|
|
|
|
scb->bufp = scb->buf;
|
|
|
|
|
|
|
|
|
|
scb->fd = fd;
|
|
|
|
|
|
|
|
|
|
scb->name = NULL;
|
|
|
|
|
scb->next = scb_base;
|
|
|
|
|
scb->refcnt = 1;
|
1999-10-06 07:13:56 +08:00
|
|
|
|
scb->debug_p = 0;
|
|
|
|
|
scb->async_state = 0;
|
1999-09-22 11:28:34 +08:00
|
|
|
|
scb->async_handler = NULL;
|
|
|
|
|
scb->async_context = NULL;
|
1999-04-16 09:35:26 +08:00
|
|
|
|
scb_base = scb;
|
|
|
|
|
|
|
|
|
|
last_serial_opened = scb;
|
|
|
|
|
|
|
|
|
|
return scb;
|
|
|
|
|
}
|
|
|
|
|
|
1999-09-22 11:28:34 +08:00
|
|
|
|
static void
|
2001-07-12 01:52:32 +08:00
|
|
|
|
do_serial_close (struct serial *scb, int really_close)
|
1999-04-16 09:35:26 +08:00
|
|
|
|
{
|
2001-07-12 01:52:32 +08:00
|
|
|
|
struct serial *tmp_scb;
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
|
|
last_serial_opened = NULL;
|
|
|
|
|
|
|
|
|
|
if (serial_logfp)
|
|
|
|
|
{
|
|
|
|
|
fputs_unfiltered ("\nEnd of log\n", serial_logfp);
|
|
|
|
|
serial_current_type = 0;
|
|
|
|
|
|
|
|
|
|
/* XXX - What if serial_logfp == gdb_stdout or gdb_stderr? */
|
2000-02-02 08:21:19 +08:00
|
|
|
|
ui_file_delete (serial_logfp);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
serial_logfp = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* This is bogus. It's not our fault if you pass us a bad scb...! Rob, you
|
|
|
|
|
should fix your code instead. */
|
|
|
|
|
|
|
|
|
|
if (!scb)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
scb->refcnt--;
|
|
|
|
|
if (scb->refcnt > 0)
|
|
|
|
|
return;
|
|
|
|
|
|
1999-09-22 11:28:34 +08:00
|
|
|
|
/* ensure that the FD has been taken out of async mode */
|
|
|
|
|
if (scb->async_handler != NULL)
|
|
|
|
|
serial_async (scb, NULL, NULL);
|
|
|
|
|
|
1999-04-16 09:35:26 +08:00
|
|
|
|
if (really_close)
|
|
|
|
|
scb->ops->close (scb);
|
|
|
|
|
|
|
|
|
|
if (scb->name)
|
2000-12-15 09:01:51 +08:00
|
|
|
|
xfree (scb->name);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
|
|
if (scb_base == scb)
|
|
|
|
|
scb_base = scb_base->next;
|
|
|
|
|
else
|
|
|
|
|
for (tmp_scb = scb_base; tmp_scb; tmp_scb = tmp_scb->next)
|
|
|
|
|
{
|
|
|
|
|
if (tmp_scb->next != scb)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
tmp_scb->next = tmp_scb->next->next;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2000-12-15 09:01:51 +08:00
|
|
|
|
xfree (scb);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
}
|
|
|
|
|
|
1999-09-22 11:28:34 +08:00
|
|
|
|
void
|
2001-07-12 01:52:32 +08:00
|
|
|
|
serial_close (struct serial *scb)
|
1999-09-22 11:28:34 +08:00
|
|
|
|
{
|
|
|
|
|
do_serial_close (scb, 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2001-07-12 01:52:32 +08:00
|
|
|
|
serial_un_fdopen (struct serial *scb)
|
1999-09-22 11:28:34 +08:00
|
|
|
|
{
|
|
|
|
|
do_serial_close (scb, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
2001-07-12 01:52:32 +08:00
|
|
|
|
serial_readchar (struct serial *scb, int timeout)
|
1999-09-22 11:28:34 +08:00
|
|
|
|
{
|
|
|
|
|
int ch;
|
|
|
|
|
|
1999-10-12 12:37:53 +08:00
|
|
|
|
/* FIXME: cagney/1999-10-11: Don't enable this check until the ASYNC
|
|
|
|
|
code is finished. */
|
2001-07-16 04:34:14 +08:00
|
|
|
|
if (0 && serial_is_async_p (scb) && timeout < 0)
|
2001-02-08 14:03:54 +08:00
|
|
|
|
internal_error (__FILE__, __LINE__,
|
2005-02-11 Andrew Cagney <cagney@gnu.org>
Mark up error_no_arg, query, perror_with_name, complaint, and
internal_error.
* breakpoint.c, cp-abi.c, cp-namespace.c, cp-support.c: Update.
* cris-tdep.c, dbxread.c, dictionary.c, dsrec.c: Update.
* dummy-frame.c, dve3900-rom.c, dwarf2-frame.c, dwarf2expr.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, event-loop.c: Update.
* exceptions.c, exec.c, f-lang.c, findvar.c, fork-child.c: Update.
* frame-unwind.c, frame.c, frv-linux-tdep.c, frv-tdep.c: Update.
* gdb_assert.h, gdbarch.c, gdbtypes.c, gnu-nat.c: Update.
* go32-nat.c, hppa-tdep.c, hppabsd-nat.c, hpread.c: Update.
* i386-linux-nat.c, i386-nat.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386fbsd-nat.c, inf-ptrace.c, inf-ttrace.c, infcall.c: Update.
* infcmd.c, inflow.c, infptrace.c, infrun.c, inftarg.c: Update.
* interps.c, language.c, linespec.c, linux-nat.c: Update.
* m32r-linux-nat.c, m68k-tdep.c, m68kbsd-nat.c: Update.
* m68klinux-nat.c, m88kbsd-nat.c, macroexp.c, macroscope.c: Update.
* macrotab.c, maint.c, mdebugread.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mips64obsd-nat.c: Update.
* mipsnbsd-nat.c, mn10300-tdep.c, monitor.c, nto-procfs.c: Update.
* objc-lang.c, objfiles.c, objfiles.h, ocd.c, osabi.c: Update.
* parse.c, ppc-bdm.c, ppc-linux-nat.c, ppc-sysv-tdep.c: Update.
* ppcnbsd-nat.c, ppcobsd-nat.c, printcmd.c, procfs.c: Update.
* regcache.c, reggroups.c, remote-e7000.c, remote-mips.c: Update.
* remote-rdp.c, remote-sds.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote.c, rs6000-nat.c, rs6000-tdep.c: Update.
* s390-nat.c, s390-tdep.c, sentinel-frame.c, serial.c: Update.
* sh-tdep.c, sh3-rom.c, sh64-tdep.c, shnbsd-nat.c: Update.
* solib-aix5.c, solib-svr4.c, solib.c, source.c: Update.
* sparc-nat.c, stabsread.c, stack.c, symfile.c, symtab.c: Update.
* symtab.h, target.c, tracepoint.c, ui-file.c, ui-out.c: Update.
* utils.c, valops.c, valprint.c, vax-nat.c, vaxbsd-nat.c: Update.
* win32-nat.c, xcoffread.c, xstormy16-tdep.c: Update.
* cli/cli-cmds.c, cli/cli-logging.c, cli/cli-script.c: Update.
* cli/cli-setshow.c, mi/mi-cmd-break.c, mi/mi-cmds.c: Update.
* mi/mi-console.c, mi/mi-getopt.c, mi/mi-out.c: Update.
* tui/tui-file.c, tui/tui-interp.c: Update.
2005-02-12 02:13:55 +08:00
|
|
|
|
_("serial_readchar: blocking read in async mode"));
|
1999-10-12 12:37:53 +08:00
|
|
|
|
|
1999-09-22 11:28:34 +08:00
|
|
|
|
ch = scb->ops->readchar (scb, timeout);
|
|
|
|
|
if (serial_logfp != NULL)
|
|
|
|
|
{
|
1999-10-06 07:13:56 +08:00
|
|
|
|
serial_logchar (serial_logfp, 'r', ch, timeout);
|
1999-09-22 11:28:34 +08:00
|
|
|
|
|
|
|
|
|
/* Make sure that the log file is as up-to-date as possible,
|
|
|
|
|
in case we are getting ready to dump core or something. */
|
|
|
|
|
gdb_flush (serial_logfp);
|
|
|
|
|
}
|
2001-07-16 04:34:14 +08:00
|
|
|
|
if (serial_debug_p (scb))
|
1999-10-06 07:13:56 +08:00
|
|
|
|
{
|
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "[");
|
|
|
|
|
serial_logchar (gdb_stdlog, 'r', ch, timeout);
|
|
|
|
|
fprintf_unfiltered (gdb_stdlog, "]");
|
|
|
|
|
gdb_flush (gdb_stdlog);
|
|
|
|
|
}
|
1999-09-22 11:28:34 +08:00
|
|
|
|
|
|
|
|
|
return (ch);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
2001-07-12 01:52:32 +08:00
|
|
|
|
serial_write (struct serial *scb, const char *str, int len)
|
1999-09-22 11:28:34 +08:00
|
|
|
|
{
|
|
|
|
|
if (serial_logfp != NULL)
|
|
|
|
|
{
|
|
|
|
|
int count;
|
|
|
|
|
|
|
|
|
|
for (count = 0; count < len; count++)
|
1999-10-06 07:13:56 +08:00
|
|
|
|
serial_logchar (serial_logfp, 'w', str[count] & 0xff, 0);
|
1999-09-22 11:28:34 +08:00
|
|
|
|
|
|
|
|
|
/* Make sure that the log file is as up-to-date as possible,
|
|
|
|
|
in case we are getting ready to dump core or something. */
|
|
|
|
|
gdb_flush (serial_logfp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (scb->ops->write (scb, str, len));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2001-07-12 01:52:32 +08:00
|
|
|
|
serial_printf (struct serial *desc, const char *format,...)
|
1999-09-22 11:28:34 +08:00
|
|
|
|
{
|
|
|
|
|
va_list args;
|
|
|
|
|
char *buf;
|
|
|
|
|
va_start (args, format);
|
|
|
|
|
|
2004-06-29 22:57:39 +08:00
|
|
|
|
buf = xstrvprintf (format, args);
|
2001-07-16 04:34:14 +08:00
|
|
|
|
serial_write (desc, buf, strlen (buf));
|
1999-09-22 11:28:34 +08:00
|
|
|
|
|
2000-12-15 09:01:51 +08:00
|
|
|
|
xfree (buf);
|
1999-09-22 11:28:34 +08:00
|
|
|
|
va_end (args);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
2001-07-12 01:52:32 +08:00
|
|
|
|
serial_drain_output (struct serial *scb)
|
1999-09-22 11:28:34 +08:00
|
|
|
|
{
|
|
|
|
|
return scb->ops->drain_output (scb);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
2001-07-12 01:52:32 +08:00
|
|
|
|
serial_flush_output (struct serial *scb)
|
1999-09-22 11:28:34 +08:00
|
|
|
|
{
|
|
|
|
|
return scb->ops->flush_output (scb);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
2001-07-12 01:52:32 +08:00
|
|
|
|
serial_flush_input (struct serial *scb)
|
1999-09-22 11:28:34 +08:00
|
|
|
|
{
|
|
|
|
|
return scb->ops->flush_input (scb);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
2001-07-12 01:52:32 +08:00
|
|
|
|
serial_send_break (struct serial *scb)
|
1999-09-22 11:28:34 +08:00
|
|
|
|
{
|
|
|
|
|
if (serial_logfp != NULL)
|
1999-10-06 07:13:56 +08:00
|
|
|
|
serial_logchar (serial_logfp, 'w', SERIAL_BREAK, 0);
|
1999-09-22 11:28:34 +08:00
|
|
|
|
|
|
|
|
|
return (scb->ops->send_break (scb));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2001-07-12 01:52:32 +08:00
|
|
|
|
serial_raw (struct serial *scb)
|
1999-09-22 11:28:34 +08:00
|
|
|
|
{
|
|
|
|
|
scb->ops->go_raw (scb);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
serial_ttystate
|
2001-07-12 01:52:32 +08:00
|
|
|
|
serial_get_tty_state (struct serial *scb)
|
1999-09-22 11:28:34 +08:00
|
|
|
|
{
|
|
|
|
|
return scb->ops->get_tty_state (scb);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
2001-07-12 01:52:32 +08:00
|
|
|
|
serial_set_tty_state (struct serial *scb, serial_ttystate ttystate)
|
1999-09-22 11:28:34 +08:00
|
|
|
|
{
|
|
|
|
|
return scb->ops->set_tty_state (scb, ttystate);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2001-07-12 01:52:32 +08:00
|
|
|
|
serial_print_tty_state (struct serial *scb,
|
1999-09-22 11:28:34 +08:00
|
|
|
|
serial_ttystate ttystate,
|
2000-02-02 08:21:19 +08:00
|
|
|
|
struct ui_file *stream)
|
1999-09-22 11:28:34 +08:00
|
|
|
|
{
|
|
|
|
|
scb->ops->print_tty_state (scb, ttystate, stream);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
2001-07-12 01:52:32 +08:00
|
|
|
|
serial_noflush_set_tty_state (struct serial *scb,
|
1999-09-22 11:28:34 +08:00
|
|
|
|
serial_ttystate new_ttystate,
|
|
|
|
|
serial_ttystate old_ttystate)
|
|
|
|
|
{
|
|
|
|
|
return scb->ops->noflush_set_tty_state (scb, new_ttystate, old_ttystate);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
2001-07-12 01:52:32 +08:00
|
|
|
|
serial_setbaudrate (struct serial *scb, int rate)
|
1999-09-22 11:28:34 +08:00
|
|
|
|
{
|
|
|
|
|
return scb->ops->setbaudrate (scb, rate);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
2001-07-12 01:52:32 +08:00
|
|
|
|
serial_setstopbits (struct serial *scb, int num)
|
1999-09-22 11:28:34 +08:00
|
|
|
|
{
|
|
|
|
|
return scb->ops->setstopbits (scb, num);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
2001-07-12 01:52:32 +08:00
|
|
|
|
serial_can_async_p (struct serial *scb)
|
1999-09-22 11:28:34 +08:00
|
|
|
|
{
|
|
|
|
|
return (scb->ops->async != NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
2001-07-12 01:52:32 +08:00
|
|
|
|
serial_is_async_p (struct serial *scb)
|
1999-09-22 11:28:34 +08:00
|
|
|
|
{
|
|
|
|
|
return (scb->ops->async != NULL) && (scb->async_handler != NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2001-07-12 01:52:32 +08:00
|
|
|
|
serial_async (struct serial *scb,
|
1999-09-22 11:28:34 +08:00
|
|
|
|
serial_event_ftype *handler,
|
|
|
|
|
void *context)
|
|
|
|
|
{
|
2008-02-24 04:04:20 +08:00
|
|
|
|
int changed = ((scb->async_handler == NULL) != (handler == NULL));
|
1999-09-22 11:28:34 +08:00
|
|
|
|
scb->async_handler = handler;
|
|
|
|
|
scb->async_context = context;
|
2008-02-24 04:04:20 +08:00
|
|
|
|
/* Only change mode if there is a need. */
|
|
|
|
|
if (changed)
|
|
|
|
|
scb->ops->async (scb, handler != NULL);
|
1999-09-22 11:28:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
2001-07-12 01:52:32 +08:00
|
|
|
|
deprecated_serial_fd (struct serial *scb)
|
1999-09-22 11:28:34 +08:00
|
|
|
|
{
|
|
|
|
|
/* FIXME: should this output a warning that deprecated code is being
|
|
|
|
|
called? */
|
|
|
|
|
if (scb->fd < 0)
|
|
|
|
|
{
|
2001-02-08 14:03:54 +08:00
|
|
|
|
internal_error (__FILE__, __LINE__,
|
2005-02-11 Andrew Cagney <cagney@gnu.org>
Mark up error_no_arg, query, perror_with_name, complaint, and
internal_error.
* breakpoint.c, cp-abi.c, cp-namespace.c, cp-support.c: Update.
* cris-tdep.c, dbxread.c, dictionary.c, dsrec.c: Update.
* dummy-frame.c, dve3900-rom.c, dwarf2-frame.c, dwarf2expr.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, event-loop.c: Update.
* exceptions.c, exec.c, f-lang.c, findvar.c, fork-child.c: Update.
* frame-unwind.c, frame.c, frv-linux-tdep.c, frv-tdep.c: Update.
* gdb_assert.h, gdbarch.c, gdbtypes.c, gnu-nat.c: Update.
* go32-nat.c, hppa-tdep.c, hppabsd-nat.c, hpread.c: Update.
* i386-linux-nat.c, i386-nat.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386fbsd-nat.c, inf-ptrace.c, inf-ttrace.c, infcall.c: Update.
* infcmd.c, inflow.c, infptrace.c, infrun.c, inftarg.c: Update.
* interps.c, language.c, linespec.c, linux-nat.c: Update.
* m32r-linux-nat.c, m68k-tdep.c, m68kbsd-nat.c: Update.
* m68klinux-nat.c, m88kbsd-nat.c, macroexp.c, macroscope.c: Update.
* macrotab.c, maint.c, mdebugread.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mips64obsd-nat.c: Update.
* mipsnbsd-nat.c, mn10300-tdep.c, monitor.c, nto-procfs.c: Update.
* objc-lang.c, objfiles.c, objfiles.h, ocd.c, osabi.c: Update.
* parse.c, ppc-bdm.c, ppc-linux-nat.c, ppc-sysv-tdep.c: Update.
* ppcnbsd-nat.c, ppcobsd-nat.c, printcmd.c, procfs.c: Update.
* regcache.c, reggroups.c, remote-e7000.c, remote-mips.c: Update.
* remote-rdp.c, remote-sds.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote.c, rs6000-nat.c, rs6000-tdep.c: Update.
* s390-nat.c, s390-tdep.c, sentinel-frame.c, serial.c: Update.
* sh-tdep.c, sh3-rom.c, sh64-tdep.c, shnbsd-nat.c: Update.
* solib-aix5.c, solib-svr4.c, solib.c, source.c: Update.
* sparc-nat.c, stabsread.c, stack.c, symfile.c, symtab.c: Update.
* symtab.h, target.c, tracepoint.c, ui-file.c, ui-out.c: Update.
* utils.c, valops.c, valprint.c, vax-nat.c, vaxbsd-nat.c: Update.
* win32-nat.c, xcoffread.c, xstormy16-tdep.c: Update.
* cli/cli-cmds.c, cli/cli-logging.c, cli/cli-script.c: Update.
* cli/cli-setshow.c, mi/mi-cmd-break.c, mi/mi-cmds.c: Update.
* mi/mi-console.c, mi/mi-getopt.c, mi/mi-out.c: Update.
* tui/tui-file.c, tui/tui-interp.c: Update.
2005-02-12 02:13:55 +08:00
|
|
|
|
_("serial: FD not valid"));
|
1999-09-22 11:28:34 +08:00
|
|
|
|
}
|
|
|
|
|
return scb->fd; /* sigh */
|
|
|
|
|
}
|
|
|
|
|
|
1999-10-06 07:13:56 +08:00
|
|
|
|
void
|
2001-07-12 01:52:32 +08:00
|
|
|
|
serial_debug (struct serial *scb, int debug_p)
|
1999-10-06 07:13:56 +08:00
|
|
|
|
{
|
|
|
|
|
scb->debug_p = debug_p;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
2001-07-12 01:52:32 +08:00
|
|
|
|
serial_debug_p (struct serial *scb)
|
1999-10-06 07:13:56 +08:00
|
|
|
|
{
|
|
|
|
|
return scb->debug_p || global_serial_debug_p;
|
|
|
|
|
}
|
|
|
|
|
|
* NEWS: Mention native Windows support.
* Makefile.in (gdb_select_h, ser_tcp_h): New.
(ALLDEPFILES): Add ser-mingw.c.
(event-loop.o, inflow.o, mingw-hdep.o, posix-hdep.o, ser-base.o)
(ser-tcp.o, ser-unix.o): Update.
(ser-mingw.o): New rule.
* configure: Regenerated.
* configure.ac: Add ser-mingw.o for mingw32.
* ser-mingw.c: New file.
* event-loop.c: Include "gdb_select.h".
(gdb_select): Remove, moved to mingw-hdep.c and posix-hdep.c.
* ser-base.c: Include "gdb_select.h".
(ser_base_wait_for): Use gdb_select.
* serial.c (serial_for_fd): New function.
(serial_fdopen): Try "terminal" before "hardwire". Initialize
the allocated struct serial.
(serial_wait_handle): New function.
* serial.h (serial_for_fd, serial_wait_handle): New prototypes.
(struct serial_ops) [USE_WIN32API]: Add wait_handle.
* gdb_select.h: New file.
* ser-tcp.c: Include "ser-tcp.h". Remove unused "ser-unix.h" include.
(net_close, net_read_prim, net_write_prim): Make global.
(net_open): Likewise. Pass an exception set to select. Whitespace fix.
Document why we can not use gdb_select.
(_initialize_ser_tcp) [USE_WIN32API]: Do not register TCP support here.
* ser-tcp.h: New file.
* inflow.c (gdb_has_a_terminal): Don't initialize stdin_serial here.
(handle_sigio): Use gdb_select.
(initialize_stdin_serial): New function.
* terminal.h (initialize_stdin_serial): New prototype.
* top.c (gdb_init): Call initialize_stdin_serial.
* mingw-hdep.c (gdb_select): New function, moved from gdb_select in
event-loop.c. Add exception condition support. Use serial_for_fd
and serial_wait_handle. Fix timeout handling.
* posix-hdep.c: Include "gdb_select.h".
(gdb_select): New function.
* remote-st.c (connect_command): Use gdb_select.
* ser-unix.c: Include "gdb_select.h".
(hardwire_send_break, wait_for): Use gdb_select.
2006-02-11 06:01:43 +08:00
|
|
|
|
#ifdef USE_WIN32API
|
|
|
|
|
void
|
|
|
|
|
serial_wait_handle (struct serial *scb, HANDLE *read, HANDLE *except)
|
|
|
|
|
{
|
|
|
|
|
if (scb->ops->wait_handle)
|
|
|
|
|
scb->ops->wait_handle (scb, read, except);
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
*read = (HANDLE) _get_osfhandle (scb->fd);
|
|
|
|
|
*except = NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
2006-04-25 05:00:13 +08:00
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
serial_done_wait_handle (struct serial *scb)
|
|
|
|
|
{
|
|
|
|
|
if (scb->ops->done_wait_handle)
|
|
|
|
|
scb->ops->done_wait_handle (scb);
|
|
|
|
|
}
|
* NEWS: Mention native Windows support.
* Makefile.in (gdb_select_h, ser_tcp_h): New.
(ALLDEPFILES): Add ser-mingw.c.
(event-loop.o, inflow.o, mingw-hdep.o, posix-hdep.o, ser-base.o)
(ser-tcp.o, ser-unix.o): Update.
(ser-mingw.o): New rule.
* configure: Regenerated.
* configure.ac: Add ser-mingw.o for mingw32.
* ser-mingw.c: New file.
* event-loop.c: Include "gdb_select.h".
(gdb_select): Remove, moved to mingw-hdep.c and posix-hdep.c.
* ser-base.c: Include "gdb_select.h".
(ser_base_wait_for): Use gdb_select.
* serial.c (serial_for_fd): New function.
(serial_fdopen): Try "terminal" before "hardwire". Initialize
the allocated struct serial.
(serial_wait_handle): New function.
* serial.h (serial_for_fd, serial_wait_handle): New prototypes.
(struct serial_ops) [USE_WIN32API]: Add wait_handle.
* gdb_select.h: New file.
* ser-tcp.c: Include "ser-tcp.h". Remove unused "ser-unix.h" include.
(net_close, net_read_prim, net_write_prim): Make global.
(net_open): Likewise. Pass an exception set to select. Whitespace fix.
Document why we can not use gdb_select.
(_initialize_ser_tcp) [USE_WIN32API]: Do not register TCP support here.
* ser-tcp.h: New file.
* inflow.c (gdb_has_a_terminal): Don't initialize stdin_serial here.
(handle_sigio): Use gdb_select.
(initialize_stdin_serial): New function.
* terminal.h (initialize_stdin_serial): New prototype.
* top.c (gdb_init): Call initialize_stdin_serial.
* mingw-hdep.c (gdb_select): New function, moved from gdb_select in
event-loop.c. Add exception condition support. Use serial_for_fd
and serial_wait_handle. Fix timeout handling.
* posix-hdep.c: Include "gdb_select.h".
(gdb_select): New function.
* remote-st.c (connect_command): Use gdb_select.
* ser-unix.c: Include "gdb_select.h".
(hardwire_send_break, wait_for): Use gdb_select.
2006-02-11 06:01:43 +08:00
|
|
|
|
#endif
|
1999-10-06 07:13:56 +08:00
|
|
|
|
|
1999-04-16 09:35:26 +08:00
|
|
|
|
#if 0
|
2001-07-12 01:52:32 +08:00
|
|
|
|
/* The connect command is #if 0 because I hadn't thought of an elegant
|
|
|
|
|
way to wait for I/O on two `struct serial *'s simultaneously. Two
|
|
|
|
|
solutions came to mind:
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
1999-07-08 04:19:36 +08:00
|
|
|
|
1) Fork, and have have one fork handle the to user direction,
|
|
|
|
|
and have the other hand the to target direction. This
|
|
|
|
|
obviously won't cut it for MSDOS.
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
1999-07-08 04:19:36 +08:00
|
|
|
|
2) Use something like select. This assumes that stdin and
|
|
|
|
|
the target side can both be waited on via the same
|
|
|
|
|
mechanism. This may not be true for DOS, if GDB is
|
|
|
|
|
talking to the target via a TCP socket.
|
2001-07-12 01:52:32 +08:00
|
|
|
|
-grossman, 8 Jun 93 */
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
|
|
/* Connect the user directly to the remote system. This command acts just like
|
|
|
|
|
the 'cu' or 'tip' command. Use <CR>~. or <CR>~^D to break out. */
|
|
|
|
|
|
2001-07-12 01:52:32 +08:00
|
|
|
|
static struct serial *tty_desc; /* Controlling terminal */
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
|
|
static void
|
1999-09-22 11:28:34 +08:00
|
|
|
|
cleanup_tty (serial_ttystate ttystate)
|
1999-04-16 09:35:26 +08:00
|
|
|
|
{
|
|
|
|
|
printf_unfiltered ("\r\n[Exiting connect mode]\r\n");
|
2001-07-16 04:34:14 +08:00
|
|
|
|
serial_set_tty_state (tty_desc, ttystate);
|
2000-12-15 09:01:51 +08:00
|
|
|
|
xfree (ttystate);
|
2001-07-16 04:34:14 +08:00
|
|
|
|
serial_close (tty_desc);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
1999-09-22 11:28:34 +08:00
|
|
|
|
connect_command (char *args, int fromtty)
|
1999-04-16 09:35:26 +08:00
|
|
|
|
{
|
|
|
|
|
int c;
|
|
|
|
|
char cur_esc = 0;
|
|
|
|
|
serial_ttystate ttystate;
|
2001-07-12 01:52:32 +08:00
|
|
|
|
struct serial *port_desc; /* TTY port */
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
1999-07-08 04:19:36 +08:00
|
|
|
|
dont_repeat ();
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
|
|
if (args)
|
1999-07-08 04:19:36 +08:00
|
|
|
|
fprintf_unfiltered (gdb_stderr, "This command takes no args. They have been ignored.\n");
|
|
|
|
|
|
|
|
|
|
printf_unfiltered ("[Entering connect mode. Use ~. or ~^D to escape]\n");
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
2001-07-16 04:34:14 +08:00
|
|
|
|
tty_desc = serial_fdopen (0);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
port_desc = last_serial_opened;
|
|
|
|
|
|
2001-07-16 04:34:14 +08:00
|
|
|
|
ttystate = serial_get_tty_state (tty_desc);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
2001-07-16 04:34:14 +08:00
|
|
|
|
serial_raw (tty_desc);
|
|
|
|
|
serial_raw (port_desc);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
|
|
make_cleanup (cleanup_tty, ttystate);
|
|
|
|
|
|
|
|
|
|
while (1)
|
|
|
|
|
{
|
|
|
|
|
int mask;
|
|
|
|
|
|
2001-07-16 04:34:14 +08:00
|
|
|
|
mask = serial_wait_2 (tty_desc, port_desc, -1);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
|
|
if (mask & 2)
|
|
|
|
|
{ /* tty input */
|
|
|
|
|
char cx;
|
|
|
|
|
|
|
|
|
|
while (1)
|
|
|
|
|
{
|
2001-07-16 04:34:14 +08:00
|
|
|
|
c = serial_readchar (tty_desc, 0);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
|
|
if (c == SERIAL_TIMEOUT)
|
1999-07-08 04:19:36 +08:00
|
|
|
|
break;
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
|
|
if (c < 0)
|
2005-02-11 Andrew Cagney <cagney@gnu.org>
Mark up error_no_arg, query, perror_with_name, complaint, and
internal_error.
* breakpoint.c, cp-abi.c, cp-namespace.c, cp-support.c: Update.
* cris-tdep.c, dbxread.c, dictionary.c, dsrec.c: Update.
* dummy-frame.c, dve3900-rom.c, dwarf2-frame.c, dwarf2expr.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, event-loop.c: Update.
* exceptions.c, exec.c, f-lang.c, findvar.c, fork-child.c: Update.
* frame-unwind.c, frame.c, frv-linux-tdep.c, frv-tdep.c: Update.
* gdb_assert.h, gdbarch.c, gdbtypes.c, gnu-nat.c: Update.
* go32-nat.c, hppa-tdep.c, hppabsd-nat.c, hpread.c: Update.
* i386-linux-nat.c, i386-nat.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386fbsd-nat.c, inf-ptrace.c, inf-ttrace.c, infcall.c: Update.
* infcmd.c, inflow.c, infptrace.c, infrun.c, inftarg.c: Update.
* interps.c, language.c, linespec.c, linux-nat.c: Update.
* m32r-linux-nat.c, m68k-tdep.c, m68kbsd-nat.c: Update.
* m68klinux-nat.c, m88kbsd-nat.c, macroexp.c, macroscope.c: Update.
* macrotab.c, maint.c, mdebugread.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mips64obsd-nat.c: Update.
* mipsnbsd-nat.c, mn10300-tdep.c, monitor.c, nto-procfs.c: Update.
* objc-lang.c, objfiles.c, objfiles.h, ocd.c, osabi.c: Update.
* parse.c, ppc-bdm.c, ppc-linux-nat.c, ppc-sysv-tdep.c: Update.
* ppcnbsd-nat.c, ppcobsd-nat.c, printcmd.c, procfs.c: Update.
* regcache.c, reggroups.c, remote-e7000.c, remote-mips.c: Update.
* remote-rdp.c, remote-sds.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote.c, rs6000-nat.c, rs6000-tdep.c: Update.
* s390-nat.c, s390-tdep.c, sentinel-frame.c, serial.c: Update.
* sh-tdep.c, sh3-rom.c, sh64-tdep.c, shnbsd-nat.c: Update.
* solib-aix5.c, solib-svr4.c, solib.c, source.c: Update.
* sparc-nat.c, stabsread.c, stack.c, symfile.c, symtab.c: Update.
* symtab.h, target.c, tracepoint.c, ui-file.c, ui-out.c: Update.
* utils.c, valops.c, valprint.c, vax-nat.c, vaxbsd-nat.c: Update.
* win32-nat.c, xcoffread.c, xstormy16-tdep.c: Update.
* cli/cli-cmds.c, cli/cli-logging.c, cli/cli-script.c: Update.
* cli/cli-setshow.c, mi/mi-cmd-break.c, mi/mi-cmds.c: Update.
* mi/mi-console.c, mi/mi-getopt.c, mi/mi-out.c: Update.
* tui/tui-file.c, tui/tui-interp.c: Update.
2005-02-12 02:13:55 +08:00
|
|
|
|
perror_with_name (_("connect"));
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
|
|
cx = c;
|
2001-07-16 04:34:14 +08:00
|
|
|
|
serial_write (port_desc, &cx, 1);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
|
|
switch (cur_esc)
|
|
|
|
|
{
|
|
|
|
|
case 0:
|
|
|
|
|
if (c == '\r')
|
|
|
|
|
cur_esc = c;
|
|
|
|
|
break;
|
|
|
|
|
case '\r':
|
|
|
|
|
if (c == '~')
|
|
|
|
|
cur_esc = c;
|
|
|
|
|
else
|
|
|
|
|
cur_esc = 0;
|
|
|
|
|
break;
|
|
|
|
|
case '~':
|
|
|
|
|
if (c == '.' || c == '\004')
|
|
|
|
|
return;
|
|
|
|
|
else
|
|
|
|
|
cur_esc = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (mask & 1)
|
|
|
|
|
{ /* Port input */
|
|
|
|
|
char cx;
|
|
|
|
|
|
|
|
|
|
while (1)
|
|
|
|
|
{
|
2001-07-16 04:34:14 +08:00
|
|
|
|
c = serial_readchar (port_desc, 0);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
|
|
if (c == SERIAL_TIMEOUT)
|
1999-07-08 04:19:36 +08:00
|
|
|
|
break;
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
|
|
if (c < 0)
|
2005-02-11 Andrew Cagney <cagney@gnu.org>
Mark up error_no_arg, query, perror_with_name, complaint, and
internal_error.
* breakpoint.c, cp-abi.c, cp-namespace.c, cp-support.c: Update.
* cris-tdep.c, dbxread.c, dictionary.c, dsrec.c: Update.
* dummy-frame.c, dve3900-rom.c, dwarf2-frame.c, dwarf2expr.c: Update.
* dwarf2read.c, dwarfread.c, elfread.c, event-loop.c: Update.
* exceptions.c, exec.c, f-lang.c, findvar.c, fork-child.c: Update.
* frame-unwind.c, frame.c, frv-linux-tdep.c, frv-tdep.c: Update.
* gdb_assert.h, gdbarch.c, gdbtypes.c, gnu-nat.c: Update.
* go32-nat.c, hppa-tdep.c, hppabsd-nat.c, hpread.c: Update.
* i386-linux-nat.c, i386-nat.c, i386-tdep.c, i386bsd-nat.c: Update.
* i386fbsd-nat.c, inf-ptrace.c, inf-ttrace.c, infcall.c: Update.
* infcmd.c, inflow.c, infptrace.c, infrun.c, inftarg.c: Update.
* interps.c, language.c, linespec.c, linux-nat.c: Update.
* m32r-linux-nat.c, m68k-tdep.c, m68kbsd-nat.c: Update.
* m68klinux-nat.c, m88kbsd-nat.c, macroexp.c, macroscope.c: Update.
* macrotab.c, maint.c, mdebugread.c, memattr.c: Update.
* mips-linux-tdep.c, mips-tdep.c, mips64obsd-nat.c: Update.
* mipsnbsd-nat.c, mn10300-tdep.c, monitor.c, nto-procfs.c: Update.
* objc-lang.c, objfiles.c, objfiles.h, ocd.c, osabi.c: Update.
* parse.c, ppc-bdm.c, ppc-linux-nat.c, ppc-sysv-tdep.c: Update.
* ppcnbsd-nat.c, ppcobsd-nat.c, printcmd.c, procfs.c: Update.
* regcache.c, reggroups.c, remote-e7000.c, remote-mips.c: Update.
* remote-rdp.c, remote-sds.c, remote-sim.c, remote-st.c: Update.
* remote-utils.c, remote.c, rs6000-nat.c, rs6000-tdep.c: Update.
* s390-nat.c, s390-tdep.c, sentinel-frame.c, serial.c: Update.
* sh-tdep.c, sh3-rom.c, sh64-tdep.c, shnbsd-nat.c: Update.
* solib-aix5.c, solib-svr4.c, solib.c, source.c: Update.
* sparc-nat.c, stabsread.c, stack.c, symfile.c, symtab.c: Update.
* symtab.h, target.c, tracepoint.c, ui-file.c, ui-out.c: Update.
* utils.c, valops.c, valprint.c, vax-nat.c, vaxbsd-nat.c: Update.
* win32-nat.c, xcoffread.c, xstormy16-tdep.c: Update.
* cli/cli-cmds.c, cli/cli-logging.c, cli/cli-script.c: Update.
* cli/cli-setshow.c, mi/mi-cmd-break.c, mi/mi-cmds.c: Update.
* mi/mi-console.c, mi/mi-getopt.c, mi/mi-out.c: Update.
* tui/tui-file.c, tui/tui-interp.c: Update.
2005-02-12 02:13:55 +08:00
|
|
|
|
perror_with_name (_("connect"));
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
|
|
cx = c;
|
|
|
|
|
|
2001-07-16 04:34:14 +08:00
|
|
|
|
serial_write (tty_desc, &cx, 1);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif /* 0 */
|
|
|
|
|
|
2001-09-27 07:27:39 +08:00
|
|
|
|
/* Serial set/show framework. */
|
|
|
|
|
|
|
|
|
|
static struct cmd_list_element *serial_set_cmdlist;
|
|
|
|
|
static struct cmd_list_element *serial_show_cmdlist;
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
serial_set_cmd (char *args, int from_tty)
|
|
|
|
|
{
|
|
|
|
|
printf_unfiltered ("\"set serial\" must be followed by the name of a command.\n");
|
|
|
|
|
help_list (serial_set_cmdlist, "set serial ", -1, gdb_stdout);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
serial_show_cmd (char *args, int from_tty)
|
|
|
|
|
{
|
|
|
|
|
cmd_show_list (serial_show_cmdlist, from_tty, "");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
1999-04-16 09:35:26 +08:00
|
|
|
|
void
|
1999-09-22 11:28:34 +08:00
|
|
|
|
_initialize_serial (void)
|
1999-04-16 09:35:26 +08:00
|
|
|
|
{
|
|
|
|
|
#if 0
|
2005-02-15 Andrew Cagney <cagney@gnu.org>
Mark up add_com, add_info and add_prefix_cmd.
* breakpoint.c, cp-support.c, dcache.c, dwarf2read.c: Update.
* exec.c, f-valprint.c, frame.c, gcore.c, gnu-nat.c: Update.
* go32-nat.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* kod.c, language.c, linux-nat.c, m32r-rom.c, macrocmd.c: Update.
* maint.c, memattr.c, mips-tdep.c, nto-procfs.c, objc-lang.c: Update.
* ocd.c, pa64solib.c, printcmd.c, procfs.c, regcache.c: Update.
* remote-e7000.c, remote-m32r-sdi.c, remote-mips.c: Update.
* remote-sds.c, remote-sim.c, remote-st.c, remote-utils.c: Update.
* remote.c, rs6000-tdep.c, ser-go32.c, serial.c: Update.
* sh-tdep.c, solib.c, somsolib.c, source.c, stack.c: Update.
* symfile.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, typeprint.c, utils.c, valprint.c: Update.
* win32-nat.c, xcoffsolib.c, cli/cli-cmds.c, cli/cli-dump.c: Update.
* cli/cli-logging.c, tui/tui-layout.c, tui/tui-regs.c: Update.
* tui/tui-stack.c, tui/tui-win.c: Update.
2005-02-15 23:49:28 +08:00
|
|
|
|
add_com ("connect", class_obscure, connect_command, _("\
|
|
|
|
|
Connect the terminal directly up to the command monitor.\n\
|
|
|
|
|
Use <CR>~. or <CR>~^D to break out."));
|
1999-04-16 09:35:26 +08:00
|
|
|
|
#endif /* 0 */
|
|
|
|
|
|
2005-02-15 Andrew Cagney <cagney@gnu.org>
Mark up add_com, add_info and add_prefix_cmd.
* breakpoint.c, cp-support.c, dcache.c, dwarf2read.c: Update.
* exec.c, f-valprint.c, frame.c, gcore.c, gnu-nat.c: Update.
* go32-nat.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* kod.c, language.c, linux-nat.c, m32r-rom.c, macrocmd.c: Update.
* maint.c, memattr.c, mips-tdep.c, nto-procfs.c, objc-lang.c: Update.
* ocd.c, pa64solib.c, printcmd.c, procfs.c, regcache.c: Update.
* remote-e7000.c, remote-m32r-sdi.c, remote-mips.c: Update.
* remote-sds.c, remote-sim.c, remote-st.c, remote-utils.c: Update.
* remote.c, rs6000-tdep.c, ser-go32.c, serial.c: Update.
* sh-tdep.c, solib.c, somsolib.c, source.c, stack.c: Update.
* symfile.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, typeprint.c, utils.c, valprint.c: Update.
* win32-nat.c, xcoffsolib.c, cli/cli-cmds.c, cli/cli-dump.c: Update.
* cli/cli-logging.c, tui/tui-layout.c, tui/tui-regs.c: Update.
* tui/tui-stack.c, tui/tui-win.c: Update.
2005-02-15 23:49:28 +08:00
|
|
|
|
add_prefix_cmd ("serial", class_maintenance, serial_set_cmd, _("\
|
|
|
|
|
Set default serial/parallel port configuration."),
|
2001-09-27 07:27:39 +08:00
|
|
|
|
&serial_set_cmdlist, "set serial ",
|
|
|
|
|
0/*allow-unknown*/,
|
|
|
|
|
&setlist);
|
|
|
|
|
|
2005-02-15 Andrew Cagney <cagney@gnu.org>
Mark up add_com, add_info and add_prefix_cmd.
* breakpoint.c, cp-support.c, dcache.c, dwarf2read.c: Update.
* exec.c, f-valprint.c, frame.c, gcore.c, gnu-nat.c: Update.
* go32-nat.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update.
* kod.c, language.c, linux-nat.c, m32r-rom.c, macrocmd.c: Update.
* maint.c, memattr.c, mips-tdep.c, nto-procfs.c, objc-lang.c: Update.
* ocd.c, pa64solib.c, printcmd.c, procfs.c, regcache.c: Update.
* remote-e7000.c, remote-m32r-sdi.c, remote-mips.c: Update.
* remote-sds.c, remote-sim.c, remote-st.c, remote-utils.c: Update.
* remote.c, rs6000-tdep.c, ser-go32.c, serial.c: Update.
* sh-tdep.c, solib.c, somsolib.c, source.c, stack.c: Update.
* symfile.c, symtab.c, target.c, thread.c, top.c: Update.
* tracepoint.c, typeprint.c, utils.c, valprint.c: Update.
* win32-nat.c, xcoffsolib.c, cli/cli-cmds.c, cli/cli-dump.c: Update.
* cli/cli-logging.c, tui/tui-layout.c, tui/tui-regs.c: Update.
* tui/tui-stack.c, tui/tui-win.c: Update.
2005-02-15 23:49:28 +08:00
|
|
|
|
add_prefix_cmd ("serial", class_maintenance, serial_show_cmd, _("\
|
|
|
|
|
Show default serial/parallel port configuration."),
|
2001-09-27 07:27:39 +08:00
|
|
|
|
&serial_show_cmdlist, "show serial ",
|
|
|
|
|
0/*allow-unknown*/,
|
|
|
|
|
&showlist);
|
|
|
|
|
|
2005-02-18 01:11:04 +08:00
|
|
|
|
add_setshow_filename_cmd ("remotelogfile", no_class, &serial_logfile, _("\
|
|
|
|
|
Set filename for remote session recording."), _("\
|
|
|
|
|
Show filename for remote session recording."), _("\
|
1999-04-16 09:35:26 +08:00
|
|
|
|
This file is used to record the remote session for future playback\n\
|
2005-02-18 01:11:04 +08:00
|
|
|
|
by gdbserver."),
|
|
|
|
|
NULL,
|
|
|
|
|
NULL, /* FIXME: i18n: */
|
|
|
|
|
&setlist, &showlist);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
2005-02-21 12:31:59 +08:00
|
|
|
|
add_setshow_enum_cmd ("remotelogbase", no_class, logbase_enums,
|
|
|
|
|
&serial_logbase, _("\
|
|
|
|
|
Set numerical base for remote session logging"), _("\
|
|
|
|
|
Show numerical base for remote session logging"), NULL,
|
|
|
|
|
NULL,
|
|
|
|
|
NULL, /* FIXME: i18n: */
|
|
|
|
|
&setlist, &showlist);
|
1999-10-06 07:13:56 +08:00
|
|
|
|
|
2005-02-18 Andrew Cagney <cagney@gnu.org>
Use add_setshow_zinteger_cmd through out. Re-sync gdbarch.sh
and gdbarch.c.
* breakpoint.c, frame.c, gdb-events.sh, gdbarch.sh: Update.
* gdbtypes.c, infrun.c, linux-nat.c, maint.c, monitor.c: Update.
* pa64solib.c, parse.c, remote-mips.c, ser-go32.c: Update.
* serial.c, solib-frv.c, somsolib.c, target.c, top.c: Update.
* varobj.c, cli/cli-cmds.c: Update.
* gdbarch.c, gdb-events.c: Regenerate.
2005-02-19 02:58:56 +08:00
|
|
|
|
add_setshow_zinteger_cmd ("serial", class_maintenance,
|
|
|
|
|
&global_serial_debug_p, _("\
|
|
|
|
|
Set serial debugging."), _("\
|
|
|
|
|
Show serial debugging."), _("\
|
|
|
|
|
When non-zero, serial port debugging is enabled."),
|
|
|
|
|
NULL,
|
|
|
|
|
NULL, /* FIXME: i18n: */
|
|
|
|
|
&setdebuglist, &showdebuglist);
|
1999-04-16 09:35:26 +08:00
|
|
|
|
}
|