Index: lldb/source/Commands/CommandObjectProcess.cpp =================================================================== --- lldb/source/Commands/CommandObjectProcess.cpp +++ lldb/source/Commands/CommandObjectProcess.cpp @@ -1034,6 +1034,48 @@ ~CommandObjectProcessSignal() override = default; + void + HandleArgumentCompletion(CompletionRequest &request, + OptionElementVector &opt_element_vector) override { + if (request.GetCursorIndex() != 0) + return; + + const std::map signals = { + {"SIGHUP", "hangup"}, + {"SIGINT", "interrupt"}, + {"SIGQUIT", "quit"}, + {"SIGILL", "illegal instruction"}, + {"SIGTRAP", "trace trap (not reset when caught)"}, + {"SIGABRT", "abort()"}, + {"SIGEMT", "pollable event"}, + {"SIGFPE", "floating point exception"}, + {"SIGKILL", "kill"}, + {"SIGBUS", "bus error"}, + {"SIGSEGV", "segmentation violation"}, + {"SIGSYS", "bad argument to system call"}, + {"SIGPIPE", "write on a pipe with no one to read it"}, + {"SIGALRM", "alarm clock"}, + {"SIGTERM", "software termination signal from kill"}, + {"SIGURG", "urgent condition on IO channel"}, + {"SIGSTOP", "sendable stop signal not from tty"}, + {"SIGTSTP", "stop signal from tty"}, + {"SIGCONT", "continue a stopped process"}, + {"SIGCHLD", "to parent on child stop or exit"}, + {"SIGTTIN", "to readers process group upon background tty read"}, + {"SIGTTOU", "to readers process group upon background tty write"}, + {"SIGIO", "input/output possible signal"}, + {"SIGXCPU", "exceeded CPU time limit"}, + {"SIGXFSZ", "exceeded file size limit"}, + {"SIGVTALRM", "virtual time alarm"}, + {"SIGPROF", "profiling time alarm"}, + {"SIGWINCH", "window size changes"}, + {"SIGINFO", "information request"}, + {"SIGUSR1", "user defined signal 1"}, + {"SIGUSR2", "user defined signal 2"}}; + for (const auto &i : signals) + request.TryCompleteCurrentArg(i.first, i.second); + } + protected: bool DoExecute(Args &command, CommandReturnObject &result) override { Process *process = m_exe_ctx.GetProcessPtr(); Index: lldb/test/API/functionalities/completion/TestCompletion.py =================================================================== --- lldb/test/API/functionalities/completion/TestCompletion.py +++ lldb/test/API/functionalities/completion/TestCompletion.py @@ -84,6 +84,13 @@ ['mips', 'arm64']) + def test_process_signal(self): + self.complete_from_to('process signal ', + 'process signal SIG') + self.complete_from_to('process signal SIGA', + ['SIGABRT', + 'SIGALRM']) + def test_ambiguous_long_opt(self): self.completions_match('breakpoint modify --th', ['--thread-id',