From b2b7dbb47aa9aff1252d4440bb9986df5a7e67cb Mon Sep 17 00:00:00 2001 From: Gongyu Deng Date: Tue, 11 Aug 2020 13:13:49 +0200 Subject: [lldb] stop-hook ID common completion for commands `target stop-hook enable/disable/delete' 1. Added a common completion StopHookIDs to provide completion with a list of stop hook ids; 2. Applied the common completion to commands: `target stop-hook delete/enable/disable'; 3. Added an related test case. Reviewed By: teemperor Differential Revision: https://reviews.llvm.org/D84123 --- lldb/source/Commands/CommandObjectTarget.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'lldb/source/Commands/CommandObjectTarget.cpp') diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index 927070f3d3ba..3cd4ad88afc7 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -4722,6 +4722,16 @@ public: ~CommandObjectTargetStopHookDelete() override = default; + void + HandleArgumentCompletion(CompletionRequest &request, + OptionElementVector &opt_element_vector) override { + if (request.GetCursorIndex()) + return; + CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), CommandCompletions::eStopHookIDCompletion, + request, nullptr); + } + protected: bool DoExecute(Args &command, CommandReturnObject &result) override { Target &target = GetSelectedOrDummyTarget(); @@ -4770,6 +4780,16 @@ public: ~CommandObjectTargetStopHookEnableDisable() override = default; + void + HandleArgumentCompletion(CompletionRequest &request, + OptionElementVector &opt_element_vector) override { + if (request.GetCursorIndex()) + return; + CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), CommandCompletions::eStopHookIDCompletion, + request, nullptr); + } + protected: bool DoExecute(Args &command, CommandReturnObject &result) override { Target &target = GetSelectedOrDummyTarget(); -- cgit v1.2.3