Add -h|--help.
authorJan Kratochvil <jan.kratochvil@redhat.com>
Sat, 7 Sep 2019 20:12:35 +0000 (22:12 +0200)
committerJan Kratochvil <jan.kratochvil@redhat.com>
Sat, 7 Sep 2019 20:12:35 +0000 (22:12 +0200)
src/LLGDBMain.cpp

index 506fe50..08f852e 100644 (file)
@@ -420,10 +420,44 @@ int main(int argc, char **argv) {
        arg = argv[argi];
        opt_args.push_back(std::move(arg));
       }
-    } else if (arg == "-p" || arg == "--pid") {
+    } else if ((arg == "-e" || arg == "--exec") && argv[argi+1])
+      opt_exec = argv[++argi];
+    else if ((arg == "-p" || arg == "--pid") && argv[argi+1]) {
       opt_pid = str_to_pid(argv[++argi]);
       if (opt_pid == 0)
        error(1,0,"Invalid PID: %s",argv[argi]);
+    } else if ((arg == "-c" || arg == "--core") && argv[argi+1])
+      opt_core = argv[++argi];
+    else if (arg == "-h"||arg=="--help") {
+      puts("\
+This is the GNU debugger emulation by LLDB.  Usage:\n\
+\n\
+    llgdb [options] [executable-file [core-file or process-id]]\n\
+    llgdb [options] --args executable-file [inferior-arguments ...]\n\
+\n\
+Selection of debuggee and its files:\n\
+\n\
+  --args             Arguments after executable-file are passed to inferior\n\
+  --core=COREFILE    Analyze the core dump COREFILE.\n\
+  --exec=EXECFILE    Use EXECFILE as the executable.\n\
+  --pid=PID          Attach to running process PID.\n\
+\n\
+Initial commands and command files:\n\
+\n\
+  -ex COMMAND\n\
+                     Execute a single GDB command.\n\
+                     May be used multiple times and in conjunction\n\
+                     with --command.\n\
+  -iex COMMAND\n\
+                     Like -ex but before loading inferior.\n\
+\n\
+Operating modes:\n\
+\n\
+  --help             Print this message and then exit.\n\
+\n\
+Report bugs to jan.kratochvil -at- redhat.com.\n\
+");
+      exit(1);
     } else if (!opt_exec)
       opt_exec=std::move(arg);
     else if (!opt_pid && str_to_pid(arg) > 0)