public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* Setting parity for remote serial
@ 2013-07-10 15:18 Yurij Grechishhev
  2013-07-10 18:10 ` Tom Tromey
  0 siblings, 1 reply; 44+ messages in thread
From: Yurij Grechishhev @ 2013-07-10 15:18 UTC (permalink / raw)
  To: gdb-patches

GDB doesn't support command to set parity for serial ports. So there
is a problem to connect target that use "odd" or "even" parity.
The one way is to set parity before launching gdb (stty for Linux or
MODE for Windows), but for Windows gdb sets parity to "none" during
connection.
I suggest using "set remoteparity <odd | even | none>" command for this.

Example:
(gdb) set remoteparity
even  none  odd
(gdb) set remoteparity even
(gdb) show remoteparity
Parity for remote serial I/O is "even".

I hope this will be useful for somebody.

Do you plan to use "class serial" (set serial ...) for serial settings?
"set serial parity <odd | even | none>" is more convenient way.


diff -up ../../../gdb_old/gdb-7.6/gdb/monitor.c gdb/monitor.c
--- ../../../gdb_old/gdb-7.6/gdb/monitor.c    2013-07-10
21:55:33.656750073 +0400
+++ gdb/monitor.c    2013-07-04 23:54:32.472595952 +0400
@@ -768,6 +768,7 @@ monitor_open (char *args, struct monitor
     }
     }

+  serial_setparity (monitor_desc, serial_parity);
   serial_raw (monitor_desc);

   serial_flush_input (monitor_desc);
Common subdirectories: ../../../gdb_old/gdb-7.6/gdb/po and gdb/po
Common subdirectories: ../../../gdb_old/gdb-7.6/gdb/python and gdb/python
Common subdirectories: ../../../gdb_old/gdb-7.6/gdb/regformats and
gdb/regformats
diff -up ../../../gdb_old/gdb-7.6/gdb/remote.c gdb/remote.c
--- ../../../gdb_old/gdb-7.6/gdb/remote.c    2013-07-10 21:55:34.645747970 +0400
+++ gdb/remote.c    2013-07-04 23:50:52.855721644 +0400
@@ -4256,6 +4256,7 @@ remote_open_1 (char *name, int from_tty,
     }
     }

+  serial_setparity(remote_desc, serial_parity);
   serial_raw (remote_desc);

   /* If there is something sitting in the buffer we might take it as a
diff -up ../../../gdb_old/gdb-7.6/gdb/ser-base.c gdb/ser-base.c
--- ../../../gdb_old/gdb-7.6/gdb/ser-base.c    2013-07-10
21:55:24.161873687 +0400
+++ gdb/ser-base.c    2013-07-05 00:28:55.795720278 +0400
@@ -536,6 +536,14 @@ ser_base_setbaudrate (struct serial *scb
   return 0;            /* Never fails!  */
 }

+
+int
+ser_base_setparity (struct serial *scb, int num)
+{
+  return 0;            /* Never fails!  */
+}
+
+
 int
 ser_base_setstopbits (struct serial *scb, int num)
 {
diff -up ../../../gdb_old/gdb-7.6/gdb/ser-base.h gdb/ser-base.h
--- ../../../gdb_old/gdb-7.6/gdb/ser-base.h    2013-07-10
21:55:24.168750025 +0400
+++ gdb/ser-base.h    2013-07-05 00:30:36.017596667 +0400
@@ -43,6 +43,7 @@ extern int ser_base_noflush_set_tty_stat
                        serial_ttystate old_ttystate);
 extern int ser_base_setbaudrate (struct serial *scb, int rate);
 extern int ser_base_setstopbits (struct serial *scb, int rate);
+extern int ser_base_setparity (struct serial *scb, int parity);
 extern int ser_base_drain_output (struct serial *scb);

 extern int ser_base_write (struct serial *scb, const char *str, int len);
diff -up ../../../gdb_old/gdb-7.6/gdb/serial.c gdb/serial.c
--- ../../../gdb_old/gdb-7.6/gdb/serial.c    2013-07-10 21:55:35.224750365 +0400
+++ gdb/serial.c    2013-07-10 20:41:31.899897384 +0400
@@ -26,6 +26,9 @@

 extern void _initialize_serial (void);

+/* Parity for serial port */
+extern int serial_parity;
+
 /* Is serial being debugged?  */

 static unsigned int global_serial_debug_p;
@@ -53,10 +56,29 @@ static const char logbase_ascii[] = "asc
 static const char *const logbase_enums[] =
 {logbase_hex, logbase_octal, logbase_ascii, NULL};
 static const char *serial_logbase = logbase_ascii;
-

 static int serial_current_type = 0;

+/* Parity for serial port */
+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;
+
+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;
+}
+
+
 /* Log char CH of type CHTYPE, with TIMEOUT.  */

 /* Define bogus char to represent a BREAK.  Should be careful to choose a value
@@ -521,6 +543,12 @@ serial_setstopbits (struct serial *scb,
 }

 int
+serial_setparity (struct serial*scb, int parity)
+{
+  return scb->ops->setparity (scb, parity);
+}
+
+int
 serial_can_async_p (struct serial *scb)
 {
   return (scb->ops->async != NULL);
@@ -658,6 +686,15 @@ Show numerical base for remote session l
             NULL, /* FIXME: i18n: */
             &setlist, &showlist);

+  add_setshow_enum_cmd ("remoteparity", 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: */
+                        &setlist, &showlist);
+
+
   add_setshow_zuinteger_cmd ("serial", class_maintenance,
                  &global_serial_debug_p, _("\
 Set serial debugging."), _("\
diff -up ../../../gdb_old/gdb-7.6/gdb/serial.h gdb/serial.h
--- ../../../gdb_old/gdb-7.6/gdb/serial.h    2013-07-10 21:55:33.445749528 +0400
+++ gdb/serial.h    2013-07-10 20:17:17.705956716 +0400
@@ -177,6 +177,14 @@ extern int serial_noflush_set_tty_state

 extern int serial_setbaudrate (struct serial *scb, int rate);

+/* Set parity for serial port. Return 0 for success, -1 for failure */
+
+#define GDBPARITY_NONE     0
+#define GDBPARITY_ODD      1
+#define GDBPARITY_EVEN     2
+
+extern int serial_setparity (struct serial *scb, int parity);
+
 /* Set the number of stop bits to the value specified.  Returns 0 for
    success, -1 for failure.  */

@@ -272,6 +280,7 @@ struct serial_ops
                   serial_ttystate);
     int (*setbaudrate) (struct serial *, int rate);
     int (*setstopbits) (struct serial *, int num);
+    int (*setparity) (struct serial *, int parity);
     /* Wait for output to drain.  */
     int (*drain_output) (struct serial *);
     /* Change the serial device into/out of asynchronous mode, call
diff -up ../../../gdb_old/gdb-7.6/gdb/ser-mingw.c gdb/ser-mingw.c
--- ../../../gdb_old/gdb-7.6/gdb/ser-mingw.c    2013-07-10
21:55:24.185807109 +0400
+++ gdb/ser-mingw.c    2013-07-10 20:51:20.459749272 +0400
@@ -156,7 +156,6 @@ ser_windows_raw (struct serial *scb)
   if (GetCommState (h, &state) == 0)
     return;

-  state.fParity = FALSE;
   state.fOutxCtsFlow = FALSE;
   state.fOutxDsrFlow = FALSE;
   state.fDtrControl = DTR_CONTROL_ENABLE;
@@ -166,7 +165,6 @@ ser_windows_raw (struct serial *scb)
   state.fNull = FALSE;
   state.fAbortOnError = FALSE;
   state.ByteSize = 8;
-  state.Parity = NOPARITY;

   scb->current_timeout = 0;

@@ -202,6 +200,37 @@ ser_windows_setstopbits (struct serial *
 }

 static int
+ser_windows_setparity (struct serial *scb, int parity)
+{
+  HANDLE h = (HANDLE) _get_osfhandle (scb->fd);
+  DCB state;
+
+  if (GetCommState (h, &state) == 0)
+    return -1;
+
+  switch (parity)
+ {
+    case GDBPARITY_NONE:
+        state.Parity = NOPARITY;
+        state.fParity = FALSE;
+        break;
+    case GDBPARITY_ODD:
+        state.Parity = ODDPARITY;
+        state.fParity = TRUE;
+        break;
+    case GDBPARITY_EVEN:
+        state.Parity = EVENPARITY;
+        state.fParity = TRUE;
+        break;
+    default:
+        return 1;
+
+ }
+
+  return (SetCommState (h, &state) != 0) ? 0 : -1;
+}
+
+static int
 ser_windows_setbaudrate (struct serial *scb, int rate)
 {
   HANDLE h = (HANDLE) _get_osfhandle (scb->fd);
@@ -1250,6 +1279,7 @@ _initialize_ser_windows (void)

   ops->go_raw = ser_windows_raw;
   ops->setbaudrate = ser_windows_setbaudrate;
+  ops->setparity = ser_windows_setparity;
   ops->setstopbits = ser_windows_setstopbits;
   ops->drain_output = ser_windows_drain_output;
   ops->readchar = ser_base_readchar;
@@ -1303,6 +1333,7 @@ _initialize_ser_windows (void)
   ops->print_tty_state = ser_base_print_tty_state;
   ops->noflush_set_tty_state = ser_base_noflush_set_tty_state;
   ops->setbaudrate = ser_base_setbaudrate;
+  ops->setparity = ser_base_setparity;
   ops->setstopbits = ser_base_setstopbits;
   ops->drain_output = ser_base_drain_output;
   ops->async = ser_base_async;
@@ -1338,6 +1369,7 @@ _initialize_ser_windows (void)
   ops->print_tty_state = ser_base_print_tty_state;
   ops->noflush_set_tty_state = ser_base_noflush_set_tty_state;
   ops->setbaudrate = ser_base_setbaudrate;
+  ops->setparity = ser_base_setparity;
   ops->setstopbits = ser_base_setstopbits;
   ops->drain_output = ser_base_drain_output;
   ops->async = ser_base_async;
diff -up ../../../gdb_old/gdb-7.6/gdb/ser-pipe.c gdb/ser-pipe.c
--- ../../../gdb_old/gdb-7.6/gdb/ser-pipe.c    2013-07-10
21:55:24.185807109 +0400
+++ gdb/ser-pipe.c    2013-07-10 20:58:32.921749511 +0400
@@ -233,6 +233,7 @@ _initialize_ser_pipe (void)
   ops->print_tty_state = ser_base_print_tty_state;
   ops->noflush_set_tty_state = ser_base_noflush_set_tty_state;
   ops->setbaudrate = ser_base_setbaudrate;
+  ops->setparity = ser_base_setparity;
   ops->setstopbits = ser_base_setstopbits;
   ops->drain_output = ser_base_drain_output;
   ops->async = ser_base_async;
diff -up ../../../gdb_old/gdb-7.6/gdb/ser-tcp.c gdb/ser-tcp.c
--- ../../../gdb_old/gdb-7.6/gdb/ser-tcp.c    2013-07-10
21:55:24.200748354 +0400
+++ gdb/ser-tcp.c    2013-07-05 00:33:53.026598227 +0400
@@ -396,6 +396,7 @@ _initialize_ser_tcp (void)
   ops->print_tty_state = ser_base_print_tty_state;
   ops->noflush_set_tty_state = ser_base_noflush_set_tty_state;
   ops->setbaudrate = ser_base_setbaudrate;
+  ops->setparity = ser_base_setparity;
   ops->setstopbits = ser_base_setstopbits;
   ops->drain_output = ser_base_drain_output;
   ops->async = ser_base_async;
diff -up ../../../gdb_old/gdb-7.6/gdb/ser-unix.c gdb/ser-unix.c
--- ../../../gdb_old/gdb-7.6/gdb/ser-unix.c    2013-07-10
21:55:24.229751815 +0400
+++ gdb/ser-unix.c    2013-07-10 20:45:43.995750064 +0400
@@ -99,6 +99,7 @@ static int hardwire_flush_output (struct
 static int hardwire_flush_input (struct serial *);
 static int hardwire_send_break (struct serial *);
 static int hardwire_setstopbits (struct serial *, int);
+static int hardwire_setparity (struct serial *, int);

 void _initialize_ser_hardwire (void);

@@ -893,6 +894,47 @@ hardwire_setstopbits (struct serial *scb
   return set_tty_state (scb, &state);
 }

+static int
+hardwire_setparity (struct serial *scb, int parity)
+{
+  struct hardwire_ttystate state;
+  int newparity = 0;
+
+  if (get_tty_state (scb, &state))
+    return -1;
+
+  switch (parity)
+    {
+    case GDBPARITY_NONE:
+          newparity = 0;
+    break;
+    case GDBPARITY_ODD:
+    newparity = PARENB | PARODD;
+    break;
+    case GDBPARITY_EVEN:
+          newparity = PARENB;
+      break;
+    default:
+      return 1;
+    }
+
+#ifdef HAVE_TERMIOS
+    state.termios.c_cflag |= newparity;
+#endif
+
+#ifdef HAVE_TERMIO
+    state.termio.c_cflag |= newparity;
+#endif
+
+#ifdef HAVE_SGTTY
+  return 0;            /* sgtty doesn't support this */
+#endif
+
+  return set_tty_state (scb, &state);
+
+}
+
+
 static void
 hardwire_close (struct serial *scb)
 {
@@ -929,6 +971,7 @@ _initialize_ser_hardwire (void)
   ops->print_tty_state = hardwire_print_tty_state;
   ops->noflush_set_tty_state = hardwire_noflush_set_tty_state;
   ops->setbaudrate = hardwire_setbaudrate;
+  ops->setparity = hardwire_setparity;
   ops->setstopbits = hardwire_setstopbits;
   ops->drain_output = hardwire_drain_output;
   ops->async = ser_base_async;
Common subdirectories: ../../../gdb_old/gdb-7.6/gdb/stubs and gdb/stubs
Common subdirectories: ../../../gdb_old/gdb-7.6/gdb/syscalls and gdb/syscalls
diff -up ../../../gdb_old/gdb-7.6/gdb/target.h gdb/target.h
--- ../../../gdb_old/gdb-7.6/gdb/target.h    2013-07-10 21:55:36.818749395 +0400
+++ gdb/target.h    2013-07-05 00:36:15.025597655 +0400
@@ -1961,6 +1961,10 @@ extern int remote_debug;

 /* Speed in bits per second, or -1 which means don't mess with the speed.  */
 extern int baud_rate;
+
+/* Parity for serial port */
+extern int serial_parity;
+
 /* Timeout limit for response from target.  */
 extern int remote_timeout;

Common subdirectories: ../../../gdb_old/gdb-7.6/gdb/testsuite and gdb/testsuite
diff -up ../../../gdb_old/gdb-7.6/gdb/top.c gdb/top.c
--- ../../../gdb_old/gdb-7.6/gdb/top.c    2013-07-10 21:55:32.033750880 +0400
+++ gdb/top.c    2013-07-10 20:55:06.711827223 +0400
@@ -159,6 +159,9 @@ int server_command;

 int baud_rate = -1;

+/* Parity for serial port */
+int serial_parity = GDBPARITY_NONE;
+
 /* Timeout limit for response from target.  */

 /* The default value has been changed many times over the years.  It
Common subdirectories: ../../../gdb_old/gdb-7.6/gdb/tui and gdb/tui



--
With best regards!
____________________________

Yurij Grechishhev
Bauman State Technical University,
Department of Computer Systems and Networks

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: Setting parity for remote serial
  2013-07-10 15:18 Setting parity for remote serial Yurij Grechishhev
@ 2013-07-10 18:10 ` Tom Tromey
  2013-10-04 14:12   ` Pedro Alves
  0 siblings, 1 reply; 44+ messages in thread
From: Tom Tromey @ 2013-07-10 18:10 UTC (permalink / raw)
  To: Yurij Grechishhev; +Cc: gdb-patches

>>>>> "Yurij" == Yurij Grechishhev <yurij.grechishhev@gmail.com> writes:

Yurij> GDB doesn't support command to set parity for serial ports. So there
Yurij> is a problem to connect target that use "odd" or "even" parity.
Yurij> The one way is to set parity before launching gdb (stty for Linux or
Yurij> MODE for Windows), but for Windows gdb sets parity to "none" during
Yurij> connection.
Yurij> I suggest using "set remoteparity <odd | even | none>" command for this.

It looks reasonable to me.
There are some formatting issues, but nothing too serious.

Do you have a copyright assignment in place?
If not, contact me off list and I will get you started on that.

This would need at least a ChangeLog entry, documentation patch, and
NEWS patch to be complete.  A test case would be nice as well, though I
can see how it would be hard to make it actually do anything :)

Yurij> Do you plan to use "class serial" (set serial ...) for serial settings?
Yurij> "set serial parity <odd | even | none>" is more convenient way.

I didn't even know about "set serial".
It seems like dead code; but I'd have to dig into the history there to
find out.

Tom

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: Setting parity for remote serial
  2013-07-10 18:10 ` Tom Tromey
@ 2013-10-04 14:12   ` Pedro Alves
  2013-10-07 18:33     ` Yurij Grechishhev
  0 siblings, 1 reply; 44+ messages in thread
From: Pedro Alves @ 2013-10-04 14:12 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Yurij Grechishhev, gdb-patches

On 07/10/2013 07:09 PM, Tom Tromey wrote:

> Yurij> Do you plan to use "class serial" (set serial ...) for serial settings?
> Yurij> "set serial parity <odd | even | none>" is more convenient way.
> 
> I didn't even know about "set serial".
> It seems like dead code; but I'd have to dig into the history there to
> find out.

Yeah, I don't know the history either, but it'd be totally fine with me
to start making use of it.  These "set remotefoo" commands with no space
in them look really oddly named.  However, adding "set serial parity" without
aliasing "set serial baud" to the old "set remotebaud" (and deprecating
that) wouldn't be desirable.  IOW, IMO, if we add "set serial parity",
we should also alias "set remotebaud" to "set serial baud", and whatever
other commands would make sense (which should be really simple to do).

Thanks,
-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: Setting parity for remote serial
  2013-10-04 14:12   ` Pedro Alves
@ 2013-10-07 18:33     ` Yurij Grechishhev
  2013-10-08  3:56       ` Joel Brobecker
  0 siblings, 1 reply; 44+ messages in thread
From: Yurij Grechishhev @ 2013-10-07 18:33 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

> IOW, IMO, if we add "set serial parity",
> we should also alias "set remotebaud" to "set serial baud", and whatever
> other commands would make sense (which should be really simple to do).

That would be great. But it's more comprehensive patch that I have done.
Can we add all "set remotefoo" commands and then alias them
to "set serial foo" at once?
Related discussion:
https://sourceware.org/ml/gdb-patches/2001-09/msg00358.html

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: Setting parity for remote serial
  2013-10-07 18:33     ` Yurij Grechishhev
@ 2013-10-08  3:56       ` Joel Brobecker
  2013-10-08 12:03         ` Pedro Alves
  0 siblings, 1 reply; 44+ messages in thread
From: Joel Brobecker @ 2013-10-08  3:56 UTC (permalink / raw)
  To: Yurij Grechishhev; +Cc: Pedro Alves, gdb-patches

> > IOW, IMO, if we add "set serial parity",
> > we should also alias "set remotebaud" to "set serial baud", and whatever
> > other commands would make sense (which should be really simple to do).
> 
> That would be great. But it's more comprehensive patch that I have done.
> Can we add all "set remotefoo" commands and then alias them
> to "set serial foo" at once?
> Related discussion:
> https://sourceware.org/ml/gdb-patches/2001-09/msg00358.html

I'd rather we do it right the first time. If we're a go with
the "set serial baud" command, I don't mind taking care of
that part. As Pedro hints, it's a fairly easy change to make.

Pedro, should we go ahead? It's only been a day or two, but we haven't
had any objection so far.

-- 
Joel

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: Setting parity for remote serial
  2013-10-08  3:56       ` Joel Brobecker
@ 2013-10-08 12:03         ` Pedro Alves
  2013-10-08 14:16           ` [RFA/code+NEWS] new "set/show serial baud" command (was: "Re: Setting parity for remote serial") Joel Brobecker
  0 siblings, 1 reply; 44+ messages in thread
From: Pedro Alves @ 2013-10-08 12:03 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: Yurij Grechishhev, gdb-patches

[tweaking subject to draw others' attention]

On 10/08/2013 04:56 AM, Joel Brobecker wrote:
>>> IOW, IMO, if we add "set serial parity",
>>> we should also alias "set remotebaud" to "set serial baud", and whatever
>>> other commands would make sense (which should be really simple to do).
>>
>> That would be great. But it's more comprehensive patch that I have done.
>> Can we add all "set remotefoo" commands and then alias them
>> to "set serial foo" at once?
>> Related discussion:
>> https://sourceware.org/ml/gdb-patches/2001-09/msg00358.html
> 
> I'd rather we do it right the first time. If we're a go with
> the "set serial baud" command, I don't mind taking care of
> that part. As Pedro hints, it's a fairly easy change to make.
> 
> Pedro, should we go ahead? It's only been a day or two, but we haven't
> had any objection so far.

Yeah, I think so.

Thanks,
-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [RFA/code+NEWS] new "set/show serial baud" command (was: "Re: Setting parity for remote serial")
  2013-10-08 12:03         ` Pedro Alves
