From 2824fefdfb08c63720eea88440e6c89aff9eaaca Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Sat, 7 Sep 2019 22:12:35 +0200 Subject: [PATCH] Add -h|--help. --- src/LLGDBMain.cpp | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/src/LLGDBMain.cpp b/src/LLGDBMain.cpp index 506fe50..08f852e 100644 --- a/src/LLGDBMain.cpp +++ b/src/LLGDBMain.cpp @@ -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) -- 1.8.3.1