diff options
author | Pedro Alves <palves@redhat.com> | 2013-05-24 11:28:06 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2013-05-24 11:28:06 +0000 |
commit | 6740dc9c3e1fbc0f2ae2cb54feee654023db157d (patch) | |
tree | efed607693ec51e238eb675f4eb89fd0814ce0fd /gdb/gdbserver | |
parent | db1ac43683fc23c0e1a1b2bd5715114dde0380a0 (diff) | |
download | gdb-6740dc9c3e1fbc0f2ae2cb54feee654023db157d.zip gdb-6740dc9c3e1fbc0f2ae2cb54feee654023db157d.tar.gz gdb-6740dc9c3e1fbc0f2ae2cb54feee654023db157d.tar.bz2 |
[gdbserver] Don't assume vCont;r ADDR1,ADDR2 comes with a ptid attached.
This bit:
+ p1 = strchr (p, ':');
+ decode_address (&resume_info[i].step_range_end, p, p1 - p);
should not expect the ':' to be there. An action without a ptid is
valid:
"If an action is specified with no thread-id, then it is applied to any
threads that don't have a specific action specified"
This is handled further below:
if (p[0] == 0)
{
resume_info[i].thread = minus_one_ptid;
default_action = resume_info[i];
/* Note: we don't increment i here, we'll overwrite this entry
the next time through. */
}
else if (p[0] == ':')
A stub that doesn't support and report to gdb thread ids at all (like
metal metal targets) only will always only see a single default action
with no ptid.
Use unpack_varlen_hex instead of decode_address. The former doesn't
need to be told where the hex number ends, and it actually returns
that info instead, which we can use for validation.
Tested on x86_64 Fedora 17.
gdb/gdbserver/
2013-05-24 Pedro Alves <palves@redhat.com>
* server.c (handle_v_cont) <vCont;r>: Use unpack_varlen_hex
instead of strchr/decode_address. Error if the range isn't split
with a ','. Don't assume there's be a ':' in the action.
Diffstat (limited to 'gdb/gdbserver')
-rw-r--r-- | gdb/gdbserver/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/gdbserver/server.c | 15 |
2 files changed, 13 insertions, 8 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 0af0bb8..f050bfa 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,9 @@ +2013-05-24 Pedro Alves <palves@redhat.com> + + * server.c (handle_v_cont) <vCont;r>: Use unpack_varlen_hex + instead of strchr/decode_address. Error if the range isn't split + with a ','. Don't assume there's be a ':' in the action. + 2013-05-23 Yao Qi <yao@codesourcery.com> Pedro Alves <palves@redhat.com> diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c index 1083aa9..d9daf84 100644 --- a/gdb/gdbserver/server.c +++ b/gdb/gdbserver/server.c @@ -2069,17 +2069,16 @@ handle_v_cont (char *own_buf) } else if (p[0] == 'r') { - char *p1; + ULONGEST addr; - p = p + 1; - p1 = strchr (p, ','); - decode_address (&resume_info[i].step_range_start, p, p1 - p); + p = unpack_varlen_hex (p + 1, &addr); + resume_info[i].step_range_start = addr; - p = p1 + 1; - p1 = strchr (p, ':'); - decode_address (&resume_info[i].step_range_end, p, p1 - p); + if (*p != ',') + goto err; - p = p1; + p = unpack_varlen_hex (p + 1, &addr); + resume_info[i].step_range_end = addr; } else { |