@ 2013-10-08 14:16           ` Joel Brobecker
  2013-10-08 14:34             ` [RFA/code+NEWS] new "set/show serial baud" command Pedro Alves
                               ` (3 more replies)
  0 siblings, 4 replies; 44+ messages in thread
From: Joel Brobecker @ 2013-10-08 14:16 UTC (permalink / raw)
  To: Pedro Alves; +Cc: Yurij Grechishhev, gdb-patches

[-- Attachment #1: Type: text/plain, Size: 1144 bytes --]

> > I'd rather we do it right the first time. If we're a go with
> > the "set serial baud" command, I don't mind taking care of
> > that part. As Pedro hints, it's a fairly easy change to make.
> > 
> > Pedro, should we go ahead? It's only been a day or two, but we haven't
> > had any objection so far.
> 
> Yeah, I think so.

Attached is a patch that implements that.

gdb/ChangeLog:

        * cli/cli-cmds.c (show_baud_rate): Moved to serial.c as
        serial_baud_show_cmd.
        (_initialize_cli_cmds): Delete the code creating the
        "set/show remotebaud" commands.
        * serial.c (baud_rate): Move here from top.c.
        (serial_baud_show_cmd): Move here from cli/cli-cmds.c.
        (_initialize_serial): Create "set/show serial baud" commands.
        Add "set/show remotebaud" command aliases.
        * top.c (baud_rate): Moved to serial.c.
        * NEWS: Document the new "set/show serial baud" commands,
        replacing "set/show remotebaud".

Tested on x86_64-linux, with no regression (I almost expected one,
as we used to test thhe output "help set", or soemthing like that).

OK to commit?

Thanks,
-- 
Joel

[-- Attachment #2: 0001-Rename-set-show-remotebaud-command-into-set-show-ser.patch --]
[-- Type: text/x-diff, Size: 5872 bytes --]

From 94708a66478aadeb7e0bff57e6f83339e2b13bdd Mon Sep 17 00:00:00 2001
From: Joel Brobecker <brobecker@adacore.com>
Date: Tue, 8 Oct 2013 17:55:02 +0400
Subject: [PATCH] Rename "set/show remotebaud" command into "set/show serial
 baud"

This patch renames the "set/show remotebaud" commands into
"set/show serial baud", and moves its implementation into serial.c.
It also moves the "baud_rate" global from top.c to serial.c, where
the new code is being added (the alternative was to add an include
of target.h).

And to facilitate the transition to the new setting name, this
patch also preserves the old command names via command aliases.

gdb/ChangeLog:

        * cli/cli-cmds.c (show_baud_rate): Moved to serial.c as
        serial_baud_show_cmd.
        (_initialize_cli_cmds): Delete the code creating the
        "set/show remotebaud" commands.
        * serial.c (baud_rate): Move here from top.c.
        (serial_baud_show_cmd): Move here from cli/cli-cmds.c.
        (_initialize_serial): Create "set/show serial baud" commands.
        Add "set/show remotebaud" command aliases.
        * top.c (baud_rate): Moved to serial.c.
        * NEWS: Document the new "set/show serial baud" commands,
        replacing "set/show remotebaud".
---
 gdb/NEWS           |  5 +++++
 gdb/cli/cli-cmds.c | 19 -------------------
 gdb/serial.c       | 30 ++++++++++++++++++++++++++++++
 gdb/top.c          |  7 -------
 4 files changed, 35 insertions(+), 26 deletions(-)

diff --git a/gdb/NEWS b/gdb/NEWS
index 8114fb1..4e627b0 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -200,6 +200,11 @@ qXfer:libraries-svr4:read's annex
 
 * GDB can now use Windows x64 unwinding data.
 
+* The "set remotebaud" command has been replaced by "set serial baud".
+  Similarly, "show remotebaud" has been replaced by "show serial baud".
+  The "set remotebaud" and "show remotebaud" commands are still available
+  to provide backward compatibility with older versions of GDB.
+
 *** Changes in GDB 7.6
 
 * Target record has been renamed to record-full.
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index 886ba7a..460b719 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -1582,14 +1582,6 @@ show_history_expansion_p (struct ui_file *file, int from_tty,
 }
 
 static void
-show_baud_rate (struct ui_file *file, int from_tty,
-		struct cmd_list_element *c, const char *value)
-{
-  fprintf_filtered (file, _("Baud rate for remote serial I/O is %s.\n"),
-		    value);
-}
-
-static void
 show_remote_debug (struct ui_file *file, int from_tty,
 		   struct cmd_list_element *c, const char *value)
 {
@@ -1748,17 +1740,6 @@ the previous command number shown."),
   add_cmd ("configuration", no_set_class, show_configuration,
 	   _("Show how GDB was configured at build time."), &showlist);
 
-  /* If target is open when baud changes, it doesn't take effect until
-     the next open (I think, not sure).  */
-  add_setshow_zinteger_cmd ("remotebaud", no_class, &baud_rate, _("\
-Set baud rate for remote serial I/O."), _("\
-Show baud rate for remote serial I/O."), _("\
-This value is used to set the speed of the serial port when debugging\n\
-using remote targets."),
-			    NULL,
-			    show_baud_rate,
-			    &setlist, &showlist);
-
   add_setshow_zinteger_cmd ("remote", no_class, &remote_debug, _("\
 Set debugging of remote protocol."), _("\
 Show debugging of remote protocol."), _("\
diff --git a/gdb/serial.c b/gdb/serial.c
index ee3f1ea..434cde4 100644
--- a/gdb/serial.c
+++ b/gdb/serial.c
@@ -621,6 +621,20 @@ serial_show_cmd (char *args, int from_tty)
   cmd_show_list (serial_show_cmdlist, from_tty, "");
 }
 
+/* Baud rate specified for talking to serial target systems.  Default
+   is left as -1, so targets can choose their own defaults.  */
+/* FIXME: This means that "show remotebaud" and gr_files_info can
+   print -1 or (unsigned int)-1.  This is a Bad User Interface.  */
+
+int baud_rate = -1;
+
+static void
+serial_baud_show_cmd (struct ui_file *file, int from_tty,
+		      struct cmd_list_element *c, const char *value)
+{
+  fprintf_filtered (file, _("Baud rate for remote serial I/O is %s.\n"),
+		    value);
+}
 
 void
 _initialize_serial (void)
@@ -643,6 +657,22 @@ Show default serial/parallel port configuration."),
 		  0/*allow-unknown*/,
 		  &showlist);
 
+  /* If target is open when baud changes, it doesn't take effect until
+     the next open (I think, not sure).  */
+  add_setshow_zinteger_cmd ("baud", no_class, &baud_rate, _("\
+Set baud rate for remote serial I/O."), _("\
+Show baud rate for remote serial I/O."), _("\
+This value is used to set the speed of the serial port when debugging\n\
+using remote targets."),
+			    NULL,
+			    serial_baud_show_cmd,
+			    &serial_set_cmdlist, &serial_show_cmdlist);
+
+  /* The commands "set/show serial baud" used to have a different name.
+     Add aliases to those names to facilitate the transition.  */
+  add_alias_cmd ("remotebaud", "serial baud", no_class, 0, &setlist);
+  add_alias_cmd ("remotebaud", "serial baud", no_class, 0, &showlist);
+
   add_setshow_filename_cmd ("remotelogfile", no_class, &serial_logfile, _("\
 Set filename for remote session recording."), _("\
 Show filename for remote session recording."), _("\
diff --git a/gdb/top.c b/gdb/top.c
index d9128a3..c473d8c 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -144,13 +144,6 @@ int saved_command_line_size = 100;
    is issuing commands too.  */
 int server_command;
 
-/* Baud rate specified for talking to serial target systems.  Default
-   is left as -1, so targets can choose their own defaults.  */
-/* FIXME: This means that "show remotebaud" and gr_files_info can
-   print -1 or (unsigned int)-1.  This is a Bad User Interface.  */
-
-int baud_rate = -1;
-
 /* Timeout limit for response from target.  */
 
 /* The default value has been changed many times over the years.  It 
-- 
1.8.1.2


^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [RFA/code+NEWS] new "set/show serial baud" command
  2013-10-08 14:16           ` [RFA/code+NEWS] new "set/show serial baud" command (was: "Re: Setting parity for remote serial") Joel Brobecker
@ 2013-10-08 14:34             ` Pedro Alves
  2013-10-08 15:00               ` Joel Brobecker
  2013-10-08 15:12             ` Tom Tromey
                               ` (2 subsequent siblings)
  3 siblings, 1 reply; 44+ messages in thread
From: Pedro Alves @ 2013-10-08 14:34 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: Yurij Grechishhev, gdb-patches

On 10/08/2013 03:16 PM, Joel Brobecker wrote:
>>> I'd rather we do it right the first time. If we're a go with
>>> the "set serial baud" command, I don't mind taking care of
>>> that part. As Pedro hints, it's a fairly easy change to make.
>>>
>>> Pedro, should we go ahead? It's only been a day or two, but we haven't
>>> had any objection so far.
>>
>> Yeah, I think so.
> 
> Attached is a patch that implements that.
> 

Thanks, looks good to me, though, don't we need to update the manual?

-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [RFA/code+NEWS] new "set/show serial baud" command
  2013-10-08 14:34             ` [RFA/code+NEWS] new "set/show serial baud" command Pedro Alves
@ 2013-10-08 15:00               ` Joel Brobecker
  0 siblings, 0 replies; 44+ messages in thread
From: Joel Brobecker @ 2013-10-08 15:00 UTC (permalink / raw)
  To: Pedro Alves; +Cc: Yurij Grechishhev, gdb-patches

> Thanks, looks good to me, though, don't we need to update the manual?

Argh. Yes, thanks! I completely zapped that part. I will take care of that
tomorrow.

-- 
Joel

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [RFA/code+NEWS] new "set/show serial baud" command
  2013-10-08 14:16           ` [RFA/code+NEWS] new "set/show serial baud" command (was: "Re: Setting parity for remote serial") Joel Brobecker
  2013-10-08 14:34             ` [RFA/code+NEWS] new "set/show serial baud" command Pedro Alves
@ 2013-10-08 15:12             ` Tom Tromey
  2013-10-09 11:23               ` [RFA v2/code+DOCO+NEWS] " Joel Brobecker
  2013-10-08 15:24             ` [RFA/code+NEWS] new "set/show serial baud" command (was: "Re: Setting parity for remote serial") Eli Zaretskii
  2013-10-09  2:05             ` Doug Evans
  3 siblings, 1 reply; 44+ messages in thread
From: Tom Tromey @ 2013-10-08 15:12 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: Pedro Alves, Yurij Grechishhev, gdb-patches

>>>>> "Joel" == Joel Brobecker <brobecker@adacore.com> writes:

Joel> +  /* The commands "set/show serial baud" used to have a different name.
Joel> +     Add aliases to those names to facilitate the transition.  */
Joel> +  add_alias_cmd ("remotebaud", "serial baud", no_class, 0, &setlist);
Joel> +  add_alias_cmd ("remotebaud", "serial baud", no_class, 0, &showlist);

I think it's best to also deprecate these aliases.

Tom

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [RFA/code+NEWS] new "set/show serial baud" command (was: "Re: Setting parity for remote serial")
  2013-10-08 14:16           ` [RFA/code+NEWS] new "set/show serial baud" command (was: "Re: Setting parity for remote serial") Joel Brobecker
  2013-10-08 14:34             ` [RFA/code+NEWS] new "set/show serial baud" command Pedro Alves
  2013-10-08 15:12             ` Tom Tromey
@ 2013-10-08 15:24             ` Eli Zaretskii
  2013-10-09  2:05             ` Doug Evans
  3 siblings, 0 replies; 44+ messages in thread
From: Eli Zaretskii @ 2013-10-08 15:24 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: palves, yurij.grechishhev, gdb-patches

> Date: Tue, 8 Oct 2013 18:16:39 +0400
> From: Joel Brobecker <brobecker@adacore.com>
> Cc: Yurij Grechishhev <yurij.grechishhev@gmail.com>,	gdb-patches@sourceware.org
> 
> Attached is a patch that implements that.
> 
> gdb/ChangeLog:
> 
>         * cli/cli-cmds.c (show_baud_rate): Moved to serial.c as
>         serial_baud_show_cmd.
>         (_initialize_cli_cmds): Delete the code creating the
>         "set/show remotebaud" commands.
>         * serial.c (baud_rate): Move here from top.c.
>         (serial_baud_show_cmd): Move here from cli/cli-cmds.c.
>         (_initialize_serial): Create "set/show serial baud" commands.
>         Add "set/show remotebaud" command aliases.
>         * top.c (baud_rate): Moved to serial.c.
>         * NEWS: Document the new "set/show serial baud" commands,
>         replacing "set/show remotebaud".
> 
> Tested on x86_64-linux, with no regression (I almost expected one,
> as we used to test thhe output "help set", or soemthing like that).
> 
> OK to commit?

OK for the documentation parts.  Thanks.

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [RFA/code+NEWS] new "set/show serial baud" command (was: "Re: Setting parity for remote serial")
  2013-10-08 14:16           ` [RFA/code+NEWS] new "set/show serial baud" command (was: "Re: Setting parity for remote serial") Joel Brobecker
                               ` (2 preceding siblings ...)
  2013-10-08 15:24             ` [RFA/code+NEWS] new "set/show serial baud" command (was: "Re: Setting parity for remote serial") Eli Zaretskii
@ 2013-10-09  2:05             ` Doug Evans
  2013-10-09  3:57               ` Joel Brobecker
  3 siblings, 1 reply; 44+ messages in thread
From: Doug Evans @ 2013-10-09  2:05 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: Pedro Alves, Yurij Grechishhev, gdb-patches

On Tue, Oct 8, 2013 at 7:16 AM, Joel Brobecker <brobecker@adacore.com> wrote:
>> > I'd rather we do it right the first time. If we're a go with
>> > the "set serial baud" command, I don't mind taking care of
>> > that part. As Pedro hints, it's a fairly easy change to make.
>> >
>> > Pedro, should we go ahead? It's only been a day or two, but we haven't
>> > had any objection so far.
>>
>> Yeah, I think so.
>
> Attached is a patch that implements that.
>
> gdb/ChangeLog:
>
>         * cli/cli-cmds.c (show_baud_rate): Moved to serial.c as
>         serial_baud_show_cmd.
>         (_initialize_cli_cmds): Delete the code creating the
>         "set/show remotebaud" commands.
>         * serial.c (baud_rate): Move here from top.c.
>         (serial_baud_show_cmd): Move here from cli/cli-cmds.c.
>         (_initialize_serial): Create "set/show serial baud" commands.
>         Add "set/show remotebaud" command aliases.
>         * top.c (baud_rate): Moved to serial.c.
>         * NEWS: Document the new "set/show serial baud" commands,
>         replacing "set/show remotebaud".
>
> Tested on x86_64-linux, with no regression (I almost expected one,
> as we used to test thhe output "help set", or soemthing like that).
>
> OK to commit?
>
> Thanks,
> --
> Joel

+  /* The commands "set/show serial baud" used to have a different name.
+     Add aliases to those names to facilitate the transition.  */
+  add_alias_cmd ("remotebaud", "serial baud", no_class, 0, &setlist);
+  add_alias_cmd ("remotebaud", "serial baud", no_class, 0, &showlist);

Does the mark-as-deprecated machinery work here?

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [RFA/code+NEWS] new "set/show serial baud" command (was: "Re: Setting parity for remote serial")
  2013-10-09  2:05             ` Doug Evans
@ 2013-10-09  3:57               ` Joel Brobecker
  2013-10-09  8:31                 ` [RFA/code+NEWS] new "set/show serial baud" command Pedro Alves
  0 siblings, 1 reply; 44+ messages in thread
From: Joel Brobecker @ 2013-10-09  3:57 UTC (permalink / raw)
  To: Doug Evans; +Cc: Pedro Alves, Yurij Grechishhev, gdb-patches

> +  /* The commands "set/show serial baud" used to have a different name.
> +     Add aliases to those names to facilitate the transition.  */
> +  add_alias_cmd ("remotebaud", "serial baud", no_class, 0, &setlist);
> +  add_alias_cmd ("remotebaud", "serial baud", no_class, 0, &showlist);
> 
> Does the mark-as-deprecated machinery work here?

It should. I just wasn't sure at the time I wrote the patch that
we actually wanted to deprecate the commands. Since Tom proposed it
as well, if there are no objection from others, I will do so, and
update the NEWS entry accordingly (as well as add this entry for
post 7.6 branch).

-- 
Joel

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [RFA/code+NEWS] new "set/show serial baud" command
  2013-10-09  3:57               ` Joel Brobecker
@ 2013-10-09  8:31                 ` Pedro Alves
  0 siblings, 0 replies; 44+ messages in thread
From: Pedro Alves @ 2013-10-09  8:31 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: Doug Evans, Yurij Grechishhev, gdb-patches

On 10/09/2013 04:57 AM, Joel Brobecker wrote:
>> +  /* The commands "set/show serial baud" used to have a different name.
>> +     Add aliases to those names to facilitate the transition.  */
>> +  add_alias_cmd ("remotebaud", "serial baud", no_class, 0, &setlist);
>> +  add_alias_cmd ("remotebaud", "serial baud", no_class, 0, &showlist);
>>
>> Does the mark-as-deprecated machinery work here?
> 
> It should. I just wasn't sure at the time I wrote the patch that
> we actually wanted to deprecate the commands. Since Tom proposed it
> as well, if there are no objection from others, I will do so, and
> update the NEWS entry accordingly (as well as add this entry for
> post 7.6 branch).

I also think the old ones should be marked deprecated.

-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [RFA v2/code+DOCO+NEWS] new "set/show serial baud" command
  2013-10-08 15:12             ` Tom Tromey
@ 2013-10-09 11:23               ` Joel Brobecker
  2013-10-09 16:17                 ` Pedro Alves
  2013-10-09 16:44                 ` Eli Zaretskii
  0 siblings, 2 replies; 44+ messages in thread
From: Joel Brobecker @ 2013-10-09 11:23 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 2459 bytes --]

> I think it's best to also deprecate these aliases.

Unfortunately, I hit a limitation when trying to deprecate the alias,
and my guess is because the command is prefixed. I had a quick look,
and basically, I think "lookup_cmd_1" recurses into himself by first
finding the prefixed command, then does the recursion by trying to
find the rest of the command within that prefix. It finds the command
and notices the fact that it is deprecated, and even tries to warn
the user by calling deprecated_cmd_warning.  But this function only
takes the deprecated command names, and the name it passes is lacking
the prefix (due to the recursion). As a result, deprecated_cmd_warning
fails to find the aliased command and returns immediately:

  if (!lookup_cmd_composition (text, &alias, &prefix_cmd, &cmd))
    /* Return if text doesn't evaluate to a command.  */
    return;

Lifting that limitation would take a little bit more time than I have,
so I went with the sort of trick as the one used in remote.c, which
is to duplicate the command. Not pretty, but as the FIXME says, it's
temporary (I've already added a TODO item in the GDB 7.8 release
management wiki page).

This patch implements that change, as well as updates the GDB Manual.
For now, it's a straight search-and-replace, as there was no real
section where the option could go.  Eventually, I think we will want
to dissociate the options relative to the remote protocol, from the
options specific to serial line handling. I think other option names
might need to be renamed as well, but this I've already far exceeded
the amount of time I could spend on this.

gdb/ChangeLog:

        * cli/cli-cmds.c (show_baud_rate): Moved to serial.c as
        serial_baud_show_cmd.
        (_initialize_cli_cmds): Delete the code creating the
        "set/show remotebaud" commands.
        * serial.c (baud_rate): Move here from top.c.
        (serial_baud_show_cmd): Move here from cli/cli-cmds.c.
        (_initialize_serial): Create "set/show serial baud" commands.
        Add "set/show remotebaud" command aliases.
        * top.c (baud_rate): Moved to serial.c.
        * NEWS: Document the new "set/show serial baud" commands,
        replacing "set/show remotebaud".

gdb/doc/ChangeLog:

        * gdb.texinfo: Replace "set remotebaud" and "show remotebaud"
        by "set serial baud" and "show serial baud" (resp) throughout.

I hope it's a sufficient improvement in itself. OK to apply?

-- 
Joel

[-- Attachment #2: 0001-Rename-set-show-remotebaud-command-into-set-show-ser.patch --]
[-- Type: text/x-diff, Size: 8306 bytes --]

From 7bb83681c2813a3f2cfb0afcd43284f931691bc7 Mon Sep 17 00:00:00 2001
From: Joel Brobecker <brobecker@adacore.com>
Date: Tue, 8 Oct 2013 17:55:02 +0400
Subject: [PATCH] Rename "set/show remotebaud" command into "set/show serial
 baud"

This patch renames the "set/show remotebaud" commands into
"set/show serial baud", and moves its implementation into serial.c.
It also moves the "baud_rate" global from top.c to serial.c, where
the new code is being added (the alternative was to add an include
of target.h).

And to facilitate the transition to the new setting name, this
patch also preserves the old commands, and marks them as deprecated
to alert the users of the change.

gdb/ChangeLog:

        * cli/cli-cmds.c (show_baud_rate): Moved to serial.c as
        serial_baud_show_cmd.
        (_initialize_cli_cmds): Delete the code creating the
        "set/show remotebaud" commands.
        * serial.c (baud_rate): Move here from top.c.
        (serial_baud_show_cmd): Move here from cli/cli-cmds.c.
        (_initialize_serial): Create "set/show serial baud" commands.
        Add "set/show remotebaud" command aliases.
        * top.c (baud_rate): Moved to serial.c.
        * NEWS: Document the new "set/show serial baud" commands,
        replacing "set/show remotebaud".

gdb/doc/ChangeLog:

        * gdb.texinfo: Replace "set remotebaud" and "show remotebaud"
        by "set serial baud" and "show serial baud" (resp) throughout.
---
 gdb/NEWS            |  5 +++++
 gdb/cli/cli-cmds.c  | 19 ------------------
 gdb/doc/gdb.texinfo |  8 ++++----
 gdb/serial.c        | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 gdb/top.c           |  7 -------
 5 files changed, 64 insertions(+), 30 deletions(-)

diff --git a/gdb/NEWS b/gdb/NEWS
index 8114fb1..4e627b0 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -200,6 +200,11 @@ qXfer:libraries-svr4:read's annex
 
 * GDB can now use Windows x64 unwinding data.
 
+* The "set remotebaud" command has been replaced by "set serial baud".
+  Similarly, "show remotebaud" has been replaced by "show serial baud".
+  The "set remotebaud" and "show remotebaud" commands are still available
+  to provide backward compatibility with older versions of GDB.
+
 *** Changes in GDB 7.6
 
 * Target record has been renamed to record-full.
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index 886ba7a..460b719 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -1582,14 +1582,6 @@ show_history_expansion_p (struct ui_file *file, int from_tty,
 }
 
 static void
-show_baud_rate (struct ui_file *file, int from_tty,
-		struct cmd_list_element *c, const char *value)
-{
-  fprintf_filtered (file, _("Baud rate for remote serial I/O is %s.\n"),
-		    value);
-}
-
-static void
 show_remote_debug (struct ui_file *file, int from_tty,
 		   struct cmd_list_element *c, const char *value)
 {
@@ -1748,17 +1740,6 @@ the previous command number shown."),
   add_cmd ("configuration", no_set_class, show_configuration,
 	   _("Show how GDB was configured at build time."), &showlist);
 
-  /* If target is open when baud changes, it doesn't take effect until
-     the next open (I think, not sure).  */
-  add_setshow_zinteger_cmd ("remotebaud", no_class, &baud_rate, _("\
-Set baud rate for remote serial I/O."), _("\
-Show baud rate for remote serial I/O."), _("\
-This value is used to set the speed of the serial port when debugging\n\
-using remote targets."),
-			    NULL,
-			    show_baud_rate,
-			    &setlist, &showlist);
-
   add_setshow_zinteger_cmd ("remote", no_class, &remote_debug, _("\
 Set debugging of remote protocol."), _("\
 Show debugging of remote protocol."), _("\
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index e196658..bda2e7b 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -18024,8 +18024,8 @@ target remote /dev/ttyb
 @end smallexample
 
 If you're using a serial line, you may want to give @value{GDBN} the
-@w{@samp{--baud}} option, or use the @code{set remotebaud} command
-(@pxref{Remote Configuration, set remotebaud}) before the
+@w{@samp{--baud}} option, or use the @code{set serial baud} command
+(@pxref{Remote Configuration, set serial baud}) before the
 @code{target} command.
 
 @item target remote @code{@var{host}:@var{port}}
@@ -18567,13 +18567,13 @@ default value is the number of bits in the target's address.
 @item show remoteaddresssize
 Show the current value of remote address size in bits.
 
-@item set remotebaud @var{n}
+@item set serial baud @var{n}
 @cindex baud rate for remote targets
 Set the baud rate for the remote serial I/O to @var{n} baud.  The
 value is used to set the speed of the serial port used for debugging
 remote targets.
 
-@item show remotebaud
+@item show serial baud
 Show the current speed of the remote connection.
 
 @item set remotebreak
diff --git a/gdb/serial.c b/gdb/serial.c
index ee3f1ea..3233e1b 100644
--- a/gdb/serial.c
+++ b/gdb/serial.c
@@ -621,6 +621,20 @@ serial_show_cmd (char *args, int from_tty)
   cmd_show_list (serial_show_cmdlist, from_tty, "");
 }
 
+/* Baud rate specified for talking to serial target systems.  Default
+   is left as -1, so targets can choose their own defaults.  */
+/* FIXME: This means that "show serial baud" and gr_files_info can
+   print -1 or (unsigned int)-1.  This is a Bad User Interface.  */
+
+int baud_rate = -1;
+
+static void
+serial_baud_show_cmd (struct ui_file *file, int from_tty,
+		      struct cmd_list_element *c, const char *value)
+{
+  fprintf_filtered (file, _("Baud rate for remote serial I/O is %s.\n"),
+		    value);
+}
 
 void
 _initialize_serial (void)
@@ -643,6 +657,47 @@ Show default serial/parallel port configuration."),
 		  0/*allow-unknown*/,
 		  &showlist);
 
+  /* If target is open when baud changes, it doesn't take effect until
+     the next open (I think, not sure).  */
+  add_setshow_zinteger_cmd ("baud", no_class, &baud_rate, _("\
+Set baud rate for remote serial I/O."), _("\
+Show baud rate for remote serial I/O."), _("\
+This value is used to set the speed of the serial port when debugging\n\
+using remote targets."),
+			    NULL,
+			    serial_baud_show_cmd,
+			    &serial_set_cmdlist, &serial_show_cmdlist);
+
+  /* The commands "set/show serial baud" used to have a different name.
+     Add aliases to those names to facilitate the transition, and mark
+     them as deprecated, in order to make users aware of the fact that
+     the command names have been changed.  */
+    {
+      const char *cmd_name;
+      struct cmd_list_element *cmd;
+
+      /* FIXME: There is a limitation in the deprecation mechanism,
+	 and the warning ends up not being displayed for prefixed
+	 aliases.  So use a real command instead of an alias.
+	 This is temporary code anyway, so should go away soon
+	 after the next release cycle starts.  */
+      add_setshow_zinteger_cmd ("remotebaud", class_alias, &baud_rate, _("\
+Set baud rate for remote serial I/O."), _("\
+Show baud rate for remote serial I/O."), _("\
+This value is used to set the speed of the serial port when debugging\n\
+using remote targets."),
+				NULL,
+				serial_baud_show_cmd,
+				&setlist, &showlist);
+      cmd_name = "remotebaud";
+      cmd = lookup_cmd (&cmd_name, setlist, "", -1, 1);
+      deprecate_cmd (cmd, "set serial baud");
+      cmd_name
+	= "remotebaud"; /* needed because lookup_cmd updates the pointer */
+      cmd = lookup_cmd (&cmd_name, showlist, "", -1, 1);
+      deprecate_cmd (cmd, "show serial baud");
+    }
+
   add_setshow_filename_cmd ("remotelogfile", no_class, &serial_logfile, _("\
 Set filename for remote session recording."), _("\
 Show filename for remote session recording."), _("\
diff --git a/gdb/top.c b/gdb/top.c
index d9128a3..c473d8c 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -144,13 +144,6 @@ int saved_command_line_size = 100;
    is issuing commands too.  */
 int server_command;
 
-/* Baud rate specified for talking to serial target systems.  Default
-   is left as -1, so targets can choose their own defaults.  */
-/* FIXME: This means that "show remotebaud" and gr_files_info can
-   print -1 or (unsigned int)-1.  This is a Bad User Interface.  */
-
-int baud_rate = -1;
-
 /* Timeout limit for response from target.  */
 
 /* The default value has been changed many times over the years.  It 
-- 
1.8.1.2


^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [RFA v2/code+DOCO+NEWS] new "set/show serial baud" command
  2013-10-09 11:23               ` [RFA v2/code+DOCO+NEWS] " Joel Brobecker
