diff options
author | Tom Tromey <tromey@adacore.com> | 2023-09-06 08:33:46 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2023-11-27 12:55:14 -0700 |
commit | d69939bded50d76179f97284df35879a385cf8c0 (patch) | |
tree | 965bb45900e7a4442d3ce67e551d5cafe73e8691 /gdb/ser-tcp.c | |
parent | a2e0acea420cca881296c6fcf58920f3d7c05a45 (diff) | |
download | fsf-binutils-gdb-d69939bded50d76179f97284df35879a385cf8c0.zip fsf-binutils-gdb-d69939bded50d76179f97284df35879a385cf8c0.tar.gz fsf-binutils-gdb-d69939bded50d76179f97284df35879a385cf8c0.tar.bz2 |
Change serial_send_break and serial_write to throw
This changes serial_send_break and serial_write to throw exceptions
rather than attempt to set errno and return an error indicator. This
lets us correctly report failures on Windows.
Both functions had to be converted in a single patch because one
implementation of send_break works via write.
This also introduces remote_serial_send_break to handle error checking
when attempting to send a break. This was previously ignored.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30770
Diffstat (limited to 'gdb/ser-tcp.c')
-rw-r--r-- | gdb/ser-tcp.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/gdb/ser-tcp.c b/gdb/ser-tcp.c index 5e36840..ce3c618 100644 --- a/gdb/ser-tcp.c +++ b/gdb/ser-tcp.c @@ -419,14 +419,17 @@ net_write_prim (struct serial *scb, const void *buf, size_t count) UNIX systems it is generally "const void *". The cast to "const char *" is OK everywhere, since in C++ any data pointer type can be implicitly converted to "const void *". */ - return send (scb->fd, (const char *) buf, count, 0); + int result = send (scb->fd, (const char *) buf, count, 0); + if (result == -1 && errno != EINTR) + perror_with_name ("error while writing"); + return result; } -int +void ser_tcp_send_break (struct serial *scb) { /* Send telnet IAC and BREAK characters. */ - return (serial_write (scb, "\377\363", 2)); + serial_write (scb, "\377\363", 2); } #ifndef USE_WIN32API |