Fix to close gdb client.

GDB reader now understands the "k" command.
This commit is contained in:
Peter Jansen 2011-03-21 11:21:40 +13:00 committed by Daniel Beer
parent 0330823f9c
commit 77af9739ce
1 changed files with 16 additions and 0 deletions

16
gdb.c
View File

@ -531,6 +531,9 @@ static int gdb_send_supported(struct gdb_data *data)
static int process_gdb_command(struct gdb_data *data, char *buf, int len)
{
#ifdef DEBUG_GDB
printc("process_gdb_command: %s\n", buf);
#endif
switch (buf[0]) {
case '?': /* Return target halt reason */
return run_final_status(data);
@ -563,8 +566,14 @@ static int process_gdb_command(struct gdb_data *data, char *buf, int len)
case 's': /* Single step */
return single_step(data, buf + 1);
case 'k': /* kill */
return -1;
}
#ifdef DEBUG_GDB
printc("process_gdb_command: unknown command %s\n", buf);
#endif
/* For unknown/unsupported packets, return an empty reply */
return gdb_send(data, "");
}
@ -693,7 +702,14 @@ static int gdb_server(int port)
for (i = 0; i < device_default->max_breakpoints; i++)
device_setbrk(device_default, i, 0, 0);
#ifdef DEBUG_GDB
printc("starting GDB reader loop...\n");
#endif
gdb_reader_loop(&data);
#ifdef DEBUG_GDB
printc("... reader loop returned\n");
#endif
close(client);
return data.error ? -1 : 0;
}