@ 2013-10-09 16:17                 ` Pedro Alves
  2013-10-10  5:55                   ` checked in: " Joel Brobecker
  2013-10-09 16:44                 ` Eli Zaretskii
  1 sibling, 1 reply; 44+ messages in thread
From: Pedro Alves @ 2013-10-09 16:17 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

On 10/09/2013 12:23 PM, Joel Brobecker wrote:
> Unfortunately, I hit a limitation when trying to deprecate the alias,
> and my guess is because the command is prefixed. I had a quick look,
> and basically, I think "lookup_cmd_1" recurses into himself by first
> finding the prefixed command, then does the recursion by trying to
> find the rest of the command within that prefix. It finds the command
> and notices the fact that it is deprecated, and even tries to warn
> the user by calling deprecated_cmd_warning.  But this function only
> takes the deprecated command names, and the name it passes is lacking
> the prefix (due to the recursion). As a result, deprecated_cmd_warning
> fails to find the aliased command and returns immediately:
> 
>   if (!lookup_cmd_composition (text, &alias, &prefix_cmd, &cmd))
>     /* Return if text doesn't evaluate to a command.  */
>     return;
> 

Bummer.


> Lifting that limitation would take a little bit more time than I have,
> so I went with the sort of trick as the one used in remote.c, which
> is to duplicate the command. 

Oh well.  That's fine with me.

> Not pretty, but as the FIXME says, it's
> temporary (I've already added a TODO item in the GDB 7.8 release
> management wiki page).

...

> +      /* FIXME: There is a limitation in the deprecation mechanism,
> +	 and the warning ends up not being displayed for prefixed
> +	 aliases.  So use a real command instead of an alias.
> +	 This is temporary code anyway, so should go away soon
> +	 after the next release cycle starts.  */

I actually think that "temporary anyway" comment should be removed.  We
don't really have a habit of removing deprecated commands.  Marking a
command deprecated already makes it less visible.  E.g., it removes the
command from completion suggestions.  As long as the old command doesn't
get in the way, there's really no pressing need to remove it.
"soon after the next release" has itself a tendency to get
old and outdated :-)

> This patch implements that change, as well as updates the GDB Manual.
> For now, it's a straight search-and-replace, as there was no real
> section where the option could go.  Eventually, I think we will want
> to dissociate the options relative to the remote protocol, from the
> options specific to serial line handling. I think other option names
> might need to be renamed as well, but this I've already far exceeded
> the amount of time I could spend on this.
> 
> gdb/ChangeLog:
> 
>         * cli/cli-cmds.c (show_baud_rate): Moved to serial.c as
>         serial_baud_show_cmd.
>         (_initialize_cli_cmds): Delete the code creating the
>         "set/show remotebaud" commands.
>         * serial.c (baud_rate): Move here from top.c.
>         (serial_baud_show_cmd): Move here from cli/cli-cmds.c.
>         (_initialize_serial): Create "set/show serial baud" commands.
>         Add "set/show remotebaud" command aliases.
>         * top.c (baud_rate): Moved to serial.c.
>         * NEWS: Document the new "set/show serial baud" commands,
>         replacing "set/show remotebaud".
> 
> gdb/doc/ChangeLog:
> 
>         * gdb.texinfo: Replace "set remotebaud" and "show remotebaud"
>         by "set serial baud" and "show serial baud" (resp) throughout.
> 
> I hope it's a sufficient improvement in itself. OK to apply?

This is fine with me.

-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [RFA v2/code+DOCO+NEWS] new "set/show serial baud" command
  2013-10-09 11:23               ` [RFA v2/code+DOCO+NEWS] " Joel Brobecker
  2013-10-09 16:17                 ` Pedro Alves
@ 2013-10-09 16:44                 ` Eli Zaretskii
  2013-10-10  5:59                   ` Joel Brobecker
  1 sibling, 1 reply; 44+ messages in thread
From: Eli Zaretskii @ 2013-10-09 16:44 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: palves, gdb-patches

> Date: Wed, 9 Oct 2013 15:23:34 +0400
> From: Joel Brobecker <brobecker@adacore.com>
> Cc: gdb-patches@sourceware.org
> 
> gdb/doc/ChangeLog:
> 
>         * gdb.texinfo: Replace "set remotebaud" and "show remotebaud"
>         by "set serial baud" and "show serial baud" (resp) throughout.

You didn't mention the node name in the log entry.

> diff --git a/gdb/NEWS b/gdb/NEWS
> index 8114fb1..4e627b0 100644
> --- a/gdb/NEWS
> +++ b/gdb/NEWS
> @@ -200,6 +200,11 @@ qXfer:libraries-svr4:read's annex
>  
>  * GDB can now use Windows x64 unwinding data.
>  
> +* The "set remotebaud" command has been replaced by "set serial baud".
> +  Similarly, "show remotebaud" has been replaced by "show serial baud".
> +  The "set remotebaud" and "show remotebaud" commands are still available
> +  to provide backward compatibility with older versions of GDB.
> +

This is OK.

>  If you're using a serial line, you may want to give @value{GDBN} the
> -@w{@samp{--baud}} option, or use the @code{set remotebaud} command
> -(@pxref{Remote Configuration, set remotebaud}) before the
> +@w{@samp{--baud}} option, or use the @code{set serial baud} command

Is @w really needed here?  You have only one word there anyway.

Otherwise, OK for the documentation parts.

Thanks.

^ permalink raw reply	[flat|nested] 44+ messages in thread

* checked in: [RFA v2/code+DOCO+NEWS] new "set/show serial baud" command
  2013-10-09 16:17                 ` Pedro Alves
@ 2013-10-10  5:55                   ` Joel Brobecker
  0 siblings, 0 replies; 44+ messages in thread
From: Joel Brobecker @ 2013-10-10  5:55 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 2573 bytes --]

> > +      /* FIXME: There is a limitation in the deprecation mechanism,
> > +	 and the warning ends up not being displayed for prefixed
> > +	 aliases.  So use a real command instead of an alias.
> > +	 This is temporary code anyway, so should go away soon
> > +	 after the next release cycle starts.  */
> 
> I actually think that "temporary anyway" comment should be removed.  We
> don't really have a habit of removing deprecated commands.  Marking a
> command deprecated already makes it less visible.  E.g., it removes the
> command from completion suggestions.  As long as the old command doesn't
> get in the way, there's really no pressing need to remove it.
> "soon after the next release" has itself a tendency to get
> old and outdated :-)
> 
> > This patch implements that change, as well as updates the GDB Manual.
> > For now, it's a straight search-and-replace, as there was no real
> > section where the option could go.  Eventually, I think we will want
> > to dissociate the options relative to the remote protocol, from the
> > options specific to serial line handling. I think other option names
> > might need to be renamed as well, but this I've already far exceeded
> > the amount of time I could spend on this.

OK, I removed the end of the comment entirely, even thought I've added
an AI for the 7.8 release to remove the "alias". Naturally, I'm fine
leaving it in for a while longer, if people prefer.

> > gdb/ChangeLog:
> > 
> >         * cli/cli-cmds.c (show_baud_rate): Moved to serial.c as
> >         serial_baud_show_cmd.
> >         (_initialize_cli_cmds): Delete the code creating the
> >         "set/show remotebaud" commands.
> >         * serial.c (baud_rate): Move here from top.c.
> >         (serial_baud_show_cmd): Move here from cli/cli-cmds.c.
> >         (_initialize_serial): Create "set/show serial baud" commands.
> >         Add "set/show remotebaud" command aliases.
> >         * top.c (baud_rate): Moved to serial.c.
> >         * NEWS: Document the new "set/show serial baud" commands,
> >         replacing "set/show remotebaud".
> > 
> > gdb/doc/ChangeLog:
> > 
> >         * gdb.texinfo: Replace "set remotebaud" and "show remotebaud"
> >         by "set serial baud" and "show serial baud" (resp) throughout.
> > 
> > I hope it's a sufficient improvement in itself. OK to apply?
> 
> This is fine with me.

Great, thanks! Attached is what I ended up checking in. The only
difference is the change in the comment.

For Eli's comment about @w, I am about to send a followup-patch,
with an explanation why.

-- 
Joel

[-- Attachment #2: 0001-Rename-set-show-remotebaud-command-into-set-show-ser.patch --]
[-- Type: text/x-diff, Size: 9509 bytes --]

From 59d587ee110e04e286cd6718abdbb6c113ff058e Mon Sep 17 00:00:00 2001
From: Joel Brobecker <brobecker@adacore.com>
Date: Tue, 8 Oct 2013 17:55:02 +0400
Subject: [PATCH] Rename "set/show remotebaud" command into "set/show serial
 baud"

This patch renames the "set/show remotebaud" commands into
"set/show serial baud", and moves its implementation into serial.c.
It also moves the "baud_rate" global from top.c to serial.c, where
the new code is being added (the alternative was to add an include
of target.h).

And to facilitate the transition to the new setting name, this
patch also preserves the old commands, and marks them as deprecated
to alert the users of the change.

gdb/ChangeLog:

        * cli/cli-cmds.c (show_baud_rate): Moved to serial.c as
        serial_baud_show_cmd.
        (_initialize_cli_cmds): Delete the code creating the
        "set/show remotebaud" commands.
        * serial.c (baud_rate): Move here from top.c.
        (serial_baud_show_cmd): Move here from cli/cli-cmds.c.
        (_initialize_serial): Create "set/show serial baud" commands.
        Add "set/show remotebaud" command aliases.
        * top.c (baud_rate): Moved to serial.c.
        * NEWS: Document the new "set/show serial baud" commands,
        replacing "set/show remotebaud".

gdb/doc/ChangeLog:

        * gdb.texinfo: Replace "set remotebaud" and "show remotebaud"
        by "set serial baud" and "show serial baud" (resp) throughout.
---
 gdb/ChangeLog       | 14 ++++++++++++++
 gdb/NEWS            |  5 +++++
 gdb/cli/cli-cmds.c  | 19 -------------------
 gdb/doc/ChangeLog   |  5 +++++
 gdb/doc/gdb.texinfo |  8 ++++----
 gdb/serial.c        | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 gdb/top.c           |  7 -------
 7 files changed, 81 insertions(+), 30 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 21bc3fe..4372579 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,17 @@
+2013-10-10  Joel Brobecker  <brobecker@adacore.com>
+
+	* cli/cli-cmds.c (show_baud_rate): Moved to serial.c as
+	serial_baud_show_cmd.
+	(_initialize_cli_cmds): Delete the code creating the
+	"set/show remotebaud" commands.
+	* serial.c (baud_rate): Move here from top.c.
+	(serial_baud_show_cmd): Move here from cli/cli-cmds.c.
+	(_initialize_serial): Create "set/show serial baud" commands.
+	Add "set/show remotebaud" command aliases.
+	* top.c (baud_rate): Moved to serial.c.
+	* NEWS: Document the new "set/show serial baud" commands,
+	replacing "set/show remotebaud".
+
 2013-10-09  Pedro Alves  <palves@redhat.com>
 
 	* breakpoint.c (insert_bp_location): Use memory_error_message to
diff --git a/gdb/NEWS b/gdb/NEWS
index 8114fb1..4e627b0 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -200,6 +200,11 @@ qXfer:libraries-svr4:read's annex
 
 * GDB can now use Windows x64 unwinding data.
 
+* The "set remotebaud" command has been replaced by "set serial baud".
+  Similarly, "show remotebaud" has been replaced by "show serial baud".
+  The "set remotebaud" and "show remotebaud" commands are still available
+  to provide backward compatibility with older versions of GDB.
+
 *** Changes in GDB 7.6
 
 * Target record has been renamed to record-full.
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index 886ba7a..460b719 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -1582,14 +1582,6 @@ show_history_expansion_p (struct ui_file *file, int from_tty,
 }
 
 static void
-show_baud_rate (struct ui_file *file, int from_tty,
-		struct cmd_list_element *c, const char *value)
-{
-  fprintf_filtered (file, _("Baud rate for remote serial I/O is %s.\n"),
-		    value);
-}
-
-static void
 show_remote_debug (struct ui_file *file, int from_tty,
 		   struct cmd_list_element *c, const char *value)
 {
@@ -1748,17 +1740,6 @@ the previous command number shown."),
   add_cmd ("configuration", no_set_class, show_configuration,
 	   _("Show how GDB was configured at build time."), &showlist);
 
-  /* If target is open when baud changes, it doesn't take effect until
-     the next open (I think, not sure).  */
-  add_setshow_zinteger_cmd ("remotebaud", no_class, &baud_rate, _("\
-Set baud rate for remote serial I/O."), _("\
-Show baud rate for remote serial I/O."), _("\
-This value is used to set the speed of the serial port when debugging\n\
-using remote targets."),
-			    NULL,
-			    show_baud_rate,
-			    &setlist, &showlist);
-
   add_setshow_zinteger_cmd ("remote", no_class, &remote_debug, _("\
 Set debugging of remote protocol."), _("\
 Show debugging of remote protocol."), _("\
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index 5141b3c..21b2a28 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,3 +1,8 @@
+2013-10-10  Joel Brobecker  <brobecker@adacore.com>
+
+	* gdb.texinfo: Replace "set remotebaud" and "show remotebaud"
+	by "set serial baud" and "show serial baud" (resp) throughout.
+
 2013-10-07  Pedro Alves  <palves@redhat.com>
 
 	PR breakpoints/11568
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index e196658..bda2e7b 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -18024,8 +18024,8 @@ target remote /dev/ttyb
 @end smallexample
 
 If you're using a serial line, you may want to give @value{GDBN} the
-@w{@samp{--baud}} option, or use the @code{set remotebaud} command
-(@pxref{Remote Configuration, set remotebaud}) before the
+@w{@samp{--baud}} option, or use the @code{set serial baud} command
+(@pxref{Remote Configuration, set serial baud}) before the
 @code{target} command.
 
 @item target remote @code{@var{host}:@var{port}}
@@ -18567,13 +18567,13 @@ default value is the number of bits in the target's address.
 @item show remoteaddresssize
 Show the current value of remote address size in bits.
 
-@item set remotebaud @var{n}
+@item set serial baud @var{n}
 @cindex baud rate for remote targets
 Set the baud rate for the remote serial I/O to @var{n} baud.  The
 value is used to set the speed of the serial port used for debugging
 remote targets.
 
-@item show remotebaud
+@item show serial baud
 Show the current speed of the remote connection.
 
 @item set remotebreak
diff --git a/gdb/serial.c b/gdb/serial.c
index ee3f1ea..f2a9648 100644
--- a/gdb/serial.c
+++ b/gdb/serial.c
@@ -621,6 +621,20 @@ serial_show_cmd (char *args, int from_tty)
   cmd_show_list (serial_show_cmdlist, from_tty, "");
 }
 
+/* Baud rate specified for talking to serial target systems.  Default
+   is left as -1, so targets can choose their own defaults.  */
+/* FIXME: This means that "show serial baud" and gr_files_info can
+   print -1 or (unsigned int)-1.  This is a Bad User Interface.  */
+
+int baud_rate = -1;
+
+static void
+serial_baud_show_cmd (struct ui_file *file, int from_tty,
+		      struct cmd_list_element *c, const char *value)
+{
+  fprintf_filtered (file, _("Baud rate for remote serial I/O is %s.\n"),
+		    value);
+}
 
 void
 _initialize_serial (void)
@@ -643,6 +657,45 @@ Show default serial/parallel port configuration."),
 		  0/*allow-unknown*/,
 		  &showlist);
 
+  /* If target is open when baud changes, it doesn't take effect until
+     the next open (I think, not sure).  */
+  add_setshow_zinteger_cmd ("baud", no_class, &baud_rate, _("\
+Set baud rate for remote serial I/O."), _("\
+Show baud rate for remote serial I/O."), _("\
+This value is used to set the speed of the serial port when debugging\n\
+using remote targets."),
+			    NULL,
+			    serial_baud_show_cmd,
+			    &serial_set_cmdlist, &serial_show_cmdlist);
+
+  /* The commands "set/show serial baud" used to have a different name.
+     Add aliases to those names to facilitate the transition, and mark
+     them as deprecated, in order to make users aware of the fact that
+     the command names have been changed.  */
+    {
+      const char *cmd_name;
+      struct cmd_list_element *cmd;
+
+      /* FIXME: There is a limitation in the deprecation mechanism,
+	 and the warning ends up not being displayed for prefixed
+	 aliases.  So use a real command instead of an alias.  */
+      add_setshow_zinteger_cmd ("remotebaud", class_alias, &baud_rate, _("\
+Set baud rate for remote serial I/O."), _("\
+Show baud rate for remote serial I/O."), _("\
+This value is used to set the speed of the serial port when debugging\n\
+using remote targets."),
+				NULL,
+				serial_baud_show_cmd,
+				&setlist, &showlist);
+      cmd_name = "remotebaud";
+      cmd = lookup_cmd (&cmd_name, setlist, "", -1, 1);
+      deprecate_cmd (cmd, "set serial baud");
+      cmd_name
+	= "remotebaud"; /* needed because lookup_cmd updates the pointer */
+      cmd = lookup_cmd (&cmd_name, showlist, "", -1, 1);
+      deprecate_cmd (cmd, "show serial baud");
+    }
+
   add_setshow_filename_cmd ("remotelogfile", no_class, &serial_logfile, _("\
 Set filename for remote session recording."), _("\
 Show filename for remote session recording."), _("\
diff --git a/gdb/top.c b/gdb/top.c
index d9128a3..c473d8c 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -144,13 +144,6 @@ int saved_command_line_size = 100;
    is issuing commands too.  */
 int server_command;
 
-/* Baud rate specified for talking to serial target systems.  Default
-   is left as -1, so targets can choose their own defaults.  */
-/* FIXME: This means that "show remotebaud" and gr_files_info can
-   print -1 or (unsigned int)-1.  This is a Bad User Interface.  */
-
-int baud_rate = -1;
-
 /* Timeout limit for response from target.  */
 
 /* The default value has been changed many times over the years.  It 
-- 
1.8.1.2


^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [RFA v2/code+DOCO+NEWS] new "set/show serial baud" command
  2013-10-09 16:44                 ` Eli Zaretskii
@ 2013-10-10  5:59                   ` Joel Brobecker
  2013-10-10 16:06                     ` Eli Zaretskii
  0 siblings, 1 reply; 44+ messages in thread
From: Joel Brobecker @ 2013-10-10  5:59 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: palves, gdb-patches

[-- Attachment #1: Type: text/plain, Size: 1198 bytes --]

> > gdb/doc/ChangeLog:
> > 
> >         * gdb.texinfo: Replace "set remotebaud" and "show remotebaud"
> >         by "set serial baud" and "show serial baud" (resp) throughout.
> 
> You didn't mention the node name in the log entry.

That was intentional, because it's a global search and replace.
It's allowed by the GCS, but if you still prefer I repeat the node
names, let me know, and I will dig them out.

> >  If you're using a serial line, you may want to give @value{GDBN} the
> > -@w{@samp{--baud}} option, or use the @code{set remotebaud} command
> > -(@pxref{Remote Configuration, set remotebaud}) before the
> > +@w{@samp{--baud}} option, or use the @code{set serial baud} command
> 
> Is @w really needed here?  You have only one word there anyway.
> 
> Otherwise, OK for the documentation parts.

Thanks! For @w, now that I know what it means :-), I agree it does
seem useless. But it was there before, so in the spirit of not
mixing independent changes in the same patch, here is a second one
that removes it.

gdb/doc/ChangeLog:

        * gdb.texinfo (Connecting): Remove unnecessary @w{}.

I will check it in as pre-approved/obvious.  Tested on x86_64-linux.

Thank you!
-- 
Joel

[-- Attachment #2: 0001-Remove-unnecessary-w-in-gdb.texinfo.patch --]
[-- Type: text/x-diff, Size: 881 bytes --]

From 03e74b48b0c1a50bae671083f1530b1fe155e709 Mon Sep 17 00:00:00 2001
From: Joel Brobecker <brobecker@adacore.com>
Date: Thu, 10 Oct 2013 09:51:02 +0400
Subject: [PATCH] Remove unnecessary @w{} in gdb.texinfo

gdb/doc/ChangeLog:

        * gdb.texinfo (Connecting): Remove unnecessary @w{}.
---
 gdb/doc/gdb.texinfo | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index bda2e7b..24773ea 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -18024,7 +18024,7 @@ target remote /dev/ttyb
 @end smallexample
 
 If you're using a serial line, you may want to give @value{GDBN} the
-@w{@samp{--baud}} option, or use the @code{set serial baud} command
+@samp{--baud} option, or use the @code{set serial baud} command
 (@pxref{Remote Configuration, set serial baud}) before the
 @code{target} command.
 
-- 
1.8.1.2


^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [RFA v2/code+DOCO+NEWS] new "set/show serial baud" command
  2013-10-10  5:59                   ` Joel Brobecker
@ 2013-10-10 16:06                     ` Eli Zaretskii
  2013-10-11  4:51                       ` Joel Brobecker
  0 siblings, 1 reply; 44+ messages in thread
From: Eli Zaretskii @ 2013-10-10 16:06 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: palves, gdb-patches

> Date: Thu, 10 Oct 2013 09:59:28 +0400
> From: Joel Brobecker <brobecker@adacore.com>
> Cc: palves@redhat.com, gdb-patches@sourceware.org
> 
> > > gdb/doc/ChangeLog:
> > > 
> > >         * gdb.texinfo: Replace "set remotebaud" and "show remotebaud"
> > >         by "set serial baud" and "show serial baud" (resp) throughout.
> > 
> > You didn't mention the node name in the log entry.
> 
> That was intentional, because it's a global search and replace.
> It's allowed by the GCS, but if you still prefer I repeat the node
> names, let me know, and I will dig them out.

Yes, I do prefer naming the nodes.  This makes it easier to search for
changes that modified a given node.

> > >  If you're using a serial line, you may want to give @value{GDBN} the
> > > -@w{@samp{--baud}} option, or use the @code{set remotebaud} command
> > > -(@pxref{Remote Configuration, set remotebaud}) before the
> > > +@w{@samp{--baud}} option, or use the @code{set serial baud} command
> > 
> > Is @w really needed here?  You have only one word there anyway.
> > 
> > Otherwise, OK for the documentation parts.
> 
> Thanks! For @w, now that I know what it means :-), I agree it does
> seem useless. But it was there before, so in the spirit of not
> mixing independent changes in the same patch, here is a second one
> that removes it.

Great, thanks.

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [RFA v2/code+DOCO+NEWS] new "set/show serial baud" command
  2013-10-10 16:06                     ` Eli Zaretskii
@ 2013-10-11  4:51                       ` Joel Brobecker
  2013-10-11  7:02                         ` Eli Zaretskii
  0 siblings, 1 reply; 44+ messages in thread
From: Joel Brobecker @ 2013-10-11  4:51 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: gdb-patches

> Yes, I do prefer naming the nodes.  This makes it easier to search for
> changes that modified a given node.

OK, that's fair enough, especially for a change of this (small) size.
Here is the new ChangeLog entry I just checked in:

        * gdb.texinfo (Connecting): Replace "set remotebaud" by "set
        serial baud".
        (Remote Configuration): Replace "set remotebaud" by "set serial
        baud".  Replace "show remotebaud" by "show serial baud".

-- 
Joel

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [RFA v2/code+DOCO+NEWS] new "set/show serial baud" command
  2013-10-11  4:51                       ` Joel Brobecker
@ 2013-10-11  7:02                         ` Eli Zaretskii
  0 siblings, 0 replies; 44+ messages in thread
From: Eli Zaretskii @ 2013-10-11  7:02 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

> Date: Fri, 11 Oct 2013 08:51:55 +0400
> From: Joel Brobecker <brobecker@adacore.com>
> Cc: gdb-patches@sourceware.org
> 
> Here is the new ChangeLog entry I just checked in:
> 
>         * gdb.texinfo (Connecting): Replace "set remotebaud" by "set
>         serial baud".
>         (Remote Configuration): Replace "set remotebaud" by "set serial
>         baud".  Replace "show remotebaud" by "show serial baud".

Thank you.

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: Setting parity for remote serial
  2015-03-23 15:36                   ` Eli Zaretskii
@ 2015-03-23 21:21                     ` Yurij Grechishhev
  0 siblings, 0 replies; 44+ messages in thread
From: Yurij Grechishhev @ 2015-03-23 21:21 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Joel Brobecker, gdb-patches

[-- Attachment #1: Type: text/plain, Size: 376 bytes --]

Hello Joel,
Updated patch is attached.

--
Thanks,
Yury

2015-03-23 18:36 GMT+03:00 Eli Zaretskii <eliz@gnu.org>:
>> Date: Mon, 23 Mar 2015 01:52:26 +0300
>> From: Yurij Grechishhev <yurij.grechishhev@gmail.com>
>> Cc: gdb-patches@sourceware.org
>>
>> Updated patch is below. Also I've fixed one issue with zeroing PARENB flag.
>
> OK for the documentation parts.
>
> Thanks.

[-- Attachment #2: 0001-Add-set-show-serial-parity-command.patch --]
[-- Type: text/x-patch, Size: 15277 bytes --]

From abcc5818193f0a48cc858a4cc760fd7b15cf89cd Mon Sep 17 00:00:00 2001
From: Yury Grechishchev <yury.grechishchev@yotadevices.com>
Date: Tue, 24 Mar 2015 00:15:42 +0300
Subject: [PATCH] Add set/show serial parity command.

---
 gdb/ChangeLog       |   34 ++++++++++++++++++++++++++++++++++
 gdb/NEWS            |    4 ++++
 gdb/doc/ChangeLog   |    5 +++++
 gdb/doc/gdb.texinfo |    7 +++++++
 gdb/monitor.c       |    1 +
 gdb/remote.c        |    1 +
 gdb/ser-base.c      |    8 ++++++++
 gdb/ser-base.h      |    1 +
 gdb/ser-go32.c      |    1 +
 gdb/ser-mingw.c     |   40 ++++++++++++++++++++++++++++++++++++++--
 gdb/ser-pipe.c      |    1 +
 gdb/ser-tcp.c       |    1 +
 gdb/ser-unix.c      |   51 +++++++++++++++++++++++++++++++++++++++++++++++++--
 gdb/serial.c        |   40 ++++++++++++++++++++++++++++++++++++++++
 gdb/serial.h        |   11 +++++++++++
 gdb/target.h        |    4 ++++
 16 files changed, 206 insertions(+), 4 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index ca8bbaf..fabadf3 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,37 @@
+2015-03-21  Yurij Grechishhev  <yurij.grechishhev@gmail.com>
+
+	* 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.
+
 2015-03-17  Yurij Grechishhev  <yurij.grechishhev@gmail.com>
 
 	* ser-base.h (ser_base_setstopbits): Change second argument name
diff --git a/gdb/NEWS b/gdb/NEWS
index bda4a35..3fa33c9 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -3,6 +3,10 @@
 
 *** Changes since GDB 7.9
 
+* GDB has two new commands: "set serial parity odd|even|none" and
+  "show serial parity".  These allows to set or show parity for the
+  remote serial I/O.
+
 * The "info source" command now displays the producer string if it was
   present in the debug info.  This typically includes the compiler version
   and may include things like its command line arguments.
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index 5efb060..f7d6485 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,3 +1,8 @@
+2015-03-16  Yurij Grechishhev  <yurij.grechishhev@gmail.com>
+
+	* gdb.texinfo (Remote configuration): Document "set/show
+	serial parity" command.
+
 2015-03-11  Gary Benson <gbenson@redhat.com>
 
 	* gdb.texinfo (Remote Configuration): Document the
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 9e71642..a818d58 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -19443,6 +19443,13 @@ remote targets.
 @item show serial baud
 Show the current speed of the remote connection.
 
+@item set serial parity @var{parity}
+Set the parity for the remote serial I/O.  Supported values of @var{parity} are:
+@code{even}, @code{none}, and @code{odd}.  The default is @code{none}.
+
+@item show serial parity
+Show the current parity of the serial port.
+
 @item set remotebreak
 @cindex interrupt remote programs
 @cindex BREAK signal instead of Ctrl-C
diff --git a/gdb/monitor.c b/gdb/monitor.c
index b040ec4..548dae3 100644
--- a/gdb/monitor.c
+++ b/gdb/monitor.c
@@ -767,6 +767,7 @@ monitor_open (const char *args, struct monitor_ops *mon_ops, int from_tty)
 	}
     }
 
+  serial_setparity (monitor_desc, serial_parity);
   serial_raw (monitor_desc);
 
   serial_flush_input (monitor_desc);
diff --git a/gdb/remote.c b/gdb/remote.c
index 9aaee13..ed3ab57 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -4310,6 +4310,7 @@ remote_open_1 (const char *name, int from_tty,
 	}
     }
 
