opdb: add option for setting default GDB port.

This commit is contained in:
Daniel Beer 2013-04-22 10:29:30 +12:00
parent a0499ab6f0
commit 1c0bdccc74
3 changed files with 15 additions and 2 deletions

View File

@ -258,7 +258,8 @@ repeated without padding as many times as necessary without exceeding the
bounds of the specified region. bounds of the specified region.
.IP "\fBgdb\fR [\fIport\fR]" .IP "\fBgdb\fR [\fIport\fR]"
Start a GDB remote stub, optionally specifying a TCP port to listen on. Start a GDB remote stub, optionally specifying a TCP port to listen on.
If no port is given, the default port is 2000. If no port is given, the default port is controlled by the option
\fBgdb_default_port\fR.
MSPDebug will wait for a connection on this port, and then act as a MSPDebug will wait for a connection on this port, and then act as a
GDB remote stub until GDB disconnects. GDB remote stub until GDB disconnects.
@ -715,6 +716,9 @@ BSL memory. If in doubt, do not enable this.
If set, some drivers will allow erase/program access to the info A If set, some drivers will allow erase/program access to the info A
segment. If in doubt, do not enable this. Currently, the tilib and uif segment. If in doubt, do not enable this. Currently, the tilib and uif
drivers are affected by this option. drivers are affected by this option.
.IP "\fBgdb_default_port\fR (numeric)"
This option controls the default TCP port for the GDB server, if no
argument is given to the "\fBgdb\fR" command.
.IP "\fBgdb_loop\fR (boolean)" .IP "\fBgdb_loop\fR (boolean)"
Automatically restart the GDB server after disconnection. If this Automatically restart the GDB server after disconnection. If this
option is set, then the GDB server keeps running until an error occurs, option is set, then the GDB server keeps running until an error occurs,

View File

@ -536,7 +536,7 @@ static int gdb_server(int port)
int cmd_gdb(char **arg) int cmd_gdb(char **arg)
{ {
char *port_text = get_arg(arg); char *port_text = get_arg(arg);
address_t port = 2000; address_t port = opdb_get_numeric("gdb_default_port");
if (port_text && expr_eval(port_text, &port) < 0) { if (port_text && expr_eval(port_text, &port) < 0) {
printc_err("gdb: can't parse port: %s\n", port_text); printc_err("gdb: can't parse port: %s\n", port_text);

View File

@ -94,6 +94,15 @@ static const struct opdb_key keys[] = {
.help = .help =
"If set, some drivers will allow erase/program access to flash\n" "If set, some drivers will allow erase/program access to flash\n"
"BSL memory. If in doubt, do not enable this.\n" "BSL memory. If in doubt, do not enable this.\n"
},
{
.name = "gdb_default_port",
.type = OPDB_TYPE_NUMERIC,
.help =
"Default TCP port for GDB server, if no argument is given.\n",
.defval = {
.numeric = 2000
}
} }
}; };