aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog9
-rw-r--r--gdb/remote.c26
2 files changed, 34 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 0061bff..7608ac1 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,12 @@
+2015-07-25 Kevin Buettner <kevinb@redhat.com>
+
+ * remote.c (read_ptid): Return null_ptid when no thread id
+ is found.
+ (remote_current_thread): Add log warning for malformed
+ qC reply.
+ (remote_start_remote): Add log warning when current thread
+ not found.
+
2015-07-24 Pedro Alves <palves@redhat.com>
* s390-linux-nat.c (fetch_regs, store_regs, fetch_fpregs)
diff --git a/gdb/remote.c b/gdb/remote.c
index 94899bd..69da508 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -2158,6 +2158,14 @@ read_ptid (char *buf, char **obuf)
/* No multi-process. Just a tid. */
pp = unpack_varlen_hex (p, &tid);
+ /* Return null_ptid when no thread id is found. */
+ if (p == pp)
+ {
+ if (obuf)
+ *obuf = pp;
+ return null_ptid;
+ }
+
/* Since the stub is not sending a process id, then default to
what's in inferior_ptid, unless it's null at this point. If so,
then since there's no way to know the pid of the reported
@@ -2750,7 +2758,17 @@ remote_current_thread (ptid_t oldpid)
putpkt ("qC");
getpkt (&rs->buf, &rs->buf_size, 0);
if (rs->buf[0] == 'Q' && rs->buf[1] == 'C')
- return read_ptid (&rs->buf[2], NULL);
+ {
+ char *obuf;
+ ptid_t result;
+
+ result = read_ptid (&rs->buf[2], &obuf);
+ if (*obuf != '\0' && remote_debug)
+ fprintf_unfiltered (gdb_stdlog,
+ "warning: garbage in qC reply\n");
+
+ return result;
+ }
else
return oldpid;
}
@@ -3701,6 +3719,12 @@ remote_start_remote (int from_tty, struct target_ops *target, int extended_p)
tell us which thread was current (no "thread"
register in T stop reply?). Just pick the first
thread in the thread list then. */
+
+ if (remote_debug)
+ fprintf_unfiltered (gdb_stdlog,
+ "warning: couldn't determine remote "
+ "current thread; picking first in list.\n");
+
inferior_ptid = thread_list->ptid;
}
}