+  serial_setparity (rs->remote_desc, serial_parity);
   serial_raw (rs->remote_desc);
 
   /* If there is something sitting in the buffer we might take it as a
diff --git a/gdb/ser-base.c b/gdb/ser-base.c
index 87817c4..09aacec 100644
--- a/gdb/ser-base.c
+++ b/gdb/ser-base.c
@@ -541,6 +541,14 @@ ser_base_setstopbits (struct serial *scb, int num)
   return 0;			/* Never fails!  */
 }
 
+/* Implement the "setparity" serial_ops callback.  */
+
+int
+ser_base_setparity (struct serial *scb, int parity)
+{
+  return 0;			/* Never fails!  */
+}
+
 /* Put the SERIAL device into/out-of ASYNC mode.  */
 
 void
diff --git a/gdb/ser-base.h b/gdb/ser-base.h
index 6aac925..bb1c51d 100644
--- a/gdb/ser-base.h
+++ b/gdb/ser-base.h
@@ -43,6 +43,7 @@ extern int ser_base_noflush_set_tty_state (struct serial *scb,
 					   serial_ttystate old_ttystate);
 extern int ser_base_setbaudrate (struct serial *scb, int rate);
 extern int ser_base_setstopbits (struct serial *scb, int num);
+extern int ser_base_setparity (struct serial *scb, int parity);
 extern int ser_base_drain_output (struct serial *scb);
 
 extern int ser_base_write (struct serial *scb, const void *buf, size_t count);
diff --git a/gdb/ser-go32.c b/gdb/ser-go32.c
index 6bf1b4e..bbcf6af 100644
--- a/gdb/ser-go32.c
+++ b/gdb/ser-go32.c
@@ -864,6 +864,7 @@ static const struct serial_ops dos_ops =
   dos_noflush_set_tty_state,
   dos_setbaudrate,
   dos_setstopbits,
+  dos_noop,
   dos_noop,			/* Wait for output to drain.  */
   (void (*)(struct serial *, int))NULL	/* Change into async mode.  */
 };
diff --git a/gdb/ser-mingw.c b/gdb/ser-mingw.c
index 7f335e9..6d383ac 100644
--- a/gdb/ser-mingw.c
+++ b/gdb/ser-mingw.c
@@ -153,7 +153,6 @@ ser_windows_raw (struct serial *scb)
   if (GetCommState (h, &state) == 0)
     return;
 
-  state.fParity = FALSE;
   state.fOutxCtsFlow = FALSE;
   state.fOutxDsrFlow = FALSE;
   state.fDtrControl = DTR_CONTROL_ENABLE;
@@ -163,7 +162,6 @@ ser_windows_raw (struct serial *scb)
   state.fNull = FALSE;
   state.fAbortOnError = FALSE;
   state.ByteSize = 8;
-  state.Parity = NOPARITY;
 
   scb->current_timeout = 0;
 
@@ -198,6 +196,40 @@ ser_windows_setstopbits (struct serial *scb, int num)
   return (SetCommState (h, &state) != 0) ? 0 : -1;
 }
 
+/* Implement the "setparity" serial_ops callback.  */
+
+static int
+ser_windows_setparity (struct serial *scb, int parity)
+{
+  HANDLE h = (HANDLE) _get_osfhandle (scb->fd);
+  DCB state;
+
+  if (GetCommState (h, &state) == 0)
+    return -1;
+
+  switch (parity)
+    {
+    case GDBPARITY_NONE:
+      state.Parity = NOPARITY;
+      state.fParity = FALSE;
+      break;
+    case GDBPARITY_ODD:
+      state.Parity = ODDPARITY;
+      state.fParity = TRUE;
+      break;
+    case GDBPARITY_EVEN:
+      state.Parity = EVENPARITY;
+      state.fParity = TRUE;
+      break;
+    default:
+      internal_warning (__FILE__, __LINE__,
+                  "Incorrect parity value: %d", parity);
+      return -1;
+    }
+
+  return (SetCommState (h, &state) != 0) ? 0 : -1;
+}
+
 static int
 ser_windows_setbaudrate (struct serial *scb, int rate)
 {
@@ -1227,6 +1259,7 @@ static const struct serial_ops hardwire_ops =
   ser_base_noflush_set_tty_state,
   ser_windows_setbaudrate,
   ser_windows_setstopbits,
+  ser_windows_setparity,
   ser_windows_drain_output,
   ser_base_async,
   ser_windows_read_prim,
@@ -1257,6 +1290,7 @@ static const struct serial_ops tty_ops =
   ser_base_noflush_set_tty_state,
   NULL,
   NULL,
+  NULL,
   ser_base_drain_output,
   NULL,
   NULL,
@@ -1287,6 +1321,7 @@ static const struct serial_ops pipe_ops =
   ser_base_noflush_set_tty_state,
   ser_base_setbaudrate,
   ser_base_setstopbits,
+  ser_base_setparity,
   ser_base_drain_output,
   ser_base_async,
   pipe_windows_read,
@@ -1317,6 +1352,7 @@ static const struct serial_ops tcp_ops =
   ser_base_noflush_set_tty_state,
   ser_base_setbaudrate,
   ser_base_setstopbits,
+  ser_base_setparity,
   ser_base_drain_output,
   ser_base_async,
   net_read_prim,
diff --git a/gdb/ser-pipe.c b/gdb/ser-pipe.c
index bf5e4d4..0700132 100644
--- a/gdb/ser-pipe.c
+++ b/gdb/ser-pipe.c
@@ -224,6 +224,7 @@ static const struct serial_ops pipe_ops =
   ser_base_noflush_set_tty_state,
   ser_base_setbaudrate,
   ser_base_setstopbits,
+  ser_base_setparity,
   ser_base_drain_output,
   ser_base_async,
   ser_unix_read_prim,
diff --git a/gdb/ser-tcp.c b/gdb/ser-tcp.c
index 9c3dcf4..35512e6 100644
--- a/gdb/ser-tcp.c
+++ b/gdb/ser-tcp.c
@@ -394,6 +394,7 @@ static const struct serial_ops tcp_ops =
   ser_base_noflush_set_tty_state,
   ser_base_setbaudrate,
   ser_base_setstopbits,
+  ser_base_setparity,
   ser_base_drain_output,
   ser_base_async,
   net_read_prim,
diff --git a/gdb/ser-unix.c b/gdb/ser-unix.c
index 4125797..280fb6a 100644
--- a/gdb/ser-unix.c
+++ b/gdb/ser-unix.c
@@ -83,6 +83,7 @@ static int hardwire_readchar (struct serial *scb, int timeout);
 static int do_hardwire_readchar (struct serial *scb, int timeout);
 static int rate_to_code (int rate);
 static int hardwire_setbaudrate (struct serial *scb, int rate);
+static int hardwire_setparity (struct serial *scb, int parity);
 static void hardwire_close (struct serial *scb);
 static int get_tty_state (struct serial *scb,
 			  struct hardwire_ttystate * state);
@@ -409,7 +410,7 @@ hardwire_raw (struct serial *scb)
   state.termios.c_iflag = 0;
   state.termios.c_oflag = 0;
   state.termios.c_lflag = 0;
-  state.termios.c_cflag &= ~(CSIZE | PARENB);
+  state.termios.c_cflag &= ~CSIZE;
   state.termios.c_cflag |= CLOCAL | CS8;
 #ifdef CRTSCTS
   /* h/w flow control.  */
@@ -432,7 +433,7 @@ hardwire_raw (struct serial *scb)
   state.termio.c_iflag = 0;
   state.termio.c_oflag = 0;
   state.termio.c_lflag = 0;
-  state.termio.c_cflag &= ~(CSIZE | PARENB);
+  state.termio.c_cflag &= ~CSIZE;
   state.termio.c_cflag |= CLOCAL | CS8;
   state.termio.c_cc[VMIN] = 0;
   state.termio.c_cc[VTIME] = 0;
@@ -893,6 +894,51 @@ hardwire_setstopbits (struct serial *scb, int num)
   return set_tty_state (scb, &state);
 }
 
+/* Implement the "setparity" serial_ops callback.  */
+
+static int
+hardwire_setparity (struct serial *scb, int parity)
+{
+  struct hardwire_ttystate state;
+  int newparity = 0;
+
+  if (get_tty_state (scb, &state))
+    return -1;
+
+  switch (parity)
+    {
+    case GDBPARITY_NONE:
+      newparity = 0;
+      break;
+    case GDBPARITY_ODD:
+      newparity = PARENB | PARODD;
+      break;
+    case GDBPARITY_EVEN:
+      newparity = PARENB;
+      break;
+    default:
+      internal_warning (__FILE__, __LINE__,
+                  "Incorrect parity value: %d", parity);
+      return -1;
+    }
+
+#ifdef HAVE_TERMIOS
+  state.termios.c_cflag &= ~(PARENB | PARODD);
+  state.termios.c_cflag |= newparity;
+#endif
+
+#ifdef HAVE_TERMIO
+  state.termio.c_cflag &= ~(PARENB | PARODD);
+  state.termio.c_cflag |= newparity;
+#endif
+
+#ifdef HAVE_SGTTY
+  return 0;            /* sgtty doesn't support this */
+#endif
+  return set_tty_state (scb, &state);
+}
+
+
 static void
 hardwire_close (struct serial *scb)
 {
@@ -929,6 +975,7 @@ static const struct serial_ops hardwire_ops =
   hardwire_noflush_set_tty_state,
   hardwire_setbaudrate,
   hardwire_setstopbits,
+  hardwire_setparity,
   hardwire_drain_output,
   ser_base_async,
   ser_unix_read_prim,
diff --git a/gdb/serial.c b/gdb/serial.c
index b7e620d..74567db 100644
--- a/gdb/serial.c
+++ b/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."), _("\
diff --git a/gdb/serial.h b/gdb/serial.h
index 9eb1c39..add0f15 100644
--- a/gdb/serial.h
+++ b/gdb/serial.h
@@ -186,6 +186,14 @@ extern int serial_setbaudrate (struct serial *scb, int rate);
 
 extern int serial_setstopbits (struct serial *scb, int num);
 
+#define GDBPARITY_NONE     0
+#define GDBPARITY_ODD      1
+#define GDBPARITY_EVEN     2
+
+/* Set parity for serial port. Returns 0 for success, -1 for failure.  */
+
+extern int serial_setparity (struct serial *scb, int parity);
+
 /* Asynchronous serial interface: */
 
 /* Can the serial device support asynchronous mode?  */
@@ -271,6 +279,9 @@ struct serial_ops
 				  serial_ttystate);
     int (*setbaudrate) (struct serial *, int rate);
     int (*setstopbits) (struct serial *, int num);
+    /* Set the value PARITY as parity setting for serial object.
+       Return 0 in the case of success.  */
+    int (*setparity) (struct serial *, int parity);
     /* Wait for output to drain.  */
     int (*drain_output) (struct serial *);
     /* Change the serial device into/out of asynchronous mode, call
diff --git a/gdb/target.h b/gdb/target.h
index c95e1a4..05dcd9f 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -2236,6 +2236,10 @@ extern int remote_debug;
 
 /* Speed in bits per second, or -1 which means don't mess with the speed.  */
 extern int baud_rate;
+
+/* Parity for serial port  */
+extern int serial_parity;
+
 /* Timeout limit for response from target.  */
 extern int remote_timeout;
 
-- 
1.7.9.5


^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: Setting parity for remote serial
  2015-03-22 22:52                 ` Yurij Grechishhev
  2015-03-23 13:11                   ` Joel Brobecker
@ 2015-03-23 15:36                   ` Eli Zaretskii
  2015-03-23 21:21                     ` Yurij Grechishhev
  1 sibling, 1 reply; 44+ messages in thread
From: Eli Zaretskii @ 2015-03-23 15:36 UTC (permalink / raw)
  To: Yurij Grechishhev; +Cc: brobecker, gdb-patches

> Date: Mon, 23 Mar 2015 01:52:26 +0300
> From: Yurij Grechishhev <yurij.grechishhev@gmail.com>
> Cc: gdb-patches@sourceware.org
> 
> Updated patch is below. Also I've fixed one issue with zeroing PARENB flag.

OK for the documentation parts.

Thanks.

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: Setting parity for remote serial
  2015-03-22 22:52                 ` Yurij Grechishhev
@ 2015-03-23 13:11                   ` Joel Brobecker
  2015-03-23 15:36                   ` Eli Zaretskii
  1 sibling, 0 replies; 44+ messages in thread
From: Joel Brobecker @ 2015-03-23 13:11 UTC (permalink / raw)
  To: Yurij Grechishhev; +Cc: gdb-patches

> Unfortunately, now I don't have the ability to fully-test it with
> windows (but I was checking initial version one year ago, with real
> hardware). Now it has been compiled by using mingw with
> --host=i586-mingw32msvc.

No problem - the code looked about right to me, and we will let those
who do work on Windows take care of fixing any bugs if they use this
feature and encounter a bug.

> diff --git a/gdb/ChangeLog b/gdb/ChangeLog
> index ca8bbaf..02f9ddc 100644
> --- a/gdb/ChangeLog
> +++ b/gdb/ChangeLog
> @@ -1,3 +1,37 @@
> +2015-03-21  Yurij Grechishhev  <yurij.grechishhev@gmail.com>
> +
> +    * 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): Add dos_noop field.

The name of the struct field is actually "setparity" (instead of
"dos_noop").

> +    * ser-mingw.c (ser_windows_raw): Remove state.fParity and
> +    state.Parity definitions.

"Do not set state.fParity and state.Parity". You remmoved assignments,
rather than definitions.

> +    (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.

Wrong indentation of "New static globals". I suspect that this is
because you used 8 spaces instead of a tab to indent that line?

> +    (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.
> +    (serial_ops): Add setparity entry.

Let's say...

        (struct serial_ops): Add setparity field

... instead.

> +    * target.h (serial_parity): Add declaration.

The rest are minor comments:

> +      internal_warning (__FILE__, __LINE__, "Incorrect parity value:
> %d", parity);

This line is too long. It shouldn't exceed 79 characters.

      internal_warning (__FILE__, __LINE__, "Incorrect parity value: %d", parity);

Use instead:

      internal_warning (__FILE__, __LINE__,
			"Incorrect parity value: %d", parity);

Also, watch out for the fact that your mailer appears to have wrapped
the line. I suggest you switch to sending the patch either using
"git send-email" (the recommended method), or else sending the patch
as an attachment ("git format-patch" + attach to email).

> @@ -409,7 +410,7 @@ hardwire_raw (struct serial *scb)
>    state.termios.c_iflag = 0;
>    state.termios.c_oflag = 0;
>    state.termios.c_lflag = 0;
> -  state.termios.c_cflag &= ~(CSIZE | PARENB);
> +  state.termios.c_cflag &= ~(CSIZE);

You don't really need the parentheses anymore -> ~CSIZE

>    state.termios.c_cflag |= CLOCAL | CS8;
>  #ifdef CRTSCTS
>    /* h/w flow control.  */
> @@ -432,7 +433,7 @@ hardwire_raw (struct serial *scb)
>    state.termio.c_iflag = 0;
>    state.termio.c_oflag = 0;
>    state.termio.c_lflag = 0;
> -  state.termio.c_cflag &= ~(CSIZE | PARENB);
> +  state.termio.c_cflag &= ~(CSIZE);

Likewise.

> @@ -893,6 +894,50 @@ hardwire_setstopbits (struct serial *scb, int num)
>    return set_tty_state (scb, &state);
>  }
> 
> +/* Implement the "setparity" serial_ops callback.  */
> +
> +static int
> +hardwire_setparity (struct serial *scb, int parity)
> +{
> +  struct hardwire_ttystate state;
> +  int newparity = 0;
> +
> +  if (get_tty_state (scb, &state))
> +    return -1;
> +
> +  switch (parity)
> +    {
> +    case GDBPARITY_NONE:
> +      newparity = 0;
> +      break;
> +    case GDBPARITY_ODD:
> +      newparity = PARENB | PARODD;
> +      break;
> +    case GDBPARITY_EVEN:
> +      newparity = PARENB;
> +      break;
> +    default:
> +      internal_warning (__FILE__, __LINE__, "Incorrect parity value:
> %d", parity);

Same as above - line is too long.

> +/* See serial.h.  */
> +
> +int
> +serial_setparity (struct serial *scb, int parity)
> +{
> +    return scb->ops->setparity (scb, parity);

The indentation is wrong (we use a 2-space indentation). Hence:

    int
    serial_setparity (struct serial *scb, int parity)
    {
      return scb->ops->setparity (scb, parity);
    }

-- 
Joel

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: Setting parity for remote serial
  2015-03-17 14:56               ` Joel Brobecker
