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-base.c | |
parent | a2e0acea420cca881296c6fcf58920f3d7c05a45 (diff) | |
download | binutils-d69939bded50d76179f97284df35879a385cf8c0.zip binutils-d69939bded50d76179f97284df35879a385cf8c0.tar.gz binutils-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-base.c')
-rw-r--r-- | gdb/ser-base.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/gdb/ser-base.c b/gdb/ser-base.c index 072211d..d83003e 100644 --- a/gdb/ser-base.c +++ b/gdb/ser-base.c @@ -471,7 +471,7 @@ ser_base_readchar (struct serial *scb, int timeout) return generic_readchar (scb, timeout, do_ser_base_readchar); } -int +void ser_base_write (struct serial *scb, const void *buf, size_t count) { const char *str = (const char *) buf; @@ -487,12 +487,11 @@ ser_base_write (struct serial *scb, const void *buf, size_t count) { if (errno == EINTR) continue; - return 1; + perror_with_name ("error while writing"); } count -= cc; str += cc; } - return 0; } int @@ -514,10 +513,9 @@ ser_base_flush_input (struct serial *scb) return SERIAL_ERROR; } -int +void ser_base_send_break (struct serial *scb) { - return 0; } int |