mirror of
https://github.com/intel/llvm.git
synced 2026-01-19 09:31:59 +08:00
[lldb] Tab completion for process load/unload
1. Complete `process load` with the common disk file completion, so there is not test provided for it; 2. Complete `process unload` with the tokens of valid loaded images. Thanks for Raphael's help on the test for `process unload`. Reviewed By: teemperor Differential Revision: https://reviews.llvm.org/D79887
This commit is contained in:
committed by
Raphael Isemann
parent
80e9dd0878
commit
e1cd7cac8a
@@ -923,6 +923,17 @@ public:
|
||||
|
||||
~CommandObjectProcessLoad() override = default;
|
||||
|
||||
void
|
||||
HandleArgumentCompletion(CompletionRequest &request,
|
||||
OptionElementVector &opt_element_vector) override {
|
||||
if (!m_exe_ctx.HasProcessScope())
|
||||
return;
|
||||
|
||||
CommandCompletions::InvokeCommonCompletionCallbacks(
|
||||
GetCommandInterpreter(), CommandCompletions::eDiskFileCompletion,
|
||||
request, nullptr);
|
||||
}
|
||||
|
||||
Options *GetOptions() override { return &m_options; }
|
||||
|
||||
protected:
|
||||
@@ -988,6 +999,24 @@ public:
|
||||
|
||||
~CommandObjectProcessUnload() override = default;
|
||||
|
||||
void
|
||||
HandleArgumentCompletion(CompletionRequest &request,
|
||||
OptionElementVector &opt_element_vector) override {
|
||||
|
||||
if (request.GetCursorIndex() || !m_exe_ctx.HasProcessScope())
|
||||
return;
|
||||
|
||||
Process *process = m_exe_ctx.GetProcessPtr();
|
||||
|
||||
const std::vector<lldb::addr_t> &tokens = process->GetImageTokens();
|
||||
const size_t token_num = tokens.size();
|
||||
for (size_t i = 0; i < token_num; ++i) {
|
||||
if (tokens[i] == LLDB_INVALID_IMAGE_TOKEN)
|
||||
continue;
|
||||
request.TryCompleteCurrentArg(std::to_string(i));
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
bool DoExecute(Args &command, CommandReturnObject &result) override {
|
||||
Process *process = m_exe_ctx.GetProcessPtr();
|
||||
|
||||
Reference in New Issue
Block a user