@ 2015-03-22 22:52                 ` Yurij Grechishhev
  2015-03-23 13:11                   ` Joel Brobecker
  2015-03-23 15:36                   ` Eli Zaretskii
  0 siblings, 2 replies; 44+ messages in thread
From: Yurij Grechishhev @ 2015-03-22 22:52 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

Hi Joel,
It's really useful experience to follow so strict coding style. Are
there any plans to use any system for code review (like Gerrit)?
This patch is created on the top of the latest code (after the git
cloning gdb repo).
I have tested these changes with my Linux machine (Ubuntu 12.04.4
x86_64) and external USB-UART cable: I was checking tty parameters by
using stty:
Initial setup:
$ sudo stty -F /dev/ttyUSB0 --all
speed 0 baud; rows 0; columns 0; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;
eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z;
rprnt = ^R; werase = ^W; lnext = ^V;
flush = ^O; min = 0; time = 10;
-parenb -parodd cs8 -hupcl -cstopb -cread clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl
-ixon -ixoff -iuclc -ixany -imaxbel -iutf8
-opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0
bs0 vt0 ff0
-isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase
-tostop -echoprt -echoctl -echoke

gdb-7.9, without changes:
(gdb) set serial baud 38400
(gdb) target remote /dev/ttyUSB0
$ sudo stty -F /dev/ttyUSB0 --all
speed 38400 baud; rows 0; columns 0; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;
eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z;
rprnt = ^R; werase = ^W; lnext = ^V;
flush = ^O; min = 0; time = 10;
-parenb -parodd cs8 -hupcl -cstopb -cread clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl
-ixon -ixoff -iuclc -ixany -imaxbel -iutf8
-opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0
bs0 vt0 ff0
-isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase
-tostop -echoprt -echoctl -echoke

GDB, compiled with patch:
(gdb) set serial baud 19200
(gdb) show serial parity
Parity for remote serial I/O is "none".
(gdb) target remote /dev/ttyUSB0
$ sudo stty -F /dev/ttyUSB0 --all
speed 19200 baud; rows 0; columns 0; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;
eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z;
rprnt = ^R; werase = ^W; lnext = ^V;
flush = ^O; min = 0; time = 10;
-parenb -parodd cs8 -hupcl -cstopb -cread clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl
-ixon -ixoff -iuclc -ixany -imaxbel -iutf8
-opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0
bs0 vt0 ff0
-isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase
-tostop -echoprt -echoctl -echoke

(gdb) set serial parity even
(gdb) show serial parity
Parity for remote serial I/O is "even"
(gdb) target remote /dev/ttyUSB0
speed 19200 baud; rows 0; columns 0; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;
eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z;
rprnt = ^R; werase = ^W; lnext = ^V;
flush = ^O; min = 0; time = 10;
parenb -parodd cs8 -hupcl -cstopb -cread clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl
-ixon -ixoff -iuclc -ixany -imaxbel -iutf8
-opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0
bs0 vt0 ff0
-isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase
-tostop -echoprt -echoctl -echoke

(gdb) set serial parity odd
(gdb) show serial parity
Parity for remote serial I/O is "odd
(gdb) target remote /dev/ttyUSB0
speed 19200 baud; rows 0; columns 0; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;
eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z;
rprnt = ^R; werase = ^W; lnext = ^V;
flush = ^O; min = 0; time = 10;
parenb parodd cs8 -hupcl -cstopb -cread clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl
-ixon -ixoff -iuclc -ixany -imaxbel -iutf8
-opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0
bs0 vt0 ff0
-isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase
-tostop -echoprt -echoctl -echoke

(gdb) set serial parity none
(gdb) show serial parity
Parity for remote serial I/O is "none".
(gdb) target remote /dev/ttyUSB0
speed 19200 baud; rows 0; columns 0; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;
eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z;
rprnt = ^R; werase = ^W; lnext = ^V;
flush = ^O; min = 0; time = 10;
-parenb -parodd cs8 -hupcl -cstopb -cread clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl
-ixon -ixoff -iuclc -ixany -imaxbel -iutf8
-opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0
bs0 vt0 ff0
-isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase
-tostop -echoprt -echoctl -echoke

(gdb) set serial parity wrong
Undefined item: "wrong".
(gdb) show serial parity
Parity for remote serial I/O is "none".

Unfortunately, now I don't have the ability to fully-test it with
windows (but I was checking initial version one year ago, with real
hardware). Now it has been compiled by using mingw with
--host=i586-mingw32msvc.

Updated patch is below. Also I've fixed one issue with zeroing PARENB flag.

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index ca8bbaf..02f9ddc 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,37 @@
+2015-03-21  Yurij Grechishhev  <yurij.grechishhev@gmail.com>
+
+    * 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): Add dos_noop field.
+    * ser-mingw.c (ser_windows_raw): Remove state.fParity and
+    state.Parity definitions.
+    (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.
+    (serial_ops): Add setparity entry.
+    * target.h (serial_parity): Add declaration.
+
 2015-03-17  Yurij Grechishhev  <yurij.grechishhev@gmail.com>

     * ser-base.h (ser_base_setstopbits): Change second argument name
diff --git a/gdb/NEWS b/gdb/NEWS
index bda4a35..3fa33c9 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -3,6 +3,10 @@

 *** Changes since GDB 7.9

+* GDB has two new commands: "set serial parity odd|even|none" and
+  "show serial parity".  These allows to set or show parity for the
+  remote serial I/O.
+
 * The "info source" command now displays the producer string if it was
   present in the debug info.  This typically includes the compiler version
   and may include things like its command line arguments.
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index 5efb060..f7d6485 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,3 +1,8 @@
+2015-03-16  Yurij Grechishhev  <yurij.grechishhev@gmail.com>
+
+    * gdb.texinfo (Remote configuration): Document "set/show
+    serial parity" command.
+
 2015-03-11  Gary Benson <gbenson@redhat.com>

     * gdb.texinfo (Remote Configuration): Document the
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 9e71642..a818d58 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -19443,6 +19443,13 @@ remote targets.
 @item show serial baud
 Show the current speed of the remote connection.

+@item set serial parity @var{parity}
+Set the parity for the remote serial I/O.  Supported values of
@var{parity} are:
+@code{even}, @code{none}, and @code{odd}.  The default is @code{none}.
+
+@item show serial parity
+Show the current parity of the serial port.
+
 @item set remotebreak
 @cindex interrupt remote programs
 @cindex BREAK signal instead of Ctrl-C
diff --git a/gdb/monitor.c b/gdb/monitor.c
index b040ec4..548dae3 100644
--- a/gdb/monitor.c
+++ b/gdb/monitor.c
@@ -767,6 +767,7 @@ monitor_open (const char *args, struct monitor_ops
*mon_ops, int from_tty)
     }
     }

+  serial_setparity (monitor_desc, serial_parity);
   serial_raw (monitor_desc);

   serial_flush_input (monitor_desc);
diff --git a/gdb/remote.c b/gdb/remote.c
index 9aaee13..ed3ab57 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -4310,6 +4310,7 @@ remote_open_1 (const char *name, int from_tty,
     }
     }

+  serial_setparity (rs->remote_desc, serial_parity);
   serial_raw (rs->remote_desc);

   /* If there is something sitting in the buffer we might take it as a
diff --git a/gdb/ser-base.c b/gdb/ser-base.c
index 87817c4..09aacec 100644
--- a/gdb/ser-base.c
+++ b/gdb/ser-base.c
@@ -541,6 +541,14 @@ ser_base_setstopbits (struct serial *scb, int num)
   return 0;            /* Never fails!  */
 }

+/* Implement the "setparity" serial_ops callback.  */
+
+int
+ser_base_setparity (struct serial *scb, int parity)
+{
+  return 0;            /* Never fails!  */
+}
+
 /* Put the SERIAL device into/out-of ASYNC mode.  */

 void
diff --git a/gdb/ser-base.h b/gdb/ser-base.h
index 6aac925..bb1c51d 100644
--- a/gdb/ser-base.h
+++ b/gdb/ser-base.h
@@ -43,6 +43,7 @@ extern int ser_base_noflush_set_tty_state (struct serial *scb,
                        serial_ttystate old_ttystate);
 extern int ser_base_setbaudrate (struct serial *scb, int rate);
 extern int ser_base_setstopbits (struct serial *scb, int num);
+extern int ser_base_setparity (struct serial *scb, int parity);
 extern int ser_base_drain_output (struct serial *scb);

 extern int ser_base_write (struct serial *scb, const void *buf, size_t count);
diff --git a/gdb/ser-go32.c b/gdb/ser-go32.c
index 6bf1b4e..bbcf6af 100644
--- a/gdb/ser-go32.c
+++ b/gdb/ser-go32.c
@@ -864,6 +864,7 @@ static const struct serial_ops dos_ops =
   dos_noflush_set_tty_state,
   dos_setbaudrate,
   dos_setstopbits,
+  dos_noop,
   dos_noop,            /* Wait for output to drain.  */
   (void (*)(struct serial *, int))NULL    /* Change into async mode.  */
 };
diff --git a/gdb/ser-mingw.c b/gdb/ser-mingw.c
index 7f335e9..cedbcd6 100644
--- a/gdb/ser-mingw.c
+++ b/gdb/ser-mingw.c
@@ -153,7 +153,6 @@ ser_windows_raw (struct serial *scb)
   if (GetCommState (h, &state) == 0)
     return;

-  state.fParity = FALSE;
   state.fOutxCtsFlow = FALSE;
   state.fOutxDsrFlow = FALSE;
   state.fDtrControl = DTR_CONTROL_ENABLE;
@@ -163,7 +162,6 @@ ser_windows_raw (struct serial *scb)
   state.fNull = FALSE;
   state.fAbortOnError = FALSE;
   state.ByteSize = 8;
-  state.Parity = NOPARITY;

   scb->current_timeout = 0;

@@ -198,6 +196,39 @@ ser_windows_setstopbits (struct serial *scb, int num)
   return (SetCommState (h, &state) != 0) ? 0 : -1;
 }

+/* Implement the "setparity" serial_ops callback.  */
+
+static int
+ser_windows_setparity (struct serial *scb, int parity)
+{
+  HANDLE h = (HANDLE) _get_osfhandle (scb->fd);
+  DCB state;
+
+  if (GetCommState (h, &state) == 0)
+    return -1;
+
+  switch (parity)
+    {
+    case GDBPARITY_NONE:
+      state.Parity = NOPARITY;
+      state.fParity = FALSE;
+      break;
+    case GDBPARITY_ODD:
+      state.Parity = ODDPARITY;
+      state.fParity = TRUE;
+      break;
+    case GDBPARITY_EVEN:
+      state.Parity = EVENPARITY;
+      state.fParity = TRUE;
+      break;
+    default:
+      internal_warning (__FILE__, __LINE__, "Incorrect parity value:
%d", parity);
+      return -1;
+    }
+
+  return (SetCommState (h, &state) != 0) ? 0 : -1;
+}
+
 static int
 ser_windows_setbaudrate (struct serial *scb, int rate)
 {
@@ -1227,6 +1258,7 @@ static const struct serial_ops hardwire_ops =
   ser_base_noflush_set_tty_state,
   ser_windows_setbaudrate,
   ser_windows_setstopbits,
+  ser_windows_setparity,
   ser_windows_drain_output,
   ser_base_async,
   ser_windows_read_prim,
@@ -1257,6 +1289,7 @@ static const struct serial_ops tty_ops =
   ser_base_noflush_set_tty_state,
   NULL,
   NULL,
+  NULL,
   ser_base_drain_output,
   NULL,
   NULL,
@@ -1287,6 +1320,7 @@ static const struct serial_ops pipe_ops =
   ser_base_noflush_set_tty_state,
   ser_base_setbaudrate,
   ser_base_setstopbits,
+  ser_base_setparity,
   ser_base_drain_output,
   ser_base_async,
   pipe_windows_read,
@@ -1317,6 +1351,7 @@ static const struct serial_ops tcp_ops =
   ser_base_noflush_set_tty_state,
   ser_base_setbaudrate,
   ser_base_setstopbits,
+  ser_base_setparity,
   ser_base_drain_output,
   ser_base_async,
   net_read_prim,
diff --git a/gdb/ser-pipe.c b/gdb/ser-pipe.c
index bf5e4d4..0700132 100644
--- a/gdb/ser-pipe.c
+++ b/gdb/ser-pipe.c
@@ -224,6 +224,7 @@ static const struct serial_ops pipe_ops =
   ser_base_noflush_set_tty_state,
   ser_base_setbaudrate,
   ser_base_setstopbits,
+  ser_base_setparity,
   ser_base_drain_output,
   ser_base_async,
   ser_unix_read_prim,
diff --git a/gdb/ser-tcp.c b/gdb/ser-tcp.c
index 9c3dcf4..35512e6 100644
--- a/gdb/ser-tcp.c
+++ b/gdb/ser-tcp.c
@@ -394,6 +394,7 @@ static const struct serial_ops tcp_ops =
   ser_base_noflush_set_tty_state,
   ser_base_setbaudrate,
   ser_base_setstopbits,
+  ser_base_setparity,
   ser_base_drain_output,
   ser_base_async,
   net_read_prim,
diff --git a/gdb/ser-unix.c b/gdb/ser-unix.c
index 4125797..fa547b3 100644
--- a/gdb/ser-unix.c
+++ b/gdb/ser-unix.c
@@ -83,6 +83,7 @@ static int hardwire_readchar (struct serial *scb,
int timeout);
 static int do_hardwire_readchar (struct serial *scb, int timeout);
 static int rate_to_code (int rate);
 static int hardwire_setbaudrate (struct serial *scb, int rate);
+static int hardwire_setparity (struct serial *scb, int parity);
 static void hardwire_close (struct serial *scb);
 static int get_tty_state (struct serial *scb,
               struct hardwire_ttystate * state);
@@ -409,7 +410,7 @@ hardwire_raw (struct serial *scb)
   state.termios.c_iflag = 0;
   state.termios.c_oflag = 0;
   state.termios.c_lflag = 0;
-  state.termios.c_cflag &= ~(CSIZE | PARENB);
+  state.termios.c_cflag &= ~(CSIZE);
   state.termios.c_cflag |= CLOCAL | CS8;
 #ifdef CRTSCTS
   /* h/w flow control.  */
@@ -432,7 +433,7 @@ hardwire_raw (struct serial *scb)
   state.termio.c_iflag = 0;
   state.termio.c_oflag = 0;
   state.termio.c_lflag = 0;
-  state.termio.c_cflag &= ~(CSIZE | PARENB);
+  state.termio.c_cflag &= ~(CSIZE);
   state.termio.c_cflag |= CLOCAL | CS8;
   state.termio.c_cc[VMIN] = 0;
   state.termio.c_cc[VTIME] = 0;
@@ -893,6 +894,50 @@ hardwire_setstopbits (struct serial *scb, int num)
   return set_tty_state (scb, &state);
 }

+/* Implement the "setparity" serial_ops callback.  */
+
+static int
+hardwire_setparity (struct serial *scb, int parity)
+{
+  struct hardwire_ttystate state;
+  int newparity = 0;
+
+  if (get_tty_state (scb, &state))
+    return -1;
+
+  switch (parity)
+    {
+    case GDBPARITY_NONE:
+      newparity = 0;
+      break;
+    case GDBPARITY_ODD:
+      newparity = PARENB | PARODD;
+      break;
+    case GDBPARITY_EVEN:
+      newparity = PARENB;
+      break;
+    default:
+      internal_warning (__FILE__, __LINE__, "Incorrect parity value:
%d", parity);
+      return -1;
+    }
+
+#ifdef HAVE_TERMIOS
+  state.termios.c_cflag &= ~(PARENB | PARODD);
+  state.termios.c_cflag |= newparity;
+#endif
+
+#ifdef HAVE_TERMIO
+  state.termio.c_cflag &= ~(PARENB | PARODD);
+  state.termio.c_cflag |= newparity;
+#endif
+
+#ifdef HAVE_SGTTY
+  return 0;            /* sgtty doesn't support this */
+#endif
+  return set_tty_state (scb, &state);
+}
+
+
 static void
 hardwire_close (struct serial *scb)
 {
@@ -929,6 +974,7 @@ static const struct serial_ops hardwire_ops =
   hardwire_noflush_set_tty_state,
   hardwire_setbaudrate,
   hardwire_setstopbits,
+  hardwire_setparity,
   hardwire_drain_output,
   ser_base_async,
   ser_unix_read_prim,
diff --git a/gdb/serial.c b/gdb/serial.c
index b7e620d..5f1b5cf 100644
--- a/gdb/serial.c
+++ b/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."), _("\
diff --git a/gdb/serial.h b/gdb/serial.h
index 9eb1c39..add0f15 100644
--- a/gdb/serial.h
+++ b/gdb/serial.h
@@ -186,6 +186,14 @@ extern int serial_setbaudrate (struct serial
*scb, int rate);

 extern int serial_setstopbits (struct serial *scb, int num);

+#define GDBPARITY_NONE     0
+#define GDBPARITY_ODD      1
+#define GDBPARITY_EVEN     2
+
+/* Set parity for serial port. Returns 0 for success, -1 for failure.  */
+
+extern int serial_setparity (struct serial *scb, int parity);
+
 /* Asynchronous serial interface: */

 /* Can the serial device support asynchronous mode?  */
@@ -271,6 +279,9 @@ struct serial_ops
                   serial_ttystate);
     int (*setbaudrate) (struct serial *, int rate);
     int (*setstopbits) (struct serial *, int num);
+    /* Set the value PARITY as parity setting for serial object.
+       Return 0 in the case of success.  */
+    int (*setparity) (struct serial *, int parity);
     /* Wait for output to drain.  */
     int (*drain_output) (struct serial *);
     /* Change the serial device into/out of asynchronous mode, call
diff --git a/gdb/target.h b/gdb/target.h
index c95e1a4..05dcd9f 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -2236,6 +2236,10 @@ extern int remote_debug;

 /* Speed in bits per second, or -1 which means don't mess with the speed.  */
 extern int baud_rate;
+
+/* Parity for serial port  */
+extern int serial_parity;
+
 /* Timeout limit for response from target.  */
 extern int remote_timeout;


--
Thanks,
Yury

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: Setting parity for remote serial
  2015-03-15 21:49             ` Yurij Grechishhev
  2015-03-16  3:32               ` Eli Zaretskii
@ 2015-03-17 14:56               ` Joel Brobecker
  2015-03-22 22:52                 ` Yurij Grechishhev
  1 sibling, 1 reply; 44+ messages in thread
From: Joel Brobecker @ 2015-03-17 14:56 UTC (permalink / raw)
  To: Yurij Grechishhev; +Cc: gdb-patches

Yurij,

Below are my commends regarding your patch.

You'll see that I have a lot of comments, but they are very minor and
the patch essentially looks fine to me. Please forgive me if it feels
like I am nitpicking - GDB has a fairly complex coding style, which
is mostly dictated by the fact that it is part of the GNU project and
therefore following the GNU Coding Style (and then some).

Also, it would be useful for you to confirm that this patch is on top
of master, and on which platform you tested this patch (I assume that
you tested it by running the testsuite before and after your change).

Thank you!

> +2013-07-16  Yurij Grechishhev  <yurij.grechishhev@gmail.com>
> +
> +    * NEWS: Mention set/show serial parity command.
> +    * monitor.c (monitor_open): Add serial_setparity.

"Add" was a little confusing to me. How about "Call serial_setparity"?

> +    * remote.c (remote_open_1): Likewise.
> +    * ser-base.c (ser_base_serparity): New function.
> +    * ser-base.h: Add ser_base_setparity declaration.

        * ser-base.h (ser_base_setparity): Add declaration.

> +    * serail.c: Add serial_parity declaration and definitions of
> +    parity_enums and parity.
> +    (serial_parity): Definition
> +    (set_parity): New function.
> +    (serial_setparity): New function.
> +    (_initialize_serial): Add set/show serial parity command description

typo: "serail.c" -> "serial.c"

Same remark as above in terms of how the entry should be formatted.
It also seems like the contents is a bit out of order with respect
to the diff, making it hard to double-check it. I suggest:

        * serial.c (serial_parity): 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.

Also, the last comment on the ChangeLog entry is that sentences should
start with a capital letter, and end with a period.

Can you adjust the rest of the ChangeLog entry using the above
guidelines, please?

> +    * serial.h: Add GDBPARITY_NONE, GDBPARITY_ODD, GDBPARITY_EVEN
> +    definitions. Add serial_setparity declaration.
> +    (serial_ops): Add setparity entry.
> +    * ser-mingw.c (ser_windows_raw): Remove state.fParity and
> +    state.Parity definitions.
> +    (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): add ser_base_setparity.
> +    * ser-pipe.c (pipe_ops): Likewise.
> +    * ser-tcp.c (tcp_ops): Likewise.
> +    * ser-unix.c: Add hardwire_setparity declaration.
> +    (hardwire_setparity): New function.
> +    (hardwire_ops): add hardwire_setparity.
> +    * ser-go32.c (dos_ops): add dos_noop
> +    * target.h: serial_parity declaration.

> diff --git a/gdb/monitor.c b/gdb/monitor.c
> index b040ec4..548dae3 100644
> --- a/gdb/monitor.c
> +++ b/gdb/monitor.c
> @@ -767,6 +767,7 @@ monitor_open (const char *args, struct monitor_ops
> *mon_ops, int from_tty)
>      }
>      }
> 
> +  serial_setparity (monitor_desc, serial_parity);
>    serial_raw (monitor_desc);
> 
>    serial_flush_input (monitor_desc);
> diff --git a/gdb/remote.c b/gdb/remote.c
> index 9aaee13..1554259 100644
> --- a/gdb/remote.c
> +++ b/gdb/remote.c
> @@ -4310,6 +4310,7 @@ remote_open_1 (const char *name, int from_tty,
>      }
>      }
> 
> +  serial_setparity(rs->remote_desc, serial_parity);

Missing space before the '('.

>    serial_raw (rs->remote_desc);
> 
>    /* If there is something sitting in the buffer we might take it as a
> diff --git a/gdb/ser-base.c b/gdb/ser-base.c
> index 87817c4..93aad40 100644
> --- a/gdb/ser-base.c
> +++ b/gdb/ser-base.c
> @@ -541,6 +541,12 @@ ser_base_setstopbits (struct serial *scb, int num)
>    return 0;            /* Never fails!  */
>  }
> 
> +int
> +ser_base_setparity (struct serial *scb, int parity)

We have a policy, now, that all new functions should be documented.
For functions like these, that simply implement a callback, a one-line
introductory comment is sufficient. For instance:

/* Implement the "setparity" serial_ops callback.  */

That's sufficient to show that the function's documentation is the same
as the callback's documentation.

>  extern int ser_base_setbaudrate (struct serial *scb, int rate);
> -extern int ser_base_setstopbits (struct serial *scb, int rate);
> +extern int ser_base_setstopbits (struct serial *scb, int num);

This change is unrelated, and obvious, so I pushed it on its own:
https://www.sourceware.org/ml/gdb-patches/2015-03/msg00488.html

> diff --git a/gdb/ser-mingw.c b/gdb/ser-mingw.c
> index 7f335e9..be0f990 100644
> --- a/gdb/ser-mingw.c
> +++ b/gdb/ser-mingw.c
> @@ -153,7 +153,6 @@ ser_windows_raw (struct serial *scb)
>    if (GetCommState (h, &state) == 0)
>      return;
> 
> -  state.fParity = FALSE;
>    state.fOutxCtsFlow = FALSE;
>    state.fOutxDsrFlow = FALSE;
>    state.fDtrControl = DTR_CONTROL_ENABLE;
> @@ -163,7 +162,6 @@ ser_windows_raw (struct serial *scb)
>    state.fNull = FALSE;
>    state.fAbortOnError = FALSE;
>    state.ByteSize = 8;
> -  state.Parity = NOPARITY;
> 
>    scb->current_timeout = 0;
> 
> @@ -199,6 +197,36 @@ ser_windows_setstopbits (struct serial *scb, int num)
>  }
> 
>  static int
> +ser_windows_setparity (struct serial *scb, int parity)

Same as above - missing function introductory comment.

> +{
> +  HANDLE h = (HANDLE) _get_osfhandle (scb->fd);
> +  DCB state;
> +
> +  if (GetCommState (h, &state) == 0)
> +    return -1;
> +
> +  switch (parity)
> +    {
> +    case GDBPARITY_NONE:
> +      state.Parity = NOPARITY;
> +      state.fParity = FALSE;
> +      break;
> +    case GDBPARITY_ODD:
> +      state.Parity = ODDPARITY;
> +      state.fParity = TRUE;
> +      break;
> +    case GDBPARITY_EVEN:
> +      state.Parity = EVENPARITY;
> +      state.fParity = TRUE;
> +      break;
> +    default:
> +      return 1;

Let's emit an internal_warning if parity has an unknown value.
PARITY should always be one of those 3, and getting anything else
is an internal_error. But the reason why I suggested the use of
an internal_warning instead of internal_error is that internal_error
is pretty-much a fatal error, but maybe we don't absolutely need it
to be fatal. Communication is probably going to be screwed up, but
anything else should still be working. We just want to warn the user
of the issue he's likely going to face.

> +    }
> +static int
> +hardwire_setparity (struct serial *scb, int parity)
> +{

Missing function documentation.

> +  struct hardwire_ttystate state;
> +  int newparity = 0;
> +
> +  if (get_tty_state (scb, &state))
> +    return -1;
> +
> +  switch (parity)
> +    {
> +    case GDBPARITY_NONE:
> +      newparity = 0;
> +      break;
> +    case GDBPARITY_ODD:
> +      newparity = PARENB | PARODD;
> +      break;
> +    case GDBPARITY_EVEN:
> +      newparity = PARENB;
> +      break;
> +    default:
> +      return 1;

Same here - internal_warning to warn the user of likely communication
issues.

> --- a/gdb/serial.c
> +++ b/gdb/serial.c
> @@ -525,6 +525,12 @@ serial_setstopbits (struct serial *scb, int num)
>  }
> 
>  int
> +serial_setparity (struct serial*scb, int parity)
> +{
> +    return scb->ops->setparity (scb, parity);
> +}

Missing function documentation.

> +/* 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};

Two spaces before '{' (indentation).

> +static const char *parity = parity_none;

> +static void
> +set_parity (char *ignore_args, int from_tty, struct cmd_list_element *c)

When the function's documentation is in the .h file, can you add a
comment that says, Eg:

/* See serial.h.  */

?

> +/* Set parity for serial port. Return 0 for success, -1 for failure */
> +
> +#define GDBPARITY_NONE     0
> +#define GDBPARITY_ODD      1
> +#define GDBPARITY_EVEN     2
> +
> +extern int serial_setparity (struct serial *scb, int parity);

Can you move the function's documentation after the #define's?

>  /* Can the serial device support asynchronous mode?  */
> @@ -271,6 +279,7 @@ struct serial_ops
>                    serial_ttystate);
>      int (*setbaudrate) (struct serial *, int rate);
>      int (*setstopbits) (struct serial *, int num);
> +    int (*setparity) (struct serial *, int parity);

Please document here what this hook should be doing. Please name
all the arguments as well, so you can use those names in the hook's
description. Below is an example from target.h which shows how
these kinds of "methods" are now documented in GDB:

    /* Return the thread-local address at OFFSET in the
       thread-local storage for the thread PTID and the shared library
       or executable file given by OBJFILE.  If that block of
       thread-local storage hasn't been allocated yet, this function
       may return an error.  LOAD_MODULE_ADDR may be zero for statically
       linked multithreaded inferiors.  */
    CORE_ADDR (*to_get_thread_local_address) (struct target_ops *ops,
                                              ptid_t ptid,
                                              CORE_ADDR load_module_addr,
                                              CORE_ADDR offset)


> index c95e1a4..685a37f 100644
> --- a/gdb/target.h
> +++ b/gdb/target.h
> @@ -2236,6 +2236,10 @@ extern int remote_debug;
> 
>  /* Speed in bits per second, or -1 which means don't mess with the speed.  */
>  extern int baud_rate;
> +
> +/* Parity for serial port */
> +extern int serial_parity;

For the global's documentation, can you add a period followed by
two spaces? Thus:

/* Parity for serial port. */

-- 
Joel

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: Setting parity for remote serial
  2015-03-15 21:49             ` Yurij Grechishhev
@ 2015-03-16  3:32               ` Eli Zaretskii
  2015-03-17 14:56               ` Joel Brobecker
  1 sibling, 0 replies; 44+ messages in thread
From: Eli Zaretskii @ 2015-03-16  3:32 UTC (permalink / raw)
  To: Yurij Grechishhev; +Cc: brobecker, gdb-patches

> Date: Mon, 16 Mar 2015 00:49:33 +0300
> From: Yurij Grechishhev <yurij.grechishhev@gmail.com>
> Cc: gdb-patches@sourceware.org
> 
> I kindly ask you to review this patch. Please, let me know in the case
> I have missed something.
> I see, you've reworked the command for baudrate setting.
> Parity is set the same way now: set/show serial parity.

Thanks, the documentation parts are OK.

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: Setting parity for remote serial
  2015-02-27  8:16           ` Joel Brobecker
@ 2015-03-15 21:49             ` Yurij Grechishhev
  2015-03-16  3:32               ` Eli Zaretskii
  2015-03-17 14:56               ` Joel Brobecker
  0 siblings, 2 replies; 44+ messages in thread
From: Yurij Grechishhev @ 2015-03-15 21:49 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 13976 bytes --]

Hello Joel,
I kindly ask you to review this patch. Please, let me know in the case
I have missed something.
I see, you've reworked the command for baudrate setting.
Parity is set the same way now: set/show serial parity.

