From 4d16ac64d53c78775069e5da706b32fbe44a3085 Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Tue, 16 Jun 2015 16:56:32 +0200 Subject: dev2: make GDB server port configurable --- src/platforms/dev2/platform.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/platforms/dev2/platform.c') diff --git a/src/platforms/dev2/platform.c b/src/platforms/dev2/platform.c index a62c49e..d55a4f3 100644 --- a/src/platforms/dev2/platform.c +++ b/src/platforms/dev2/platform.c @@ -31,6 +31,8 @@ #include #include +extern int gdb_if_port; + static int serial_fd = -1; static int debug; @@ -72,7 +74,7 @@ void platform_init(int argc, char **argv) int c; char *serial = NULL; - while((c = getopt(argc, argv, "ds:")) != -1) { + while((c = getopt(argc, argv, "ds:p:")) != -1) { switch(c) { case 'd': debug = 1; @@ -80,12 +82,24 @@ void platform_init(int argc, char **argv) case 's': serial = optarg; break; + case 'p': + { + char *tailptr; + gdb_if_port = strtol (optarg, &tailptr, 10); + if (*tailptr) + gdb_if_port = 0; + } + break; } } if(optind != argc) { fprintf(stderr, "too many arguments\n"); abort(); } + if(gdb_if_port == 0) { + fprintf(stderr, "bad server port\n"); + abort(); + } serial_fd = serial_open(serial); if(serial_fd == -1) { -- cgit v1.2.3