unpush the remote target if serial_write fails.
authorPedro Alves <palves@redhat.com>
Tue, 2 Apr 2013 13:51:07 +0000 (13:51 +0000)
committerPedro Alves <palves@redhat.com>
Tue, 2 Apr 2013 13:51:07 +0000 (13:51 +0000)
commitc33e31fd4a0816e5820ecccd30aeb3f09b1104a8
tree119e87cba1307346fddec4fe8659733e6abbb41d
parentea5f3910af889b715ffb8e35cc56d1078ae7aef0
unpush the remote target if serial_write fails.

PR gdb/15275 notes that when debugging with a remote connection over a
serial link and the link is disconnected, say by disconnecting USB
serial port, the GDB quit command no longer works:

 (gdb)
 tar ext /dev/ttyACM0
 &"tar ext /dev/ttyACM0\n"
 ~"Remote debugging using /dev/ttyACM0\n"
 ^done
 (gdb)
 set debug remote 1
 &"set debug remote 1\n"
 ^done
 (gdb)
 quit
 &"quit\n"
 &"Sending packet: $qTStatus#49..."
 &"putpkt: write failed: Input/output error.\n"
 ^error,msg="putpkt: write failed: Input/output error."
 (gdb)
 (gdb)
 quit
 &"quit\n"
 &"Sending packet: $qTStatus#49..."
 &"putpkt: write failed: Input/output error.\n"
 ^error,msg="putpkt: write failed: Input/output error."

This is not reproducible with TCP connections, as with that, sending
doesn't error out, but instead the error is detected on the subsequent
readchar.  When that read fails, we unpush the remote target, and
throw TARGET_CLOSE_ERROR.  To address PR gdb/15275, instead of
catching the error in remote_get_trace_status as presently done (which
leaves this same issue latent for another packet to trip on), or of
making ser-unix.c fake success too on failed writes, so we'd get to
readchar detecting the error on serial ports too, better let the error
propagate out of serial_write, and catch it at the remote.c level,
throwing away the target if writing fails too, instead of delaying
that until the next read.

gdb/
2013-04-02  Pedro Alves  <palves@redhat.com>

PR gdb/15275

* remote.c (send_interrupt_sequence): Use remote_serial_write.
(remote_serial_write): New function.
(putpkt_binary, getpkt_or_notif_sane_1): Use remote_serial_write.
gdb/ChangeLog
gdb/remote.c
This page took 0.024228 seconds and 4 git commands to generate.