Added "gdb_loop" option.

This commit is contained in:
Daniel Beer 2010-06-15 14:51:12 +12:00
parent efabaf5161
commit ccc5df8fd9
2 changed files with 25 additions and 1 deletions

22
gdb.c
View File

@ -666,6 +666,9 @@ static int cmd_gdb(cproc_t cp, char **arg)
{
char *port_text = get_arg(arg);
int port = 2000;
int want_loop = 0;
cproc_get_int(cp, "gdb_loop", &want_loop);
if (port_text)
port = atoi(port_text);
@ -675,7 +678,12 @@ static int cmd_gdb(cproc_t cp, char **arg)
return -1;
}
return gdb_server(cproc_device(cp), port);
do {
if (gdb_server(cproc_device(cp), port) < 0)
return -1;
} while (want_loop);
return 0;
}
static const struct cproc_command command_gdb = {
@ -686,7 +694,19 @@ static const struct cproc_command command_gdb = {
" Run a GDB remote stub on the given TCP/IP port.\n"
};
static const struct cproc_option option_gdb = {
.name = "gdb_loop",
.type = CPROC_OPTION_BOOL,
.help =
"Automatically restart the GDB server after disconnection. If this\n"
"option is set, then the GDB server keeps running until an error occurs,\n"
"or the user interrupts with Ctrl+C.\n"
};
int gdb_register(cproc_t cp)
{
if (cproc_register_options(cp, &option_gdb, 1) < 0)
return -1;
return cproc_register_commands(cp, &command_gdb, 1);
}

View File

@ -349,6 +349,10 @@ The following are all valid examples of address expressions:
MSPDebug's behaviour can be configured via the following variables:
.IP "\fBcolor\fR (boolean)"
If true, MSPDebug will colorize debugging output.
.IP "\fBgdb_loop\fR (boolean)"
Automatically restart the GDB server after disconnection. If this
option is set, then the GDB server keeps running until an error occurs,
or the user interrupts with Ctrl+C.
.SH BUGS
If you find any bugs, you should report them to the author at
daniel@tortek.co.nz. It would help if you could include a transcript