Thank you.

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 65a0051..7b88708 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,34 @@
+2013-07-16  Yurij Grechishhev  <yurij.grechishhev@gmail.com>
+
+    * NEWS: Mention set/show serial parity command.
+    * monitor.c (monitor_open): Add serial_setparity.
+    * remote.c (remote_open_1): Likewise.
+    * ser-base.c (ser_base_serparity): New function.
+    * ser-base.h: Add ser_base_setparity declaration.
+    * serail.c: Add serial_parity declaration and definitions of
+    parity_enums and parity.
+    (serial_parity): Definition
+    (set_parity): New function.
+    (serial_setparity): New function.
+    (_initialize_serial): Add set/show serial parity command description
+    * serial.h: Add GDBPARITY_NONE, GDBPARITY_ODD, GDBPARITY_EVEN
+    definitions. Add serial_setparity declaration.
+    (serial_ops): Add setparity entry.
+    * ser-mingw.c (ser_windows_raw): Remove state.fParity and
+    state.Parity definitions.
+    (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): add ser_base_setparity.
+    * ser-pipe.c (pipe_ops): Likewise.
+    * ser-tcp.c (tcp_ops): Likewise.
+    * ser-unix.c: Add hardwire_setparity declaration.
+    (hardwire_setparity): New function.
+    (hardwire_ops): add hardwire_setparity.
+    * ser-go32.c (dos_ops): add dos_noop
+    * target.h: serial_parity declaration.
+
 2014-10-16  Jan Kratochvil  <jan.kratochvil@redhat.com>

     Remove HPUX.
diff --git a/gdb/NEWS b/gdb/NEWS
index f08f972..cd2e82b3 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -3,6 +3,10 @@

 *** Changes since GDB 7.9

+* GDB has two new commands: "set serial parity odd|even|none" and
+  "show serial parity".  These allows to set or show parity for the
+  remote serial I/O.
+
 * The "info source" command now displays the producer string if it was
   present in the debug info.  This typically includes the compiler version
   and may include things like its command line arguments.
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index 5efb060..dd601fe 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,3 +1,8 @@
+2015-03-16  Yurij Grechishhev  <yurij.grechishhev@gmail.com>
+
+    * gdb.texinfo (Remote configuration): Document "set/show
+    serial parity command".
+
 2015-03-11  Gary Benson <gbenson@redhat.com>

     * gdb.texinfo (Remote Configuration): Document the
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 9e71642..a818d58 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -19443,6 +19443,13 @@ remote targets.
 @item show serial baud
 Show the current speed of the remote connection.

+@item set serial parity @var{parity}
+Set the parity for the remote serial I/O.  Supported values of
@var{parity} are:
+@code{even}, @code{none}, and @code{odd}.  The default is @code{none}.
+
+@item show serial parity
+Show the current parity of the serial port.
+
 @item set remotebreak
 @cindex interrupt remote programs
 @cindex BREAK signal instead of Ctrl-C
diff --git a/gdb/monitor.c b/gdb/monitor.c
index b040ec4..548dae3 100644
--- a/gdb/monitor.c
+++ b/gdb/monitor.c
@@ -767,6 +767,7 @@ monitor_open (const char *args, struct monitor_ops
*mon_ops, int from_tty)
     }
     }

+  serial_setparity (monitor_desc, serial_parity);
   serial_raw (monitor_desc);

   serial_flush_input (monitor_desc);
diff --git a/gdb/remote.c b/gdb/remote.c
index 9aaee13..1554259 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -4310,6 +4310,7 @@ remote_open_1 (const char *name, int from_tty,
     }
     }

+  serial_setparity(rs->remote_desc, serial_parity);
   serial_raw (rs->remote_desc);

   /* If there is something sitting in the buffer we might take it as a
diff --git a/gdb/ser-base.c b/gdb/ser-base.c
index 87817c4..93aad40 100644
--- a/gdb/ser-base.c
+++ b/gdb/ser-base.c
@@ -541,6 +541,12 @@ ser_base_setstopbits (struct serial *scb, int num)
   return 0;            /* Never fails!  */
 }

+int
+ser_base_setparity (struct serial *scb, int parity)
+{
+  return 0;            /* Never fails!  */
+}
+
 /* Put the SERIAL device into/out-of ASYNC mode.  */

 void
diff --git a/gdb/ser-base.h b/gdb/ser-base.h
index 2aba66d..bb1c51d 100644
--- a/gdb/ser-base.h
+++ b/gdb/ser-base.h
@@ -42,7 +42,8 @@ extern int ser_base_noflush_set_tty_state (struct serial *scb,
                        serial_ttystate new_ttystate,
                        serial_ttystate old_ttystate);
 extern int ser_base_setbaudrate (struct serial *scb, int rate);
-extern int ser_base_setstopbits (struct serial *scb, int rate);
+extern int ser_base_setstopbits (struct serial *scb, int num);
+extern int ser_base_setparity (struct serial *scb, int parity);
 extern int ser_base_drain_output (struct serial *scb);

 extern int ser_base_write (struct serial *scb, const void *buf, size_t count);
diff --git a/gdb/ser-go32.c b/gdb/ser-go32.c
index 6bf1b4e..bbcf6af 100644
--- a/gdb/ser-go32.c
+++ b/gdb/ser-go32.c
@@ -864,6 +864,7 @@ static const struct serial_ops dos_ops =
   dos_noflush_set_tty_state,
   dos_setbaudrate,
   dos_setstopbits,
+  dos_noop,
   dos_noop,            /* Wait for output to drain.  */
   (void (*)(struct serial *, int))NULL    /* Change into async mode.  */
 };
diff --git a/gdb/ser-mingw.c b/gdb/ser-mingw.c
index 7f335e9..be0f990 100644
--- a/gdb/ser-mingw.c
+++ b/gdb/ser-mingw.c
@@ -153,7 +153,6 @@ ser_windows_raw (struct serial *scb)
   if (GetCommState (h, &state) == 0)
     return;

-  state.fParity = FALSE;
   state.fOutxCtsFlow = FALSE;
   state.fOutxDsrFlow = FALSE;
   state.fDtrControl = DTR_CONTROL_ENABLE;
@@ -163,7 +162,6 @@ ser_windows_raw (struct serial *scb)
   state.fNull = FALSE;
   state.fAbortOnError = FALSE;
   state.ByteSize = 8;
-  state.Parity = NOPARITY;

   scb->current_timeout = 0;

@@ -199,6 +197,36 @@ ser_windows_setstopbits (struct serial *scb, int num)
 }

 static int
+ser_windows_setparity (struct serial *scb, int parity)
+{
+  HANDLE h = (HANDLE) _get_osfhandle (scb->fd);
+  DCB state;
+
+  if (GetCommState (h, &state) == 0)
+    return -1;
+
+  switch (parity)
+    {
+    case GDBPARITY_NONE:
+      state.Parity = NOPARITY;
+      state.fParity = FALSE;
+      break;
+    case GDBPARITY_ODD:
+      state.Parity = ODDPARITY;
+      state.fParity = TRUE;
+      break;
+    case GDBPARITY_EVEN:
+      state.Parity = EVENPARITY;
+      state.fParity = TRUE;
+      break;
+    default:
+      return 1;
+    }
+
+  return (SetCommState (h, &state) != 0) ? 0 : -1;
+}
+
+static int
 ser_windows_setbaudrate (struct serial *scb, int rate)
 {
   HANDLE h = (HANDLE) _get_osfhandle (scb->fd);
@@ -1227,6 +1255,7 @@ static const struct serial_ops hardwire_ops =
   ser_base_noflush_set_tty_state,
   ser_windows_setbaudrate,
   ser_windows_setstopbits,
+  ser_windows_setparity,
   ser_windows_drain_output,
   ser_base_async,
   ser_windows_read_prim,
@@ -1257,6 +1286,7 @@ static const struct serial_ops tty_ops =
   ser_base_noflush_set_tty_state,
   NULL,
   NULL,
+  NULL,
   ser_base_drain_output,
   NULL,
   NULL,
@@ -1287,6 +1317,7 @@ static const struct serial_ops pipe_ops =
   ser_base_noflush_set_tty_state,
   ser_base_setbaudrate,
   ser_base_setstopbits,
+  ser_base_setparity,
   ser_base_drain_output,
   ser_base_async,
   pipe_windows_read,
@@ -1317,6 +1348,7 @@ static const struct serial_ops tcp_ops =
   ser_base_noflush_set_tty_state,
   ser_base_setbaudrate,
   ser_base_setstopbits,
+  ser_base_setparity,
   ser_base_drain_output,
   ser_base_async,
   net_read_prim,
diff --git a/gdb/ser-pipe.c b/gdb/ser-pipe.c
index bf5e4d4..0700132 100644
--- a/gdb/ser-pipe.c
+++ b/gdb/ser-pipe.c
@@ -224,6 +224,7 @@ static const struct serial_ops pipe_ops =
   ser_base_noflush_set_tty_state,
   ser_base_setbaudrate,
   ser_base_setstopbits,
+  ser_base_setparity,
   ser_base_drain_output,
   ser_base_async,
   ser_unix_read_prim,
diff --git a/gdb/ser-tcp.c b/gdb/ser-tcp.c
index 9c3dcf4..35512e6 100644
--- a/gdb/ser-tcp.c
+++ b/gdb/ser-tcp.c
@@ -394,6 +394,7 @@ static const struct serial_ops tcp_ops =
   ser_base_noflush_set_tty_state,
   ser_base_setbaudrate,
   ser_base_setstopbits,
+  ser_base_setparity,
   ser_base_drain_output,
   ser_base_async,
   net_read_prim,
diff --git a/gdb/ser-unix.c b/gdb/ser-unix.c
index 4125797..88c16ba 100644
--- a/gdb/ser-unix.c
+++ b/gdb/ser-unix.c
@@ -83,6 +83,7 @@ static int hardwire_readchar (struct serial *scb,
int timeout);
 static int do_hardwire_readchar (struct serial *scb, int timeout);
 static int rate_to_code (int rate);
 static int hardwire_setbaudrate (struct serial *scb, int rate);
+static int hardwire_setparity (struct serial *scb, int parity);
 static void hardwire_close (struct serial *scb);
 static int get_tty_state (struct serial *scb,
               struct hardwire_ttystate * state);
@@ -893,6 +894,46 @@ hardwire_setstopbits (struct serial *scb, int num)
   return set_tty_state (scb, &state);
 }

+static int
+hardwire_setparity (struct serial *scb, int parity)
+{
+  struct hardwire_ttystate state;
+  int newparity = 0;
+
+  if (get_tty_state (scb, &state))
+    return -1;
+
+  switch (parity)
+    {
+    case GDBPARITY_NONE:
+      newparity = 0;
+      break;
+    case GDBPARITY_ODD:
+      newparity = PARENB | PARODD;
+      break;
+    case GDBPARITY_EVEN:
+      newparity = PARENB;
+      break;
+    default:
+      return 1;
+    }
+
+#ifdef HAVE_TERMIOS
+  state.termios.c_cflag |= newparity;
+#endif
+
+#ifdef HAVE_TERMIO
+  state.termio.c_cflag |= newparity;
+#endif
+
+#ifdef HAVE_SGTTY
+  return 0;            /* sgtty doesn't support this */
+#endif
+
+  return set_tty_state (scb, &state);
+}
+
+
 static void
 hardwire_close (struct serial *scb)
 {
@@ -929,6 +970,7 @@ static const struct serial_ops hardwire_ops =
   hardwire_noflush_set_tty_state,
   hardwire_setbaudrate,
   hardwire_setstopbits,
+  hardwire_setparity,
   hardwire_drain_output,
   ser_base_async,
   ser_unix_read_prim,
diff --git a/gdb/serial.c b/gdb/serial.c
index b7e620d..09c8b8d 100644
--- a/gdb/serial.c
+++ b/gdb/serial.c
@@ -525,6 +525,12 @@ serial_setstopbits (struct serial *scb, int num)
 }

 int
+serial_setparity (struct serial*scb, int parity)
+{
+    return scb->ops->setparity (scb, parity);
+}
+
+int
 serial_can_async_p (struct serial *scb)
 {
   return (scb->ops->async != NULL);
@@ -638,6 +644,27 @@ 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;
+
+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 +697,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."), _("\
diff --git a/gdb/serial.h b/gdb/serial.h
index 9eb1c39..0481ea1 100644
--- a/gdb/serial.h
+++ b/gdb/serial.h
@@ -186,6 +186,14 @@ extern int serial_setbaudrate (struct serial
*scb, int rate);

 extern int serial_setstopbits (struct serial *scb, int num);

+/* Set parity for serial port. Return 0 for success, -1 for failure */
+
+#define GDBPARITY_NONE     0
+#define GDBPARITY_ODD      1
+#define GDBPARITY_EVEN     2
+
+extern int serial_setparity (struct serial *scb, int parity);
+
 /* Asynchronous serial interface: */

 /* Can the serial device support asynchronous mode?  */
@@ -271,6 +279,7 @@ struct serial_ops
                   serial_ttystate);
     int (*setbaudrate) (struct serial *, int rate);
     int (*setstopbits) (struct serial *, int num);
+    int (*setparity) (struct serial *, int parity);
     /* Wait for output to drain.  */
     int (*drain_output) (struct serial *);
     /* Change the serial device into/out of asynchronous mode, call
diff --git a/gdb/target.h b/gdb/target.h
index c95e1a4..685a37f 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -2236,6 +2236,10 @@ extern int remote_debug;

 /* Speed in bits per second, or -1 which means don't mess with the speed.  */
 extern int baud_rate;
+
+/* Parity for serial port */
+extern int serial_parity;
+
 /* Timeout limit for response from target.  */
 extern int remote_timeout;


--
WBR,
Yury

2015-02-27 11:16 GMT+03:00 Joel Brobecker <brobecker@adacore.com>:
>> Glad to hear that this patch is still needed.
>> I believe, all questions with FSF copyright assignments had been resolved?
>> Please, let me know what I should do to complete this contribution.
>
> Indeed! Thanks very much for doing that.
>
> If you could rebase the patch against master, and resubmit,
> I promise to review it promptly (I will taking a week off
> Mar 07-15, though). If you'd rather I took it over, I will
> try to do so after I come back.
>
> Thanks again!
> --
> Joel

[-- Attachment #2: parity.patch --]
[-- Type: text/x-patch, Size: 12986 bytes --]

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 65a0051..7b88708 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,34 @@
+2013-07-16  Yurij Grechishhev  <yurij.grechishhev@gmail.com>
+
+	* NEWS: Mention set/show serial parity command.
+	* monitor.c (monitor_open): Add serial_setparity.
+	* remote.c (remote_open_1): Likewise.
+	* ser-base.c (ser_base_serparity): New function.
+	* ser-base.h: Add ser_base_setparity declaration.
+	* serail.c: Add serial_parity declaration and definitions of
+	parity_enums and parity.
+	(serial_parity): Definition
+	(set_parity): New function.
+	(serial_setparity): New function.
+	(_initialize_serial): Add set/show serial parity command description
+	* serial.h: Add GDBPARITY_NONE, GDBPARITY_ODD, GDBPARITY_EVEN
+	definitions. Add serial_setparity declaration.
+	(serial_ops): Add setparity entry.
+	* ser-mingw.c (ser_windows_raw): Remove state.fParity and
+	state.Parity definitions.
+	(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): add ser_base_setparity.
+	* ser-pipe.c (pipe_ops): Likewise.
+	* ser-tcp.c (tcp_ops): Likewise.
+	* ser-unix.c: Add hardwire_setparity declaration.
+	(hardwire_setparity): New function.
+	(hardwire_ops): add hardwire_setparity.
+	* ser-go32.c (dos_ops): add dos_noop
+	* target.h: serial_parity declaration.
+
 2014-10-16  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
 	Remove HPUX.
diff --git a/gdb/NEWS b/gdb/NEWS
index f08f972..cd2e82b3 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -3,6 +3,10 @@
 
 *** Changes since GDB 7.9
 
+* GDB has two new commands: "set serial parity odd|even|none" and
+  "show serial parity".  These allows to set or show parity for the
+  remote serial I/O.
+
 * The "info source" command now displays the producer string if it was
   present in the debug info.  This typically includes the compiler version
   and may include things like its command line arguments.
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index 5efb060..dd601fe 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,3 +1,8 @@
+2015-03-16  Yurij Grechishhev  <yurij.grechishhev@gmail.com>
+
+	* gdb.texinfo (Remote configuration): Document "set/show
+	serial parity command".
+
 2015-03-11  Gary Benson <gbenson@redhat.com>
 
 	* gdb.texinfo (Remote Configuration): Document the
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 9e71642..a818d58 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -19443,6 +19443,13 @@ remote targets.
 @item show serial baud
 Show the current speed of the remote connection.
 
+@item set serial parity @var{parity}
+Set the parity for the remote serial I/O.  Supported values of @var{parity} are:
+@code{even}, @code{none}, and @code{odd}.  The default is @code{none}.
+
+@item show serial parity
+Show the current parity of the serial port.
+
 @item set remotebreak
 @cindex interrupt remote programs
 @cindex BREAK signal instead of Ctrl-C
diff --git a/gdb/monitor.c b/gdb/monitor.c
index b040ec4..548dae3 100644
--- a/gdb/monitor.c
+++ b/gdb/monitor.c
@@ -767,6 +767,7 @@ monitor_open (const char *args, struct monitor_ops *mon_ops, int from_tty)
 	}
     }
 
+  serial_setparity (monitor_desc, serial_parity);
   serial_raw (monitor_desc);
 
   serial_flush_input (monitor_desc);
diff --git a/gdb/remote.c b/gdb/remote.c
index 9aaee13..1554259 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -4310,6 +4310,7 @@ remote_open_1 (const char *name, int from_tty,
 	}
     }
 
+  serial_setparity(rs->remote_desc, serial_parity);
   serial_raw (rs->remote_desc);
 
   /* If there is something sitting in the buffer we might take it as a
diff --git a/gdb/ser-base.c b/gdb/ser-base.c
index 87817c4..93aad40 100644
--- a/gdb/ser-base.c
+++ b/gdb/ser-base.c
@@ -541,6 +541,12 @@ ser_base_setstopbits (struct serial *scb, int num)
   return 0;			/* Never fails!  */
 }
 
+int
+ser_base_setparity (struct serial *scb, int parity)
+{
+  return 0;			/* Never fails!  */
+}
+
 /* Put the SERIAL device into/out-of ASYNC mode.  */
 
 void
diff --git a/gdb/ser-base.h b/gdb/ser-base.h
index 2aba66d..bb1c51d 100644
--- a/gdb/ser-base.h
+++ b/gdb/ser-base.h
@@ -42,7 +42,8 @@ extern int ser_base_noflush_set_tty_state (struct serial *scb,
 					   serial_ttystate new_ttystate,
 					   serial_ttystate old_ttystate);
 extern int ser_base_setbaudrate (struct serial *scb, int rate);
-extern int ser_base_setstopbits (struct serial *scb, int rate);
+extern int ser_base_setstopbits (struct serial *scb, int num);
+extern int ser_base_setparity (struct serial *scb, int parity);
 extern int ser_base_drain_output (struct serial *scb);
 
 extern int ser_base_write (struct serial *scb, const void *buf, size_t count);
diff --git a/gdb/ser-go32.c b/gdb/ser-go32.c
index 6bf1b4e..bbcf6af 100644
--- a/gdb/ser-go32.c
+++ b/gdb/ser-go32.c
@@ -864,6 +864,7 @@ static const struct serial_ops dos_ops =
   dos_noflush_set_tty_state,
   dos_setbaudrate,
   dos_setstopbits,
+  dos_noop,
   dos_noop,			/* Wait for output to drain.  */
   (void (*)(struct serial *, int))NULL	/* Change into async mode.  */
 };
diff --git a/gdb/ser-mingw.c b/gdb/ser-mingw.c
index 7f335e9..be0f990 100644
--- a/gdb/ser-mingw.c
+++ b/gdb/ser-mingw.c
@@ -153,7 +153,6 @@ ser_windows_raw (struct serial *scb)
   if (GetCommState (h, &state) == 0)
     return;
 
-  state.fParity = FALSE;
   state.fOutxCtsFlow = FALSE;
   state.fOutxDsrFlow = FALSE;
   state.fDtrControl = DTR_CONTROL_ENABLE;
@@ -163,7 +162,6 @@ ser_windows_raw (struct serial *scb)
   state.fNull = FALSE;
   state.fAbortOnError = FALSE;
   state.ByteSize = 8;
-  state.Parity = NOPARITY;
 
   scb->current_timeout = 0;
 
@@ -199,6 +197,36 @@ ser_windows_setstopbits (struct serial *scb, int num)
 }
 
 static int
+ser_windows_setparity (struct serial *scb, int parity)
+{
+  HANDLE h = (HANDLE) _get_osfhandle (scb->fd);
+  DCB state;
+
+  if (GetCommState (h, &state) == 0)
+    return -1;
+
+  switch (parity)
+    {
+    case GDBPARITY_NONE:
+      state.Parity = NOPARITY;
+      state.fParity = FALSE;
+      break;
+    case GDBPARITY_ODD:
+      state.Parity = ODDPARITY;
+      state.fParity = TRUE;
+      break;
+    case GDBPARITY_EVEN:
+      state.Parity = EVENPARITY;
+      state.fParity = TRUE;
+      break;
+    default:
+      return 1;
+    }
+
+  return (SetCommState (h, &state) != 0) ? 0 : -1;
+}
+
+static int
 ser_windows_setbaudrate (struct serial *scb, int rate)
 {
   HANDLE h = (HANDLE) _get_osfhandle (scb->fd);
@@ -1227,6 +1255,7 @@ static const struct serial_ops hardwire_ops =
   ser_base_noflush_set_tty_state,
   ser_windows_setbaudrate,
   ser_windows_setstopbits,
+  ser_windows_setparity,
   ser_windows_drain_output,
   ser_base_async,
   ser_windows_read_prim,
@@ -1257,6 +1286,7 @@ static const struct serial_ops tty_ops =
   ser_base_noflush_set_tty_state,
   NULL,
   NULL,
+  NULL,
   ser_base_drain_output,
   NULL,
   NULL,
@@ -1287,6 +1317,7 @@ static const struct serial_ops pipe_ops =
   ser_base_noflush_set_tty_state,
   ser_base_setbaudrate,
   ser_base_setstopbits,
+  ser_base_setparity,
   ser_base_drain_output,
   ser_base_async,
   pipe_windows_read,
@@ -1317,6 +1348,7 @@ static const struct serial_ops tcp_ops =
   ser_base_noflush_set_tty_state,
   ser_base_setbaudrate,
   ser_base_setstopbits,
+  ser_base_setparity,
   ser_base_drain_output,
   ser_base_async,
   net_read_prim,
diff --git a/gdb/ser-pipe.c b/gdb/ser-pipe.c
index bf5e4d4..0700132 100644
--- a/gdb/ser-pipe.c
+++ b/gdb/ser-pipe.c
@@ -224,6 +224,7 @@ static const struct serial_ops pipe_ops =
   ser_base_noflush_set_tty_state,
   ser_base_setbaudrate,
   ser_base_setstopbits,
+  ser_base_setparity,
   ser_base_drain_output,
   ser_base_async,
   ser_unix_read_prim,
diff --git a/gdb/ser-tcp.c b/gdb/ser-tcp.c
index 9c3dcf4..35512e6 100644
--- a/gdb/ser-tcp.c
+++ b/gdb/ser-tcp.c
@@ -394,6 +394,7 @@ static const struct serial_ops tcp_ops =
   ser_base_noflush_set_tty_state,
   ser_base_setbaudrate,
   ser_base_setstopbits,
+  ser_base_setparity,
   ser_base_drain_output,
   ser_base_async,
   net_read_prim,
diff --git a/gdb/ser-unix.c b/gdb/ser-unix.c
index 4125797..88c16ba 100644
--- a/gdb/ser-unix.c
+++ b/gdb/ser-unix.c
@@ -83,6 +83,7 @@ static int hardwire_readchar (struct serial *scb, int timeout);
 static int do_hardwire_readchar (struct serial *scb, int timeout);
 static int rate_to_code (int rate);
 static int hardwire_setbaudrate (struct serial *scb, int rate);
+static int hardwire_setparity (struct serial *scb, int parity);
 static void hardwire_close (struct serial *scb);
 static int get_tty_state (struct serial *scb,
 			  struct hardwire_ttystate * state);
@@ -893,6 +894,46 @@ hardwire_setstopbits (struct serial *scb, int num)
   return set_tty_state (scb, &state);
 }
 
+static int
+hardwire_setparity (struct serial *scb, int parity)
+{
+  struct hardwire_ttystate state;
+  int newparity = 0;
+
+  if (get_tty_state (scb, &state))
+    return -1;
+
+  switch (parity)
+    {
+    case GDBPARITY_NONE:
+      newparity = 0;
+      break;
+    case GDBPARITY_ODD:
+      newparity = PARENB | PARODD;
+      break;
+    case GDBPARITY_EVEN:
+      newparity = PARENB;
+      break;
+    default:
+      return 1;
+    }
+
+#ifdef HAVE_TERMIOS
+  state.termios.c_cflag |= newparity;
+#endif
+
+#ifdef HAVE_TERMIO
+  state.termio.c_cflag |= newparity;
+#endif
+
+#ifdef HAVE_SGTTY
+  return 0;            /* sgtty doesn't support this */
+#endif
+
+  return set_tty_state (scb, &state);
+}
+
+
 static void
 hardwire_close (struct serial *scb)
 {
@@ -929,6 +970,7 @@ static const struct serial_ops hardwire_ops =
   hardwire_noflush_set_tty_state,
   hardwire_setbaudrate,
   hardwire_setstopbits,
+  hardwire_setparity,
   hardwire_drain_output,
   ser_base_async,
   ser_unix_read_prim,
diff --git a/gdb/serial.c b/gdb/serial.c
index b7e620d..09c8b8d 100644
--- a/gdb/serial.c
+++ b/gdb/serial.c
@@ -525,6 +525,12 @@ serial_setstopbits (struct serial *scb, int num)
 }
 
 int
