diff options
-rw-r--r-- | gdb/gdbserver/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/gdbserver/remote-utils.c | 15 |
2 files changed, 19 insertions, 3 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index a95bce5..9414417 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,10 @@ +2014-12-29 Sergio Durigan Junior <sergiodj@redhat.com> + + * remote-utils.c: Include ctype.h. + (input_interrupt): Explicitly handle the case when the char + received is the NUL byte. Improve the printing of non-ASCII + characters. + 2014-12-16 Joel Brobecker <brobecker@adacore.com> * linux-low.c (linux_low_filter_event): Update call to diff --git a/gdb/gdbserver/remote-utils.c b/gdb/gdbserver/remote-utils.c index 373fc15..bc54518 100644 --- a/gdb/gdbserver/remote-utils.c +++ b/gdb/gdbserver/remote-utils.c @@ -23,6 +23,7 @@ #include "tdesc.h" #include "dll.h" #include "rsp-low.h" +#include <ctype.h> #if HAVE_SYS_IOCTL_H #include <sys/ioctl.h> #endif @@ -741,10 +742,18 @@ input_interrupt (int unused) cc = read_prim (&c, 1); - if (cc != 1 || c != '\003' || current_thread == NULL) + if (cc == 0) { - fprintf (stderr, "input_interrupt, count = %d c = %d ('%c')\n", - cc, c, c); + fprintf (stderr, "client connection closed\n"); + return; + } + else if (cc != 1 || c != '\003' || current_thread == NULL) + { + fprintf (stderr, "input_interrupt, count = %d c = %d ", cc, c); + if (isprint (c)) + fprintf (stderr, "('%c')\n", c); + else + fprintf (stderr, "('\\x%02x')\n", c & 0xff); return; } |