[PATCH 0/6] Fix error messages from serial code

Tom Tromey tromey@adacore.com
Tue Sep 12 16:27:47 GMT 2023


Internal AdaCore testing on a Windows host with a target running on
qemu revealed that remote.c could sometimes display random error
messages.  For example, different runs of the same test might display:

    Remote communication error.  Target disconnected.: Arg list too long.
    Remote communication error.  Target disconnected.: No error.
    Remote communication error.  Target disconnected.: Not a directory.

I looked into this and this series is the result.  It's hard to be
sure that this completely solves the problem -- there are a lot of
code paths and the errors aren't very reproducible -- but it helps.

Regression tested using native-extended-gdbserver on x86-64 Fedora 36.

---
Tom Tromey (6):
      Fix latent bug in ser_windows_send_break
      Introduce throw_winerror_with_name
      Change serial_setbaudrate to throw exception
      Change serial "open" functions to throw exception
      Change serial_send_break and serial_write to throw
      Change serial_readchar to throw

 gdb/nat/windows-nat.c  |   6 +--
 gdb/remote.c           | 106 +++++++++++++++++++++++++++----------------------
 gdb/ser-base.c         |  12 +++---
 gdb/ser-base.h         |   6 +--
 gdb/ser-event.c        |   4 +-
 gdb/ser-mingw.c        |  86 ++++++++++++++++++---------------------
 gdb/ser-pipe.c         |  12 +++---
 gdb/ser-tcp.c          |  93 ++++++++++++++++++++++++-------------------
 gdb/ser-tcp.h          |   4 +-
 gdb/ser-uds.c          |  36 ++++++++---------
 gdb/ser-unix.c         |  57 ++++++++++++--------------
 gdb/serial.c           |  44 ++++++++------------
 gdb/serial.h           |  22 +++++-----
 gdb/windows-nat.c      |  31 +++++++++------
 gdbserver/win32-low.cc |  11 +++--
 gdbsupport/errors.cc   |   8 ++++
 gdbsupport/errors.h    |   7 ++++
 17 files changed, 279 insertions(+), 266 deletions(-)
---
base-commit: d1722abe60ca7c330210aa97c8ec52ff98644206
change-id: 20230912-serial-exceptions-07104644e711

Best regards,
-- 
Tom Tromey <tromey@adacore.com>



More information about the Gdb-patches mailing list