+serial_setparity (struct serial*scb, int parity)
+{
+    return scb->ops->setparity (scb, parity);
+}
+
+int
 serial_can_async_p (struct serial *scb)
 {
   return (scb->ops->async != NULL);
@@ -638,6 +644,27 @@ 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;
+
+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 +697,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."), _("\
diff --git a/gdb/serial.h b/gdb/serial.h
index 9eb1c39..0481ea1 100644
--- a/gdb/serial.h
+++ b/gdb/serial.h
@@ -186,6 +186,14 @@ extern int serial_setbaudrate (struct serial *scb, int rate);
 
 extern int serial_setstopbits (struct serial *scb, int num);
 
+/* Set parity for serial port. Return 0 for success, -1 for failure */
+
+#define GDBPARITY_NONE     0
+#define GDBPARITY_ODD      1
+#define GDBPARITY_EVEN     2
+
+extern int serial_setparity (struct serial *scb, int parity);
+
 /* Asynchronous serial interface: */
 
 /* Can the serial device support asynchronous mode?  */
@@ -271,6 +279,7 @@ struct serial_ops
 				  serial_ttystate);
     int (*setbaudrate) (struct serial *, int rate);
     int (*setstopbits) (struct serial *, int num);
+    int (*setparity) (struct serial *, int parity);
     /* Wait for output to drain.  */
     int (*drain_output) (struct serial *);
     /* Change the serial device into/out of asynchronous mode, call
diff --git a/gdb/target.h b/gdb/target.h
index c95e1a4..685a37f 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -2236,6 +2236,10 @@ extern int remote_debug;
 
 /* Speed in bits per second, or -1 which means don't mess with the speed.  */
 extern int baud_rate;
+
+/* Parity for serial port */
+extern int serial_parity;
+
 /* Timeout limit for response from target.  */
 extern int remote_timeout;
 

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: Setting parity for remote serial
  2015-02-26 19:50         ` Yurij Grechishhev
@ 2015-02-27  8:16           ` Joel Brobecker
  2015-03-15 21:49             ` Yurij Grechishhev
  0 siblings, 1 reply; 44+ messages in thread
From: Joel Brobecker @ 2015-02-27  8:16 UTC (permalink / raw)
  To: Yurij Grechishhev; +Cc: gdb-patches

> Glad to hear that this patch is still needed.
> I believe, all questions with FSF copyright assignments had been resolved?
> Please, let me know what I should do to complete this contribution.

Indeed! Thanks very much for doing that.

If you could rebase the patch against master, and resubmit,
I promise to review it promptly (I will taking a week off
Mar 07-15, though). If you'd rather I took it over, I will
try to do so after I come back.

Thanks again!
-- 
Joel

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: Setting parity for remote serial
  2015-02-25 15:16       ` Joel Brobecker
@ 2015-02-26 19:50         ` Yurij Grechishhev
  2015-02-27  8:16           ` Joel Brobecker
  0 siblings, 1 reply; 44+ messages in thread
From: Yurij Grechishhev @ 2015-02-26 19:50 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

Hi Joel,
Glad to hear that this patch is still needed.
I believe, all questions with FSF copyright assignments had been resolved?
Please, let me know what I should do to complete this contribution.

Thank you

WBR,
Yury

2015-02-25 19:16 GMT+04:00 Joel Brobecker <brobecker@adacore.com>:
> Hello,
>
> On Fri, Oct 04, 2013 at 09:34:47AM +0200, Joel Brobecker wrote:
>> Thanks for your reply, Yurij.
>>
>> > > Any update on this patch?
>> > No updates
>>
>> Is there anything I can do to help this patch come through? I was
>> under the impression that it had stalled waiting for your assignment
>> to come through.
>>
>> > > I don't see you on file at the FSF regarding copyright assignment. What's
>> > the status on this?
>> > I think, assignment/disclaimer process with the FSF is currently complete.
>>
>> I had actually searched the records prior to sending the question.
>> Was the assignment done under a different name or maybe under a
>> university or employer's name?
>
> This is a feature that we would like to have. Unfortunately, since
> we lost contact with Yurij, unless we hear from him again, we will
> ask someone at AdaCore who hasn't seen the patch to implement
> a similar feature. Once we have that, we'll contribute it here.
>
> --
> Joel

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: Setting parity for remote serial
  2013-10-04  7:34     ` Joel Brobecker
  2013-10-09  4:11       ` Joel Brobecker
@ 2015-02-25 15:16       ` Joel Brobecker
  2015-02-26 19:50         ` Yurij Grechishhev
  1 sibling, 1 reply; 44+ messages in thread
From: Joel Brobecker @ 2015-02-25 15:16 UTC (permalink / raw)
  To: Yurij Grechishhev; +Cc: gdb-patches

Hello,

On Fri, Oct 04, 2013 at 09:34:47AM +0200, Joel Brobecker wrote:
> Thanks for your reply, Yurij.
> 
> > > Any update on this patch?
> > No updates
> 
> Is there anything I can do to help this patch come through? I was
> under the impression that it had stalled waiting for your assignment
> to come through.
> 
> > > I don't see you on file at the FSF regarding copyright assignment. What's
> > the status on this?
> > I think, assignment/disclaimer process with the FSF is currently complete.
> 
> I had actually searched the records prior to sending the question.
> Was the assignment done under a different name or maybe under a
> university or employer's name?

This is a feature that we would like to have. Unfortunately, since
we lost contact with Yurij, unless we hear from him again, we will
ask someone at AdaCore who hasn't seen the patch to implement
a similar feature. Once we have that, we'll contribute it here.

-- 
Joel

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: Setting parity for remote serial
  2013-10-04  7:34     ` Joel Brobecker
@ 2013-10-09  4:11       ` Joel Brobecker
  2015-02-25 15:16       ` Joel Brobecker
  1 sibling, 0 replies; 44+ messages in thread
From: Joel Brobecker @ 2013-10-09  4:11 UTC (permalink / raw)
  To: Yurij Grechishhev; +Cc: gdb-patches

> > I think, assignment/disclaimer process with the FSF is currently
> > complete.

For the record, I can confirm that Yurij's assignment is complete,
as we did receive a notification from the FSF about it back in
September.

I still cannot find his entry in the FSF records, however, and I have
sent a message to the FSF about that. But, in the meantime, we should
be able to accept Yurij's contributions.

-- 
Joel

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: Setting parity for remote serial
       [not found]   ` <CAAyhtXTmrJ04BVhziaFnogGyWLz7+G+Qwbc9UnHJkrEbDgTjFw@mail.gmail.com>
@ 2013-10-04  7:34     ` Joel Brobecker
  2013-10-09  4:11       ` Joel Brobecker
  2015-02-25 15:16       ` Joel Brobecker
  0 siblings, 2 replies; 44+ messages in thread
From: Joel Brobecker @ 2013-10-04  7:34 UTC (permalink / raw)
  To: Yurij Grechishhev; +Cc: gdb-patches

Thanks for your reply, Yurij.

> > Any update on this patch?
> No updates

Is there anything I can do to help this patch come through? I was
under the impression that it had stalled waiting for your assignment
to come through.

> > I don't see you on file at the FSF regarding copyright assignment. What's
> the status on this?
> I think, assignment/disclaimer process with the FSF is currently complete.

I had actually searched the records prior to sending the question.
Was the assignment done under a different name or maybe under a
university or employer's name?

Thank you,
-- 
Joel

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: Setting parity for remote serial
  2013-09-26 17:00 ` Joel Brobecker
@ 2013-10-02 21:59   ` Yurij Grechishhev
       [not found]   ` <CAAyhtXTmrJ04BVhziaFnogGyWLz7+G+Qwbc9UnHJkrEbDgTjFw@mail.gmail.com>
  1 sibling, 0 replies; 44+ messages in thread
From: Yurij Grechishhev @ 2013-10-02 21:59 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

> Any update on this patch?
No updates

> I don't see you on file at the FSF regarding copyright assignment. What's the status on this?
I think, assignment/disclaimer process with the FSF is currently complete.

2013/9/26 Joel Brobecker <brobecker@adacore.com>:
>> Updated patch for serial parity support:
>>
>> diff -up ../../../gdb_old/gdb-7.6/gdb/doc/ChangeLog gdb/doc/ChangeLog
>> --- ../../../gdb_old/gdb-7.6/gdb/doc/ChangeLog  2013-07-10
>> 21:55:24.921750052 +0400
>> +++ gdb/doc/ChangeLog   2013-07-16 18:46:31.425614819 +0400
>> @@ -1,3 +1,6 @@
>> +2013-07-16  Yurij Grechishhev  <yurij.grechishhev@gmail.com>
>> +       * gdb.texinfo (Remote configuration): Document "set/show
>> +       remoteparity".
>>  2013-04-12  Jan Kratochvil  <jan.kratochvil@redhat.com>
>>             Eli Zaretskii  <eliz@gnu.org>
>
> Any update on this patch? We just came across a platform where
> such a feature would be useful?
>
> Looking at the patch itself, I can see some trivial issues with
> coding style. But before going into re-basing it for the current
> head, and working on cleaning it up, I don't see you on file at
> the FSF regarding copyright assignment. What's the status on this?
>
> Thank you,
> --
> Joel



-- 
With best regards!
____________________________

Yurij Grechishhev
Bauman State Technical University,
Department of Computer Systems and Networks

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: Setting parity for remote serial
  2013-07-24 14:29 Setting parity for remote serial Yurij Grechishhev
  2013-07-24 16:53 ` Eli Zaretskii
@ 2013-09-26 17:00 ` Joel Brobecker
  2013-10-02 21:59   ` Yurij Grechishhev
       [not found]   ` <CAAyhtXTmrJ04BVhziaFnogGyWLz7+G+Qwbc9UnHJkrEbDgTjFw@mail.gmail.com>
  1 sibling, 2 replies; 44+ messages in thread
From: Joel Brobecker @ 2013-09-26 17:00 UTC (permalink / raw)
  To: Yurij Grechishhev; +Cc: gdb-patches

> Updated patch for serial parity support:
> 
> diff -up ../../../gdb_old/gdb-7.6/gdb/doc/ChangeLog gdb/doc/ChangeLog
> --- ../../../gdb_old/gdb-7.6/gdb/doc/ChangeLog  2013-07-10
> 21:55:24.921750052 +0400
> +++ gdb/doc/ChangeLog   2013-07-16 18:46:31.425614819 +0400
> @@ -1,3 +1,6 @@
> +2013-07-16  Yurij Grechishhev  <yurij.grechishhev@gmail.com>
> +       * gdb.texinfo (Remote configuration): Document "set/show
> +       remoteparity".
>  2013-04-12  Jan Kratochvil  <jan.kratochvil@redhat.com>
>             Eli Zaretskii  <eliz@gnu.org>

Any update on this patch? We just came across a platform where
such a feature would be useful?

Looking at the patch itself, I can see some trivial issues with
coding style. But before going into re-basing it for the current
head, and working on cleaning it up, I don't see you on file at
the FSF regarding copyright assignment. What's the status on this?

Thank you,
-- 
Joel

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: Setting parity for remote serial
  2013-07-29 19:25           ` Pedro Alves
@ 2013-07-29 20:14             ` Yurij Grechishhev
  0 siblings, 0 replies; 44+ messages in thread
From: Yurij Grechishhev @ 2013-07-29 20:14 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

Thanks, it's the real goods.

2013/7/29 Pedro Alves <palves@redhat.com>:
> On 07/29/2013 07:33 PM, Eli Zaretskii wrote:
>>> > Gmail web-client and Mozilla Thunderbird are not the best mail clients
>>> > for sending patches. Which mail client do you use?
>
> See this on how to teach Thunderbird (and others) to not suck for
> sending patches:
>
> http://sourceware.org/gdb/wiki/ContributionChecklist#Submitting_patches
>
> --
> Pedro Alves
>



-- 
With best regards!
____________________________

Yurij Grechishhev
Bauman State Technical University,
Department of Computer Systems and Networks

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: Setting parity for remote serial
  2013-07-29 18:34         ` Eli Zaretskii
@ 2013-07-29 19:25           ` Pedro Alves
  2013-07-29 20:14             ` Yurij Grechishhev
  0 siblings, 1 reply; 44+ messages in thread
From: Pedro Alves @ 2013-07-29 19:25 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Yurij Grechishhev, gdb-patches

On 07/29/2013 07:33 PM, Eli Zaretskii wrote:
>> > Gmail web-client and Mozilla Thunderbird are not the best mail clients
>> > for sending patches. Which mail client do you use?

See this on how to teach Thunderbird (and others) to not suck for
sending patches:

http://sourceware.org/gdb/wiki/ContributionChecklist#Submitting_patches

-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: Setting parity for remote serial
  2013-07-25 16:21     ` Eli Zaretskii
       [not found]       ` <CAAyhtXRJaoxvfm7FH06AXeATgscXn4SrY5=ZD_h=BBmPoUdTBQ@mail.gmail.com>
@ 2013-07-29 19:04       ` Yurij Grechishhev
  1 sibling, 0 replies; 44+ messages in thread
From: Yurij Grechishhev @ 2013-07-29 19:04 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 841 bytes --]

Updated patch is in attachment.

2013/7/25 Eli Zaretskii <eliz@gnu.org>:
>> Date: Thu, 25 Jul 2013 11:15:11 +0400
>> From: Yurij Grechishhev <yurij.grechishhev@gmail.com>
>> Cc: gdb-patches@sourceware.org
>>
>> Spaces in ChangeLog are due to the mail client. I could send the attachement.
>
> Well, maybe you should consider switching to another mail client,
> then.  Attachments are okay, but generally less desirable.
>
>>  *** Changes in GDB 7.6
>>
>> +* GDB has two new commands: "set remoteparity odd|even|none" and
>> +  "show remoteparity". These allows to set or show parity for the
>> +  remote serial I/O.
>
> Again, two spaces between sentences.
>
> Otherwise, OK.
>
> Thanks.



-- 
With best regards!
____________________________

Yurij Grechishhev
Bauman State Technical University,
Department of Computer Systems and Networks

