Inform gdb of the maximum packet size.

Reply to gdb's 'qSupported' query. Tell it that we can receive packets
up to MAX_MEM_XFER * 2 bytes long. This significantly speeds up
programming a device from gdb.
This commit is contained in:
Robert Spanton 2010-08-16 11:13:39 +12:00 committed by Daniel Beer
parent 1b5c1098f5
commit 30c3d8e6f1
2 changed files with 11 additions and 0 deletions

View File

@ -28,3 +28,4 @@ Andres Vahter <andres.vahter@gmail.com>:
Robert Spanton <rspanton@zepler.net>:
* Support for FET430UIF bootloader programming.
* GDB protocol improvements.

10
gdb.c
View File

@ -495,6 +495,14 @@ static int set_breakpoint(struct gdb_data *data, int enable, char *buf)
return gdb_send(data, "OK");
}
static int gdb_send_supported(struct gdb_data *data)
{
gdb_packet_start(data);
gdb_printf(data, "PacketSize=%x", MAX_MEM_XFER * 2);
gdb_packet_end(data);
return gdb_flush_ack(data);
}
static int process_gdb_command(struct gdb_data *data, char *buf, int len)
{
switch (buf[0]) {
@ -514,6 +522,8 @@ static int process_gdb_command(struct gdb_data *data, char *buf, int len)
case 'q': /* Query */
if (!strncmp(buf, "qRcmd,", 6))
return monitor_command(data, buf + 6);
if (!strncmp(buf, "qSupported", 10))
return gdb_send_supported(data);
break;
case 'm': /* Read memory */