From 1c0bdccc74cdade4b3be11881333f4da8bf85f77 Mon Sep 17 00:00:00 2001 From: Daniel Beer Date: Mon, 22 Apr 2013 10:29:30 +1200 Subject: [PATCH] opdb: add option for setting default GDB port. --- mspdebug.man | 6 +++++- ui/gdb.c | 2 +- util/opdb.c | 9 +++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/mspdebug.man b/mspdebug.man index 6741e93..9256240 100644 --- a/mspdebug.man +++ b/mspdebug.man @@ -258,7 +258,8 @@ repeated without padding as many times as necessary without exceeding the bounds of the specified region. .IP "\fBgdb\fR [\fIport\fR]" 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 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 segment. If in doubt, do not enable this. Currently, the tilib and uif 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)" Automatically restart the GDB server after disconnection. If this option is set, then the GDB server keeps running until an error occurs, diff --git a/ui/gdb.c b/ui/gdb.c index 5a936a3..c500d83 100644 --- a/ui/gdb.c +++ b/ui/gdb.c @@ -536,7 +536,7 @@ static int gdb_server(int port) int cmd_gdb(char **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) { printc_err("gdb: can't parse port: %s\n", port_text); diff --git a/util/opdb.c b/util/opdb.c index 622727e..b535b34 100644 --- a/util/opdb.c +++ b/util/opdb.c @@ -94,6 +94,15 @@ static const struct opdb_key keys[] = { .help = "If set, some drivers will allow erase/program access to flash\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 + } } };