forked from Imagelibrary/binutils-gdb
GDB: Add set/show serial parity command.
The "set serial parity" command allows the user to control which
parity to use when communicating over a serial connection, rather
than having the parity hardcoded to none.
gdb/ChangeLog:
* NEWS: Mention set/show serial parity command.
* monitor.c (monitor_open): Call serial_setparity.
* remote.c (remote_open_1): Likewise.
* ser-base.c (ser_base_serparity): New function.
* ser-base.h (ser_base_setparity): Add declaration.
* ser-go32.c (dos_ops): Set "setparity" field.
* ser-mingw.c (ser_windows_raw): Do not set state.fParity and
state.Parity.
(ser_windows_setparity): New function.
(hardwire_ops): Add ser_windows_setparity.
(tty_ops): Add NULL for setparity field.
(pipe_ops): Add ser_base_setparity.
(tcp_ops): Likewise.
* ser-pipe.c (pipe_ops): Likewise.
* ser-tcp.c (tcp_ops): Likewise.
* ser-unix.c (hardwire_setparity): Add declaration.
(hardwire_raw): Don't reset PARENB flag.
(hardwire_setparity): New function.
(hardwire_ops): Add hardwire_setparity.
* serial.c (serial_setparity): New function.
(serial_parity): New global.
(parity_none, parity_odd, parity_even, parity_enums, parity):
New static globals.
(set_parity): New function.
(_initialize_serial): Add set/show serial parity commands.
* serial.h (GDBPARITY_NONE): Define.
(GDBPARITY_ODD): Define.
(GDBPARITY_EVEN): Define.
(serial_setparity) Add declaration.
(struct serial_ops): Add setparity field.
* target.h (serial_parity): Add declaration.
gdb/doc/ChangeLog:
* gdb.texinfo (Remote configuration): Document "set/show
serial parity" command.
This commit is contained in:
committed by
Joel Brobecker
parent
32b40af94e
commit
236af5e336
40
gdb/serial.c
40
gdb/serial.c
@@ -524,6 +524,14 @@ serial_setstopbits (struct serial *scb, int num)
|
||||
return scb->ops->setstopbits (scb, num);
|
||||
}
|
||||
|
||||
/* See serial.h. */
|
||||
|
||||
int
|
||||
serial_setparity (struct serial *scb, int parity)
|
||||
{
|
||||
return scb->ops->setparity (scb, parity);
|
||||
}
|
||||
|
||||
int
|
||||
serial_can_async_p (struct serial *scb)
|
||||
{
|
||||
@@ -638,6 +646,30 @@ serial_baud_show_cmd (struct ui_file *file, int from_tty,
|
||||
value);
|
||||
}
|
||||
|
||||
/* Parity for serial port. */
|
||||
|
||||
int serial_parity = GDBPARITY_NONE;
|
||||
|
||||
static const char parity_none[] = "none";
|
||||
static const char parity_odd[] = "odd";
|
||||
static const char parity_even[] = "even";
|
||||
static const char *const parity_enums[] =
|
||||
{parity_none, parity_odd, parity_even, NULL};
|
||||
static const char *parity = parity_none;
|
||||
|
||||
/* Set serial_parity value. */
|
||||
|
||||
static void
|
||||
set_parity (char *ignore_args, int from_tty, struct cmd_list_element *c)
|
||||
{
|
||||
if (parity == parity_odd)
|
||||
serial_parity = GDBPARITY_ODD;
|
||||
else if (parity == parity_even)
|
||||
serial_parity = GDBPARITY_EVEN;
|
||||
else
|
||||
serial_parity = GDBPARITY_NONE;
|
||||
}
|
||||
|
||||
void
|
||||
_initialize_serial (void)
|
||||
{
|
||||
@@ -670,6 +702,14 @@ using remote targets."),
|
||||
serial_baud_show_cmd,
|
||||
&serial_set_cmdlist, &serial_show_cmdlist);
|
||||
|
||||
add_setshow_enum_cmd ("parity", no_class, parity_enums,
|
||||
&parity, _("\
|
||||
Set parity for remote serial I/O"), _("\
|
||||
Show parity for remote serial I/O"), NULL,
|
||||
set_parity,
|
||||
NULL, /* FIXME: i18n: */
|
||||
&serial_set_cmdlist, &serial_show_cmdlist);
|
||||
|
||||
add_setshow_filename_cmd ("remotelogfile", no_class, &serial_logfile, _("\
|
||||
Set filename for remote session recording."), _("\
|
||||
Show filename for remote session recording."), _("\
|
||||
|
||||
Reference in New Issue
Block a user