[-- Attachment #2: serialparity.patch --]
[-- Type: application/octet-stream, Size: 3023 bytes --]

--- ../../../gdb_old/gdb-7.6/gdb/doc/ChangeLog	2013-07-10 21:55:24.921750052 +0400
+++ gdb/doc/ChangeLog	2013-07-25 14:50:14.960811746 +0400
@@ -1,3 +1,8 @@
+2013-07-16  Yurij Grechishhev  <yurij.grechishhev@gmail.com>
+	
+	* gdb.texinfo (Remote configuration): Document "set/show
+	remoteparity".
+	
 2013-04-12  Jan Kratochvil  <jan.kratochvil@redhat.com>
 	    Eli Zaretskii  <eliz@gnu.org>
 

--- ../../../gdb_old/gdb-7.6/gdb/ChangeLog	2013-07-10 21:55:22.485750321 +0400
+++ gdb/ChangeLog	2013-07-25 14:24:03.806935947 +0400
@@ -1,3 +1,30 @@
+2013-07-16  Yurij Grechishhev  <yurij.grechishhev@gmail.com>
+
+	* NEWS: Mention set/show remoteparity command.
+	* monitor.c (monitor_open): Add serial_setparity.
+	* remote.c (remote_open_1): Likewise.
+	* ser-base.c (ser_base_serparity): New function.
+	* ser-base.h: Add ser_base_setparity declaration.
+	* serail.c: Add serial_parity declaration and definitions of
+	parity_enums and parity.
+	(set_parity): New function.
+	(serial_setparity): New function.
+	(_initialize_serial): Add set/show remoteparity command description
+	* serial.h: Add GDBPARITY_NONE, GDBPARITY_ODD, GDBPARITY_EVEN
+	definitions. Add serial_setparity declaration.
+	(serial_ops): Add setparity entry.
+	* ser-mingw.c (ser_windows_raw): Remove state.fParity and
+	state.Parity definitions.
+	(ser_windows_setparity): New function.
+	(_initialize_ser_windows): ops->setparity setting.
+	* ser-pipe.c (_initialize_ser_pipe): Likewise.
+	* ser-tcp.c (_initialize_ser_tcp): Likewise.
+	* ser-unix.c: Add hardwire_setparity declaration.
+	(hardwire_setparity): New function.
+	(_initialize_ser_hardwire): ops->setparity setting.
+	* target.h: serial_parity declaration.
+	* top.c: serial_parity definition.
+
 2013-04-26  Joel Brobecker  <brobecker@adacore.com>
 
 	* NEWS: Change "since GDB 7.5" into "in GDB 7.6".


--- ../../../gdb_old/gdb-7.6/gdb/doc/gdb.texinfo	2013-07-10 21:55:25.257751657 +0400
+++ gdb/doc/gdb.texinfo	2013-07-25 14:18:36.581811831 +0400
@@ -18168,6 +18168,13 @@ default is not to record at all.
 Show the current setting  of the file name on which to record the
 serial communications.
 
+@item set remoteparity @var{parity}
+Set the parity for the remote serial I/O.  Supported values of @var{parity} are:
+@code{even}, @code{none}, and @code{odd}.  The default is @code{none}.
+
+@item show remoteparity
+Show the current parity of the serial port.
+
 @item set remotetimeout @var{num}
 @cindex timeout for serial communications
 @cindex remote timeout

--- ../../../gdb_old/gdb-7.6/gdb/NEWS	2013-07-10 21:55:32.402748483 +0400
+++ gdb/NEWS	2013-07-30 00:16:28.440596874 +0400
@@ -3,6 +3,10 @@
 
 *** Changes in GDB 7.6
 
+* GDB has two new commands: "set remoteparity odd|even|none" and 
+  "show remoteparity".  These allows to set or show parity for the 
+  remote serial I/O.
+
 * Target record has been renamed to record-full.
   Record/replay is now enabled with the "record full" command.
   This also affects settings that are associated with full record/replay


^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: Setting parity for remote serial
       [not found]       ` <CAAyhtXRJaoxvfm7FH06AXeATgscXn4SrY5=ZD_h=BBmPoUdTBQ@mail.gmail.com>
@ 2013-07-29 18:34         ` Eli Zaretskii
  2013-07-29 19:25           ` Pedro Alves
  0 siblings, 1 reply; 44+ messages in thread
From: Eli Zaretskii @ 2013-07-29 18:34 UTC (permalink / raw)
  To: Yurij Grechishhev; +Cc: gdb-patches

> Date: Mon, 29 Jul 2013 20:55:55 +0400
> From: Yurij Grechishhev <yurij.grechishhev@gmail.com>
> 
> Sorry for the mistakes. It's my first experience in gdb patching.
> Updated patch is in attachment.

Thanks.  But I only see the patches for the manual and NEWS, while the
ChangeLog entries describe a much larger set of changes.  Am I missing
something?

Also, please CC the mailing list on your messages, so that this
discussion gets archoved.

> Gmail web-client and Mozilla Thunderbird are not the best mail clients
> for sending patches. Which mail client do you use?

I use Emacs.

> Will you add my changes to the gdb CVS?

I don't see your copyright assignment on file, do you have one?
Without an assignment, there's a limit to the size of the changes we
can accept, and I think your contribution is above the limit.

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: Setting parity for remote serial
  2013-07-25  7:15   ` Yurij Grechishhev
@ 2013-07-25 16:21     ` Eli Zaretskii
       [not found]       ` <CAAyhtXRJaoxvfm7FH06AXeATgscXn4SrY5=ZD_h=BBmPoUdTBQ@mail.gmail.com>
  2013-07-29 19:04       ` Yurij Grechishhev
  0 siblings, 2 replies; 44+ messages in thread
From: Eli Zaretskii @ 2013-07-25 16:21 UTC (permalink / raw)
  To: Yurij Grechishhev; +Cc: gdb-patches

> Date: Thu, 25 Jul 2013 11:15:11 +0400
> From: Yurij Grechishhev <yurij.grechishhev@gmail.com>
> Cc: gdb-patches@sourceware.org
> 
> Spaces in ChangeLog are due to the mail client. I could send the attachement.

Well, maybe you should consider switching to another mail client,
then.  Attachments are okay, but generally less desirable.

>  *** Changes in GDB 7.6
> 
> +* GDB has two new commands: "set remoteparity odd|even|none" and
> +  "show remoteparity". These allows to set or show parity for the
> +  remote serial I/O.

Again, two spaces between sentences.

Otherwise, OK.

Thanks.

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: Setting parity for remote serial
  2013-07-24 16:53 ` Eli Zaretskii
@ 2013-07-25  7:15   ` Yurij Grechishhev
  2013-07-25 16:21     ` Eli Zaretskii
  0 siblings, 1 reply; 44+ messages in thread
From: Yurij Grechishhev @ 2013-07-25  7:15 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: gdb-patches

Spaces in ChangeLog are due to the mail client. I could send the attachement.

--- ../../../gdb_old/gdb-7.6/gdb/doc/ChangeLog    2013-07-10
21:55:24.921750052 +0400
+++ gdb/doc/ChangeLog    2013-07-25 14:50:14.960811746 +0400
@@ -1,3 +1,8 @@
+2013-07-16  Yurij Grechishhev  <yurij.grechishhev@gmail.com>
+
+    * gdb.texinfo (Remote configuration): Document "set/show
+    remoteparity".
+
 2013-04-12  Jan Kratochvil  <jan.kratochvil@redhat.com>
         Eli Zaretskii  <eliz@gnu.org>


--- ../../../gdb_old/gdb-7.6/gdb/ChangeLog    2013-07-10
21:55:22.485750321 +0400
+++ gdb/ChangeLog    2013-07-25 14:24:03.806935947 +0400
@@ -1,3 +1,30 @@
+2013-07-16  Yurij Grechishhev  <yurij.grechishhev@gmail.com>
+
+    * NEWS: Mention set/show remoteparity command.
+    * monitor.c (monitor_open): Add serial_setparity.
+    * remote.c (remote_open_1): Likewise.
+    * ser-base.c (ser_base_serparity): New function.
+    * ser-base.h: Add ser_base_setparity declaration.
+    * serail.c: Add serial_parity declaration and definitions of
+    parity_enums and parity.
+    (set_parity): New function.
+    (serial_setparity): New function.
+    (_initialize_serial): Add set/show remoteparity command description
+    * serial.h: Add GDBPARITY_NONE, GDBPARITY_ODD, GDBPARITY_EVEN
+    definitions. Add serial_setparity declaration.
+    (serial_ops): Add setparity entry.
+    * ser-mingw.c (ser_windows_raw): Remove state.fParity and
+    state.Parity definitions.
+    (ser_windows_setparity): New function.
+    (_initialize_ser_windows): ops->setparity setting.
+    * ser-pipe.c (_initialize_ser_pipe): Likewise.
+    * ser-tcp.c (_initialize_ser_tcp): Likewise.
+    * ser-unix.c: Add hardwire_setparity declaration.
+    (hardwire_setparity): New function.
+    (_initialize_ser_hardwire): ops->setparity setting.
+    * target.h: serial_parity declaration.
+    * top.c: serial_parity definition.
+
 2013-04-26  Joel Brobecker  <brobecker@adacore.com>

     * NEWS: Change "since GDB 7.5" into "in GDB 7.6".

--- ../../../gdb_old/gdb-7.6/gdb/doc/gdb.texinfo    2013-07-10
21:55:25.257751657 +0400
+++ gdb/doc/gdb.texinfo    2013-07-25 14:18:36.581811831 +0400
@@ -18168,6 +18168,13 @@ default is not to record at all.
 Show the current setting  of the file name on which to record the
 serial communications.

+@item set remoteparity @var{parity}
+Set the parity for the remote serial I/O.  Supported values of
@var{parity} are:
+@code{even}, @code{none}, and @code{odd}.  The default is @code{none}.
+
+@item show remoteparity
+Show the current parity of the serial port.
+
 @item set remotetimeout @var{num}
 @cindex timeout for serial communications
 @cindex remote timeout


--- ../../../gdb_old/gdb-7.6/gdb/NEWS    2013-07-10 21:55:32.402748483 +0400
+++ gdb/NEWS    2013-07-25 14:26:00.463811247 +0400
@@ -3,6 +3,10 @@

 *** Changes in GDB 7.6

+* GDB has two new commands: "set remoteparity odd|even|none" and
+  "show remoteparity". These allows to set or show parity for the
+  remote serial I/O.
+
 * Target record has been renamed to record-full.
   Record/replay is now enabled with the "record full" command.
   This also affects settings that are associated with full record/replay




-- 
With best regards!
____________________________

Yurij Grechishhev
Bauman State Technical University,
Department of Computer Systems and Networks

2013/7/24 Eli Zaretskii <eliz@gnu.org>:
>> Date: Wed, 24 Jul 2013 18:29:11 +0400
>> From: Yurij Grechishhev <yurij.grechishhev@gmail.com>
>>
>> Updated patch for serial parity support:
>
> Thanks.
>
>> +++ gdb/doc/ChangeLog   2013-07-16 18:46:31.425614819 +0400
>> @@ -1,3 +1,6 @@
>> +2013-07-16  Yurij Grechishhev  <yurij.grechishhev@gmail.com>
>> +       * gdb.texinfo (Remote configuration): Document "set/show
>> +       remoteparity".
>>  2013-04-12  Jan Kratochvil  <jan.kratochvil@redhat.com>
>>             Eli Zaretskii  <eliz@gnu.org>
>
> You need to leave an empty line between your ChangeLog entry and the
> previous one.  Also, each line in ChangeLog should begin with TAB
> character, not with spaces.
>
>> +@item set remoteparity @var{parity}
>> +Set the parity for the remote serial I/O. Supported values of @var{parity} are:
>> +@code{even}, @code{none}, and @code{odd}. The default is @code{none}.
>
> Two spaces between sentences, please.
>
> The documentation part is okay with these changes.
>
> What about NEWS?



-- 
With best regards!
____________________________

Yurij Grechishhev
Bauman State Technical University,
Department of Computer Systems and Networks

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: Setting parity for remote serial
  2013-07-24 14:29 Setting parity for remote serial Yurij Grechishhev
@ 2013-07-24 16:53 ` Eli Zaretskii
  2013-07-25  7:15   ` Yurij Grechishhev
  2013-09-26 17:00 ` Joel Brobecker
  1 sibling, 1 reply; 44+ messages in thread
From: Eli Zaretskii @ 2013-07-24 16:53 UTC (permalink / raw)
  To: Yurij Grechishhev; +Cc: gdb-patches

> Date: Wed, 24 Jul 2013 18:29:11 +0400
> From: Yurij Grechishhev <yurij.grechishhev@gmail.com>
> 
> Updated patch for serial parity support:

Thanks.

> +++ gdb/doc/ChangeLog   2013-07-16 18:46:31.425614819 +0400
> @@ -1,3 +1,6 @@
> +2013-07-16  Yurij Grechishhev  <yurij.grechishhev@gmail.com>
> +       * gdb.texinfo (Remote configuration): Document "set/show
> +       remoteparity".
>  2013-04-12  Jan Kratochvil  <jan.kratochvil@redhat.com>
>             Eli Zaretskii  <eliz@gnu.org>

You need to leave an empty line between your ChangeLog entry and the
previous one.  Also, each line in ChangeLog should begin with TAB
character, not with spaces.

> +@item set remoteparity @var{parity}
> +Set the parity for the remote serial I/O. Supported values of @var{parity} are:
> +@code{even}, @code{none}, and @code{odd}. The default is @code{none}.

Two spaces between sentences, please.

The documentation part is okay with these changes.

What about NEWS?

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: Setting parity for remote serial
@ 2013-07-24 14:29 Yurij Grechishhev
  2013-07-24 16:53 ` Eli Zaretskii
  2013-09-26 17:00 ` Joel Brobecker
  0 siblings, 2 replies; 44+ messages in thread
From: Yurij Grechishhev @ 2013-07-24 14:29 UTC (permalink / raw)
  To: gdb-patches

Updated patch for serial parity support:

diff -up ../../../gdb_old/gdb-7.6/gdb/doc/ChangeLog gdb/doc/ChangeLog
--- ../../../gdb_old/gdb-7.6/gdb/doc/ChangeLog  2013-07-10
21:55:24.921750052 +0400
+++ gdb/doc/ChangeLog   2013-07-16 18:46:31.425614819 +0400
@@ -1,3 +1,6 @@
+2013-07-16  Yurij Grechishhev  <yurij.grechishhev@gmail.com>
+       * gdb.texinfo (Remote configuration): Document "set/show
+       remoteparity".
 2013-04-12  Jan Kratochvil  <jan.kratochvil@redhat.com>
            Eli Zaretskii  <eliz@gnu.org>

diff -up ../../../gdb_old/gdb-7.6/gdb/doc/gdb.texinfo gdb/doc/gdb.texinfo
--- ../../../gdb_old/gdb-7.6/gdb/doc/gdb.texinfo        2013-07-10
21:55:25.257751657 +0400
+++ gdb/doc/gdb.texinfo 2013-07-16 18:04:54.128738129 +0400
@@ -18168,6 +18168,13 @@ default is not to record at all.
 Show the current setting  of the file name on which to record the
 serial communications.

+@item set remoteparity @var{parity}
+Set the parity for the remote serial I/O. Supported values of @var{parity} are:
+@code{even}, @code{none}, and @code{odd}. The default is @code{none}.
+
+@item show remoteparity
+Show the current parity of the serial port.
+
 @item set remotetimeout @var{num}
 @cindex timeout for serial communications
 @cindex remote timeout

diff -up ../../../gdb_old/gdb-7.6/gdb/ChangeLog gdb/ChangeLog
--- ../../../gdb_old/gdb-7.6/gdb/ChangeLog    2013-07-10
21:55:22.485750321 +0400
+++ gdb/ChangeLog    2013-07-16 17:33:47.467613587 +0400
@@ -1,3 +1,29 @@
+2013-07-16  Yurij Grechishhev  <yurij.grechishhev@gmail.com>
+    * monitor.c (monitor_open): Add serial_setparity.
+    * remote.c (remote_open_1): Likewise.
+    * ser-base.c (ser_base_serparity): New function.
+    * ser-base.h: Add ser_base_setparity declaration.
+    * serail.c: Add serial_parity declaration and definitions of
+    parity_enums and parity.
+    (set_parity): New function.
+    (serial_setparity): New function.
+    (_initialize_serial): Add set/show remoteparity command description
+    * serial.h: Add GDBPARITY_NONE, GDBPARITY_ODD, GDBPARITY_EVEN
+    definitions. Add serial_setparity declaration.
+    (serial_ops): Add setparity entry.
+    * ser-mingw.c (ser_windows_raw): Remove state.fParity and
+    state.Parity definitions.
+    (ser_windows_setparity): New function.
+    (_initialize_ser_windows): ops->setparity setting.
+    * ser-pipe.c (_initialize_ser_pipe): Likewise.
+    * ser-tcp.c (_initialize_ser_tcp): Likewise.
+    * ser-unix.c: Add hardwire_setparity declaration.
+    (hardwire_setparity): New function.
+    (_initialize_ser_hardwire): ops->setparity setting.
+    * target.h: serial_parity declaration.
+    * top.c: serial_parity definition.
+
+
 2013-04-26  Joel Brobecker  <brobecker@adacore.com>

     * NEWS: Change "since GDB 7.5" into "in GDB 7.6".
Common subdirectories: ../../../gdb_old/gdb-7.6/gdb/cli and gdb/cli
Common subdirectories: ../../../gdb_old/gdb-7.6/gdb/common and gdb/common
Common subdirectories: ../../../gdb_old/gdb-7.6/gdb/config and gdb/config
Common subdirectories: ../../../gdb_old/gdb-7.6/gdb/contrib and gdb/contrib
Common subdirectories: ../../../gdb_old/gdb-7.6/gdb/data-directory and
gdb/data-directory
Common subdirectories: ../../../gdb_old/gdb-7.6/gdb/doc and gdb/doc
Common subdirectories: ../../../gdb_old/gdb-7.6/gdb/features and gdb/features
Common subdirectories: ../../../gdb_old/gdb-7.6/gdb/gdbserver and gdb/gdbserver
Common subdirectories: ../../../gdb_old/gdb-7.6/gdb/gnulib and gdb/gnulib
Common subdirectories: ../../../gdb_old/gdb-7.6/gdb/mi and gdb/mi
diff -up ../../../gdb_old/gdb-7.6/gdb/monitor.c gdb/monitor.c
--- ../../../gdb_old/gdb-7.6/gdb/monitor.c    2013-07-10
21:55:33.656750073 +0400
+++ gdb/monitor.c    2013-07-04 23:54:32.472595952 +0400
@@ -768,6 +768,7 @@ monitor_open (char *args, struct monitor
     }
     }

+  serial_setparity (monitor_desc, serial_parity);
   serial_raw (monitor_desc);

   serial_flush_input (monitor_desc);
Common subdirectories: ../../../gdb_old/gdb-7.6/gdb/po and gdb/po
Common subdirectories: ../../../gdb_old/gdb-7.6/gdb/python and gdb/python
Common subdirectories: ../../../gdb_old/gdb-7.6/gdb/regformats and
gdb/regformats
diff -up ../../../gdb_old/gdb-7.6/gdb/remote.c gdb/remote.c
--- ../../../gdb_old/gdb-7.6/gdb/remote.c    2013-07-10 21:55:34.645747970 +0400
+++ gdb/remote.c    2013-07-04 23:50:52.855721644 +0400
@@ -4256,6 +4256,7 @@ remote_open_1 (char *name, int from_tty,
     }
     }

+  serial_setparity(remote_desc, serial_parity);
   serial_raw (remote_desc);

   /* If there is something sitting in the buffer we might take it as a
diff -up ../../../gdb_old/gdb-7.6/gdb/ser-base.c gdb/ser-base.c
--- ../../../gdb_old/gdb-7.6/gdb/ser-base.c    2013-07-10
21:55:24.161873687 +0400
+++ gdb/ser-base.c    2013-07-05 00:28:55.795720278 +0400
@@ -536,6 +536,14 @@ ser_base_setbaudrate (struct serial *scb
   return 0;            /* Never fails!  */
 }

+
+int
+ser_base_setparity (struct serial *scb, int num)
+{
+  return 0;            /* Never fails!  */
+}
+
+
 int
 ser_base_setstopbits (struct serial *scb, int num)
 {
diff -up ../../../gdb_old/gdb-7.6/gdb/ser-base.h gdb/ser-base.h
--- ../../../gdb_old/gdb-7.6/gdb/ser-base.h    2013-07-10
21:55:24.168750025 +0400
+++ gdb/ser-base.h    2013-07-05 00:30:36.017596667 +0400
@@ -43,6 +43,7 @@ extern int ser_base_noflush_set_tty_stat
                        serial_ttystate old_ttystate);
 extern int ser_base_setbaudrate (struct serial *scb, int rate);
 extern int ser_base_setstopbits (struct serial *scb, int rate);
+extern int ser_base_setparity (struct serial *scb, int parity);
 extern int ser_base_drain_output (struct serial *scb);

 extern int ser_base_write (struct serial *scb, const char *str, int len);
diff -up ../../../gdb_old/gdb-7.6/gdb/serial.c gdb/serial.c
--- ../../../gdb_old/gdb-7.6/gdb/serial.c    2013-07-10 21:55:35.224750365 +0400
+++ gdb/serial.c    2013-07-10 20:41:31.899897384 +0400
@@ -26,6 +26,9 @@

 extern void _initialize_serial (void);

+/* Parity for serial port */
+extern int serial_parity;
+
 /* Is serial being debugged?  */

 static unsigned int global_serial_debug_p;
@@ -53,10 +56,29 @@ static const char logbase_ascii[] = "asc
 static const char *const logbase_enums[] =
 {logbase_hex, logbase_octal, logbase_ascii, NULL};
 static const char *serial_logbase = logbase_ascii;
-

 static int serial_current_type = 0;

+/* Parity for serial port */
+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;
+
+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;
+}
+
+
 /* Log char CH of type CHTYPE, with TIMEOUT.  */

 /* Define bogus char to represent a BREAK.  Should be careful to choose a value
@@ -521,6 +543,12 @@ serial_setstopbits (struct serial *scb,
 }

 int
+serial_setparity (struct serial*scb, int parity)
+{
+  return scb->ops->setparity (scb, parity);
+}
+
+int
 serial_can_async_p (struct serial *scb)
 {
   return (scb->ops->async != NULL);
@@ -658,6 +686,15 @@ Show numerical base for remote session l
             NULL, /* FIXME: i18n: */
             &setlist, &showlist);

+  add_setshow_enum_cmd ("remoteparity", 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: */
+                        &setlist, &showlist);
+
+
   add_setshow_zuinteger_cmd ("serial", class_maintenance,
                  &global_serial_debug_p, _("\
 Set serial debugging."), _("\
diff -up ../../../gdb_old/gdb-7.6/gdb/serial.h gdb/serial.h
--- ../../../gdb_old/gdb-7.6/gdb/serial.h    2013-07-10 21:55:33.445749528 +0400
+++ gdb/serial.h    2013-07-10 20:17:17.705956716 +0400
@@ -177,6 +177,14 @@ extern int serial_noflush_set_tty_state

 extern int serial_setbaudrate (struct serial *scb, int rate);

+/* Set parity for serial port. Return 0 for success, -1 for failure */
+
+#define GDBPARITY_NONE     0
+#define GDBPARITY_ODD      1
+#define GDBPARITY_EVEN     2
+
+extern int serial_setparity (struct serial *scb, int parity);
+
 /* Set the number of stop bits to the value specified.  Returns 0 for
    success, -1 for failure.  */

@@ -272,6 +280,7 @@ struct serial_ops
                   serial_ttystate);
     int (*setbaudrate) (struct serial *, int rate);
     int (*setstopbits) (struct serial *, int num);
+    int (*setparity) (struct serial *, int parity);
     /* Wait for output to drain.  */
     int (*drain_output) (struct serial *);
     /* Change the serial device into/out of asynchronous mode, call
diff -up ../../../gdb_old/gdb-7.6/gdb/ser-mingw.c gdb/ser-mingw.c
--- ../../../gdb_old/gdb-7.6/gdb/ser-mingw.c    2013-07-10
21:55:24.185807109 +0400
+++ gdb/ser-mingw.c    2013-07-16 16:01:35.854613120 +0400
@@ -156,7 +156,6 @@ ser_windows_raw (struct serial *scb)
   if (GetCommState (h, &state) == 0)
     return;

-  state.fParity = FALSE;
   state.fOutxCtsFlow = FALSE;
   state.fOutxDsrFlow = FALSE;
   state.fDtrControl = DTR_CONTROL_ENABLE;
@@ -166,7 +165,6 @@ ser_windows_raw (struct serial *scb)
   state.fNull = FALSE;
   state.fAbortOnError = FALSE;
   state.ByteSize = 8;
-  state.Parity = NOPARITY;

   scb->current_timeout = 0;

@@ -202,6 +200,36 @@ ser_windows_setstopbits (struct serial *
 }

 static int
+ser_windows_setparity (struct serial *scb, int parity)
+{
+  HANDLE h = (HANDLE) _get_osfhandle (scb->fd);
+  DCB state;
+
+  if (GetCommState (h, &state) == 0)
+    return -1;
+
+  switch (parity)
+    {
+    case GDBPARITY_NONE:
+      state.Parity = NOPARITY;
+      state.fParity = FALSE;
+      break;
+    case GDBPARITY_ODD:
+      state.Parity = ODDPARITY;
+      state.fParity = TRUE;
+      break;
+    case GDBPARITY_EVEN:
+      state.Parity = EVENPARITY;
+      state.fParity = TRUE;
+      break;
+    default:
+      return 1;
+    }
+
+  return (SetCommState (h, &state) != 0) ? 0 : -1;
+}
+
+static int
 ser_windows_setbaudrate (struct serial *scb, int rate)
 {
   HANDLE h = (HANDLE) _get_osfhandle (scb->fd);
@@ -1250,6 +1278,7 @@ _initialize_ser_windows (void)

   ops->go_raw = ser_windows_raw;
   ops->setbaudrate = ser_windows_setbaudrate;
+  ops->setparity = ser_windows_setparity;
   ops->setstopbits = ser_windows_setstopbits;
   ops->drain_output = ser_windows_drain_output;
   ops->readchar = ser_base_readchar;
@@ -1303,6 +1332,7 @@ _initialize_ser_windows (void)
   ops->print_tty_state = ser_base_print_tty_state;
   ops->noflush_set_tty_state = ser_base_noflush_set_tty_state;
   ops->setbaudrate = ser_base_setbaudrate;
+  ops->setparity = ser_base_setparity;
   ops->setstopbits = ser_base_setstopbits;
   ops->drain_output = ser_base_drain_output;
   ops->async = ser_base_async;
@@ -1338,6 +1368,7 @@ _initialize_ser_windows (void)
   ops->print_tty_state = ser_base_print_tty_state;
   ops->noflush_set_tty_state = ser_base_noflush_set_tty_state;
   ops->setbaudrate = ser_base_setbaudrate;
+  ops->setparity = ser_base_setparity;
   ops->setstopbits = ser_base_setstopbits;
   ops->drain_output = ser_base_drain_output;
   ops->async = ser_base_async;
diff -up ../../../gdb_old/gdb-7.6/gdb/ser-pipe.c gdb/ser-pipe.c
--- ../../../gdb_old/gdb-7.6/gdb/ser-pipe.c    2013-07-10
21:55:24.185807109 +0400
+++ gdb/ser-pipe.c    2013-07-10 20:58:32.921749511 +0400
@@ -233,6 +233,7 @@ _initialize_ser_pipe (void)
   ops->print_tty_state = ser_base_print_tty_state;
   ops->noflush_set_tty_state = ser_base_noflush_set_tty_state;
   ops->setbaudrate = ser_base_setbaudrate;
+  ops->setparity = ser_base_setparity;
   ops->setstopbits = ser_base_setstopbits;
   ops->drain_output = ser_base_drain_output;
   ops->async = ser_base_async;
diff -up ../../../gdb_old/gdb-7.6/gdb/ser-tcp.c gdb/ser-tcp.c
--- ../../../gdb_old/gdb-7.6/gdb/ser-tcp.c    2013-07-10
21:55:24.200748354 +0400
+++ gdb/ser-tcp.c    2013-07-05 00:33:53.026598227 +0400
@@ -396,6 +396,7 @@ _initialize_ser_tcp (void)
   ops->print_tty_state = ser_base_print_tty_state;
   ops->noflush_set_tty_state = ser_base_noflush_set_tty_state;
   ops->setbaudrate = ser_base_setbaudrate;
+  ops->setparity = ser_base_setparity;
   ops->setstopbits = ser_base_setstopbits;
   ops->drain_output = ser_base_drain_output;
   ops->async = ser_base_async;
diff -up ../../../gdb_old/gdb-7.6/gdb/ser-unix.c gdb/ser-unix.c
--- ../../../gdb_old/gdb-7.6/gdb/ser-unix.c    2013-07-10
21:55:24.229751815 +0400
+++ gdb/ser-unix.c    2013-07-16 16:05:07.242612139 +0400
@@ -99,6 +99,7 @@ static int hardwire_flush_output (struct
 static int hardwire_flush_input (struct serial *);
 static int hardwire_send_break (struct serial *);
 static int hardwire_setstopbits (struct serial *, int);
+static int hardwire_setparity (struct serial *, int);

 void _initialize_ser_hardwire (void);

@@ -893,6 +894,46 @@ hardwire_setstopbits (struct serial *scb
   return set_tty_state (scb, &state);
 }

+static int
+hardwire_setparity (struct serial *scb, int parity)
+{
+  struct hardwire_ttystate state;
+  int newparity = 0;
+
+  if (get_tty_state (scb, &state))
+    return -1;
+
+  switch (parity)
+    {
+    case GDBPARITY_NONE:
+      newparity = 0;
+      break;
+    case GDBPARITY_ODD:
+      newparity = PARENB | PARODD;
+      break;
+    case GDBPARITY_EVEN:
+      newparity = PARENB;
+      break;
+    default:
+      return 1;
+    }
+
+#ifdef HAVE_TERMIOS
+  state.termios.c_cflag |= newparity;
+#endif
+
+#ifdef HAVE_TERMIO
+  state.termio.c_cflag |= newparity;
+#endif
+
+#ifdef HAVE_SGTTY
+  return 0;            /* sgtty doesn't support this */
+#endif
+
+  return set_tty_state (scb, &state);
+}
+
+
 static void
 hardwire_close (struct serial *scb)
 {
@@ -929,6 +970,7 @@ _initialize_ser_hardwire (void)
   ops->print_tty_state = hardwire_print_tty_state;
   ops->noflush_set_tty_state = hardwire_noflush_set_tty_state;
   ops->setbaudrate = hardwire_setbaudrate;
+  ops->setparity = hardwire_setparity;
   ops->setstopbits = hardwire_setstopbits;
   ops->drain_output = hardwire_drain_output;
   ops->async = ser_base_async;
Common subdirectories: ../../../gdb_old/gdb-7.6/gdb/stubs and gdb/stubs
Common subdirectories: ../../../gdb_old/gdb-7.6/gdb/syscalls and gdb/syscalls
diff -up ../../../gdb_old/gdb-7.6/gdb/target.h gdb/target.h
--- ../../../gdb_old/gdb-7.6/gdb/target.h    2013-07-10 21:55:36.818749395 +0400
+++ gdb/target.h    2013-07-05 00:36:15.025597655 +0400
@@ -1961,6 +1961,10 @@ extern int remote_debug;

 /* Speed in bits per second, or -1 which means don't mess with the speed.  */
 extern int baud_rate;
+
+/* Parity for serial port */
+extern int serial_parity;
+
 /* Timeout limit for response from target.  */
 extern int remote_timeout;

Common subdirectories: ../../../gdb_old/gdb-7.6/gdb/testsuite and gdb/testsuite
diff -up ../../../gdb_old/gdb-7.6/gdb/top.c gdb/top.c
--- ../../../gdb_old/gdb-7.6/gdb/top.c    2013-07-10 21:55:32.033750880 +0400
+++ gdb/top.c    2013-07-10 20:55:06.711827223 +0400
@@ -159,6 +159,9 @@ int server_command;

 int baud_rate = -1;

+/* Parity for serial port */
+int serial_parity = GDBPARITY_NONE;
+
 /* Timeout limit for response from target.  */

 /* The default value has been changed many times over the years.  It
Common subdirectories: ../../../gdb_old/gdb-7.6/gdb/tui and gdb/tui



-- 
With best regards!
____________________________

Yurij Grechishhev
Bauman State Technical University,
Department of Computer Systems and Networks

^ permalink raw reply	[flat|nested] 44+ messages in thread

end of thread, other threads:[~2015-03-23 21:21 UTC | newest]

Thread overview: 44+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-10 15:18 Setting parity for remote serial Yurij Grechishhev
2013-07-10 18:10 ` Tom Tromey
2013-10-04 14:12   ` Pedro Alves
2013-10-07 18:33     ` Yurij Grechishhev
2013-10-08  3:56       ` Joel Brobecker
2013-10-08 12:03         ` Pedro Alves
2013-10-08 14:16           ` [RFA/code+NEWS] new "set/show serial baud" command (was: "Re: Setting parity for remote serial") Joel Brobecker
2013-10-08 14:34             ` [RFA/code+NEWS] new "set/show serial baud" command Pedro Alves
2013-10-08 15:00               ` Joel Brobecker
2013-10-08 15:12             ` Tom Tromey
2013-10-09 11:23               ` [RFA v2/code+DOCO+NEWS] " Joel Brobecker
2013-10-09 16:17                 ` Pedro Alves
2013-10-10  5:55                   ` checked in: " Joel Brobecker
2013-10-09 16:44                 ` Eli Zaretskii
2013-10-10  5:59                   ` Joel Brobecker
2013-10-10 16:06                     ` Eli Zaretskii
2013-10-11  4:51                       ` Joel Brobecker
2013-10-11  7:02                         ` Eli Zaretskii
2013-10-08 15:24             ` [RFA/code+NEWS] new "set/show serial baud" command (was: "Re: Setting parity for remote serial") Eli Zaretskii
2013-10-09  2:05             ` Doug Evans
2013-10-09  3:57               ` Joel Brobecker
2013-10-09  8:31                 ` [RFA/code+NEWS] new "set/show serial baud" command Pedro Alves
2013-07-24 14:29 Setting parity for remote serial Yurij Grechishhev
2013-07-24 16:53 ` Eli Zaretskii
2013-07-25  7:15   ` Yurij Grechishhev
2013-07-25 16:21     ` Eli Zaretskii
     [not found]       ` <CAAyhtXRJaoxvfm7FH06AXeATgscXn4SrY5=ZD_h=BBmPoUdTBQ@mail.gmail.com>
2013-07-29 18:34         ` Eli Zaretskii
2013-07-29 19:25           ` Pedro Alves
2013-07-29 20:14             ` Yurij Grechishhev
2013-07-29 19:04       ` Yurij Grechishhev
2013-09-26 17:00 ` Joel Brobecker
2013-10-02 21:59   ` Yurij Grechishhev
     [not found]   ` <CAAyhtXTmrJ04BVhziaFnogGyWLz7+G+Qwbc9UnHJkrEbDgTjFw@mail.gmail.com>
2013-10-04  7:34     ` Joel Brobecker
2013-10-09  4:11       ` Joel Brobecker
2015-02-25 15:16       ` Joel Brobecker
2015-02-26 19:50         ` Yurij Grechishhev
2015-02-27  8:16           ` Joel Brobecker
2015-03-15 21:49             ` Yurij Grechishhev
2015-03-16  3:32               ` Eli Zaretskii
2015-03-17 14:56               ` Joel Brobecker
2015-03-22 22:52                 ` Yurij Grechishhev
2015-03-23 13:11                   ` Joel Brobecker
2015-03-23 15:36                   ` Eli Zaretskii
2015-03-23 21:21                     ` Yurij Grechishhev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).