diff options
author | Gongyu Deng <gy_deng@icloud.com> | 2020-08-11 12:29:25 +0200 |
---|---|---|
committer | Raphael Isemann <teemperor@gmail.com> | 2020-08-11 12:35:36 +0200 |
commit | 419f1be7b54ef2c285050c24e4b4c333cb108cfc (patch) | |
tree | 9d3d61f7681ace29da9beea7300be45a0ae4f142 /lldb/source/Commands/CommandCompletions.cpp | |
parent | d542feb8e49bd3d43363724531c8f65b82d9759f (diff) | |
download | llvm-419f1be7b54ef2c285050c24e4b4c333cb108cfc.zip llvm-419f1be7b54ef2c285050c24e4b4c333cb108cfc.tar.gz llvm-419f1be7b54ef2c285050c24e4b4c333cb108cfc.tar.bz2 |
[lldb] tab completion for `target modules load -u`
1. Added a common completion ModuleUUIDs to provide a list of the UUIDs of modules for completion;
2. Added a new enumeration item eArgTypeModuleUUID to CommandArgumentType which is set as the option argument type of OptionGroupUUID;
3. Applied the module UUID completion to the argument of the type eArgTypeModuleUUID in lldb/source/Interpreter/CommandObject.cpp;
4. Added an related test case in lldb/test/API/functionalities/completion/TestCompletion.py.
Diffstat (limited to 'lldb/source/Commands/CommandCompletions.cpp')
-rw-r--r-- | lldb/source/Commands/CommandCompletions.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lldb/source/Commands/CommandCompletions.cpp b/lldb/source/Commands/CommandCompletions.cpp index 25f684a..590a0d2 100644 --- a/lldb/source/Commands/CommandCompletions.cpp +++ b/lldb/source/Commands/CommandCompletions.cpp @@ -54,6 +54,7 @@ bool CommandCompletions::InvokeCommonCompletionCallbacks( {eDiskDirectoryCompletion, CommandCompletions::DiskDirectories}, {eSymbolCompletion, CommandCompletions::Symbols}, {eModuleCompletion, CommandCompletions::Modules}, + {eModuleUUIDCompletion, CommandCompletions::ModuleUUIDs}, {eSettingsNameCompletion, CommandCompletions::SettingsNames}, {ePlatformPluginCompletion, CommandCompletions::PlatformPluginNames}, {eArchitectureCompletion, CommandCompletions::ArchitectureNames}, @@ -491,6 +492,24 @@ void CommandCompletions::Modules(CommandInterpreter &interpreter, } } +void CommandCompletions::ModuleUUIDs(CommandInterpreter &interpreter, + CompletionRequest &request, + SearchFilter *searcher) { + const ExecutionContext &exe_ctx = interpreter.GetExecutionContext(); + if (!exe_ctx.HasTargetScope()) + return; + + exe_ctx.GetTargetPtr()->GetImages().ForEach( + [&request](const lldb::ModuleSP &module) { + StreamString strm; + module->GetDescription(strm.AsRawOstream(), + lldb::eDescriptionLevelInitial); + request.TryCompleteCurrentArg(module->GetUUID().GetAsString(), + strm.GetString()); + return true; + }); +} + void CommandCompletions::Symbols(CommandInterpreter &interpreter, CompletionRequest &request, SearchFilter *searcher) { |