main: fix handling of -g option if feature is disabled
Without this patch building the agent with:
make CFLAGS=-DENABLE_GdbRemoteSerialProtocol=0
And running it with:
./agent -g2000
would silently swollow the option and continue with the default
behaviour, leaving the user with the impression of a running
gdb-rsp server - which is not the case. In addition the option
-g should not show up in the usage string.
This patch fixes both, remove the option from the usage and bail out
with an error if -g is specified but ENABLE_GdbRemoteSerial is zero.
Change-Id: I9a1f0396e7e8c2c2844cc89bdde8ff03cbbf337d
Signed-off-by: Sanimir Agovic <sanimir@subpath.org>
diff --git a/agent/tcf/main/main.c b/agent/tcf/main/main.c
index 51c84e8..7d765c9 100644
--- a/agent/tcf/main/main.c
+++ b/agent/tcf/main/main.c
@@ -220,7 +220,7 @@
#endif
" -s<url> set agent listening port and protocol, default is " DEFAULT_SERVER_URL,
" -S print server properties in Json format to stdout",
-#if ENABLE_DebugContext
+#if ENABLE_GdbRemoteSerialProtocol
" -g<port> start GDB Remote Serial Protocol server at the specified TCP port",
#endif
" -I<idle-seconds> exit if there are no connections for the specified time",
@@ -346,7 +346,9 @@
#endif
case 'L':
case 's':
+#if ENABLE_GdbRemoteSerialProtocol
case 'g':
+#endif
#if ENABLE_Plugins
case 'P':
#endif