diff options
author | Gongyu Deng <gy_deng@icloud.com> | 2020-08-11 13:19:27 +0200 |
---|---|---|
committer | Raphael Isemann <teemperor@gmail.com> | 2020-08-11 13:27:13 +0200 |
commit | a952fe236f993b531eceb89e0a18d25bba048185 (patch) | |
tree | 6e4a5841a1939f4663bc360a65d72fd2af35122b /lldb/source/Commands/CommandObjectThread.cpp | |
parent | bd1013a4825bf2cf58b3c75320f64b24b244f343 (diff) | |
download | llvm-a952fe236f993b531eceb89e0a18d25bba048185.zip llvm-a952fe236f993b531eceb89e0a18d25bba048185.tar.gz llvm-a952fe236f993b531eceb89e0a18d25bba048185.tar.bz2 |
[lldb] thread index common completion for commands like `thread select/step-over`
1. Added a common completion completing with a list of the threads of the current process;
2. Apply the common completion above to these commands: thread
continue/info/exception/select/step-in/step-inst/step-inst-over/step-out/step-over/step-script​
3. Correlated test case test_common_completion_thread_index.
Reviewed By: teemperor
Differential Revision: https://reviews.llvm.org/D84088
Diffstat (limited to 'lldb/source/Commands/CommandObjectThread.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectThread.cpp | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/lldb/source/Commands/CommandObjectThread.cpp b/lldb/source/Commands/CommandObjectThread.cpp index c2fd86a..f039226 100644 --- a/lldb/source/Commands/CommandObjectThread.cpp +++ b/lldb/source/Commands/CommandObjectThread.cpp @@ -549,6 +549,17 @@ public: ~CommandObjectThreadStepWithTypeAndScope() override = default; + void + HandleArgumentCompletion(CompletionRequest &request, + OptionElementVector &opt_element_vector) override { + if (request.GetCursorIndex()) + return; + + CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), CommandCompletions::eThreadIndexCompletion, + request, nullptr); + } + Options *GetOptions() override { return &m_all_options; } protected: @@ -815,6 +826,14 @@ public: ~CommandObjectThreadContinue() override = default; + void + HandleArgumentCompletion(CompletionRequest &request, + OptionElementVector &opt_element_vector) override { + CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), CommandCompletions::eThreadIndexCompletion, + request, nullptr); + } + bool DoExecute(Args &command, CommandReturnObject &result) override { bool synchronous_execution = m_interpreter.GetSynchronous(); @@ -1307,6 +1326,17 @@ public: ~CommandObjectThreadSelect() override = default; + void + HandleArgumentCompletion(CompletionRequest &request, + OptionElementVector &opt_element_vector) override { + if (request.GetCursorIndex()) + return; + + CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), CommandCompletions::eThreadIndexCompletion, + request, nullptr); + } + protected: bool DoExecute(Args &command, CommandReturnObject &result) override { Process *process = m_exe_ctx.GetProcessPtr(); @@ -1438,6 +1468,14 @@ public: ~CommandObjectThreadInfo() override = default; + void + HandleArgumentCompletion(CompletionRequest &request, + OptionElementVector &opt_element_vector) override { + CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), CommandCompletions::eThreadIndexCompletion, + request, nullptr); + } + Options *GetOptions() override { return &m_options; } bool HandleOneThread(lldb::tid_t tid, CommandReturnObject &result) override { @@ -1482,6 +1520,14 @@ public: ~CommandObjectThreadException() override = default; + void + HandleArgumentCompletion(CompletionRequest &request, + OptionElementVector &opt_element_vector) override { + CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), CommandCompletions::eThreadIndexCompletion, + request, nullptr); + } + bool HandleOneThread(lldb::tid_t tid, CommandReturnObject &result) override { ThreadSP thread_sp = m_exe_ctx.GetProcessPtr()->GetThreadList().FindThreadByID(tid); |