remote.c: simplify parsing stop reasons in T stop replies
We need to be careful with parsing optional stop reasons that start
with an hex character ("awatch", "core"), as GDBs that aren't aware of
them parse them as real numbers. That's silly of course, given that
there should be a colon after those magic "numbers". So if strtol on
"abbz:" doesn't return "first invalid char" pointing to the colon, we
know that "abbz" isn't really a register number. It must be optional
stop info we don't know about. This adjusts GDB to work that way,
removing the need for the special casing done upfront:
/* If this packet is an awatch packet, don't parse the 'a'
as a register number. */
if (strncmp (p, "awatch", strlen("awatch")) != 0
&& strncmp (p, "core", strlen ("core") != 0))
For as long as we care about compatibility with GDB 7.9, we'll need to
continue to be careful about this, so I added a comment.
Tested on x86_64 Fedora 20, native gdbserver.
gdb/ChangeLog:
2015-02-23 Pedro Alves <palves@redhat.com>
* remote.c (skip_to_semicolon): New function.
(remote_parse_stop_reply) <T stop reply>: Use it. Don't
special case the stop reasons that look like hex numbers
upfront. Instead handle real register numbers after matching
all the known stop reasons.