diff options
author | Gongyu Deng <gy_deng@icloud.com> | 2020-08-11 11:12:11 +0200 |
---|---|---|
committer | Raphael Isemann <teemperor@gmail.com> | 2020-08-11 11:58:14 +0200 |
commit | 24bc8afd4baf703be7f4f4d70745d7680ceb54e2 (patch) | |
tree | 6ff8dedeae10dc9c189c44bad43765afbb7492d3 /lldb/source/Commands/CommandObjectTarget.cpp | |
parent | d6f710fd46dc87cb426859cc48877fc61ac37682 (diff) | |
download | llvm-24bc8afd4baf703be7f4f4d70745d7680ceb54e2.zip llvm-24bc8afd4baf703be7f4f4d70745d7680ceb54e2.tar.gz llvm-24bc8afd4baf703be7f4f4d70745d7680ceb54e2.tar.bz2 |
[lldb] tab completion for `target modules search-paths insert​`
Dedicated completion for the command `target modules search-paths insert​` with a test case.
Reviewed By: JDevlieghere
Differential Revision: https://reviews.llvm.org/D83309
Diffstat (limited to 'lldb/source/Commands/CommandObjectTarget.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectTarget.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index 84b7c98..927070f 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -1157,6 +1157,25 @@ public: ~CommandObjectTargetModulesSearchPathsInsert() override = default; + void + HandleArgumentCompletion(CompletionRequest &request, + OptionElementVector &opt_element_vector) override { + if (!m_exe_ctx.HasTargetScope() || request.GetCursorIndex() != 0) + return; + + Target *target = m_exe_ctx.GetTargetPtr(); + const PathMappingList &list = target->GetImageSearchPathList(); + const size_t num = list.GetSize(); + ConstString old_path, new_path; + for (size_t i = 0; i < num; ++i) { + if (!list.GetPathsAtIndex(i, old_path, new_path)) + break; + StreamString strm; + strm << old_path << " -> " << new_path; + request.TryCompleteCurrentArg(std::to_string(i), strm.GetString()); + } + } + protected: bool DoExecute(Args &command, CommandReturnObject &result) override { Target *target = &GetSelectedTarget(); |