aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbserver/server.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/gdbserver/server.c')
-rw-r--r--gdb/gdbserver/server.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index 8099ef4..f8803d6 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -440,9 +440,16 @@ main (int argc, char *argv[])
restart:
setjmp (toplevel);
- while (getpkt (own_buf) > 0)
+ while (1)
{
unsigned char sig;
+ int packet_len;
+ int new_packet_len = -1;
+
+ packet_len = getpkt (own_buf);
+ if (packet_len <= 0)
+ break;
+
i = 0;
ch = own_buf[i++];
switch (ch)
@@ -547,6 +554,14 @@ main (int argc, char *argv[])
else
write_enn (own_buf);
break;
+ case 'X':
+ if (decode_X_packet (&own_buf[1], packet_len - 1,
+ &mem_addr, &len, mem_buf) < 0
+ || write_inferior_memory (mem_addr, mem_buf, len) != 0)
+ write_enn (own_buf);
+ else
+ write_ok (own_buf);
+ break;
case 'C':
convert_ascii_to_int (own_buf + 1, &sig, 1);
if (target_signal_to_host_p (sig))
@@ -714,7 +729,10 @@ main (int argc, char *argv[])
break;
}
- putpkt (own_buf);
+ if (new_packet_len != -1)
+ putpkt_binary (own_buf, new_packet_len);
+ else
+ putpkt (own_buf);
if (status == 'W')
fprintf (stderr,