mdebug

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit ed31c687145f67db2812ba4209d3cf31d6ac6ccc
parent e9c16becb9194b91b806518f90a0a37905117cdf
Author: Brian Swetland <swetland@frotz.net>
Date:   Sun, 21 Jun 2015 20:48:17 -0700

gdb-bridge: support no-ack mode (wow, that speeds stuff up)

Diffstat:
Mtools/gdb-bridge.c | 30++++++++++++++++++++++--------
1 file changed, 22 insertions(+), 8 deletions(-)

diff --git a/tools/gdb-bridge.c b/tools/gdb-bridge.c @@ -243,10 +243,7 @@ static const char *target_xml = "</feature>" "</target>"; -void handle_ext_command(struct gdbcnxn *gc, char *cmd, char *args) { - if (gc->flags & F_TRACE) { - zprintf("EXT: <%s> <%s>\n", cmd, args); - } +static void handle_query(struct gdbcnxn *gc, char *cmd, char *args) { if (!strcmp(cmd,"Rcmd")) { char *p = args; cmd = p; @@ -259,6 +256,7 @@ void handle_ext_command(struct gdbcnxn *gc, char *cmd, char *args) { } else if(!strcmp(cmd, "Supported")) { gdb_puts(gc, "qXfer:features:read+" + ";QStartNoAckMode+" ";PacketSize=2000" ); } else if(!strcmp(cmd, "Xfer")) { @@ -268,7 +266,16 @@ void handle_ext_command(struct gdbcnxn *gc, char *cmd, char *args) { gdb_puts(gc, target_xml); } } else { - zprintf("GDB: unknown command: q%s:%s\n", cmd, args); + zprintf("GDB: unsupported: q%s:%s\n", cmd, args); + } +} + +static void handle_set(struct gdbcnxn *gc, char *cmd, char *args) { + if(!strcmp(cmd, "StartNoAckMode")) { + gc->flags &= ~F_ACK; + gdb_puts(gc, "OK"); + } else { + zprintf("GDB: unsupported: Q%s:%s\n", cmd, args); } } @@ -322,8 +329,9 @@ void handle_command(struct gdbcnxn *gc, unsigned char *cmd) { swdp_core_step(); gdb_puts(gc, "S00"); break; - case 'q': { - char *args = (char*) ++cmd; + case 'q': + case 'Q': { + char *args = (char*) (cmd + 1); while (*args) { if ((*args == ':') || (*args == ',')) { *args++ = 0; @@ -331,7 +339,11 @@ void handle_command(struct gdbcnxn *gc, unsigned char *cmd) { } args++; } - handle_ext_command(gc, (char*) cmd, args); + if (cmd[0] == 'q') { + handle_query(gc, (char*) (cmd + 1), args); + } else { + handle_set(gc, (char*) (cmd + 1), args); + } break; } @@ -349,6 +361,8 @@ void gdb_server(int fd) { gdb_init(&gc, fd); + gc.flags |= F_TRACE; + for (;;) { r = read(fd, iobuf, sizeof(iobuf)); if (r < 0) {