diff options
author | Gongyu Deng <gy_deng@icloud.com> | 2020-08-11 12:20:43 +0200 |
---|---|---|
committer | Raphael Isemann <teemperor@gmail.com> | 2020-08-11 12:25:39 +0200 |
commit | 66fa73fa27991c2c12a4cc83143ed1f81874ded5 (patch) | |
tree | 6125dfbf339eafc4818bc8f95c5f3a9d804b8c86 /lldb/source/Commands/CommandCompletions.cpp | |
parent | ef0c0844fef6b1ee2497e64363fcacee2ff1b107 (diff) | |
download | llvm-66fa73fa27991c2c12a4cc83143ed1f81874ded5.zip llvm-66fa73fa27991c2c12a4cc83143ed1f81874ded5.tar.gz llvm-66fa73fa27991c2c12a4cc83143ed1f81874ded5.tar.bz2 |
[lldb] move the frame index completion into a common completion and apply it to `thread backtrace -s`
Commands frame select and thread backtrace -s can be completed in the same way.
Moved the dedicated completion of frame select into a common completion and
apply it to the both commands, along with the test modified.
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 795aabd..25f684a 100644 --- a/lldb/source/Commands/CommandCompletions.cpp +++ b/lldb/source/Commands/CommandCompletions.cpp @@ -20,6 +20,7 @@ #include "lldb/Symbol/Variable.h" #include "lldb/Target/Language.h" #include "lldb/Target/RegisterContext.h" +#include "lldb/Target/Thread.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/StreamString.h" #include "lldb/Utility/TildeExpressionResolver.h" @@ -62,6 +63,7 @@ bool CommandCompletions::InvokeCommonCompletionCallbacks( {eProcessPluginCompletion, CommandCompletions::ProcessPluginNames}, {eDisassemblyFlavorCompletion, CommandCompletions::DisassemblyFlavors}, {eTypeLanguageCompletion, CommandCompletions::TypeLanguages}, + {eFrameIndexCompletion, CommandCompletions::FrameIndexes}, {eNoCompletion, nullptr} // This one has to be last in the list. }; @@ -618,3 +620,20 @@ void CommandCompletions::TypeLanguages(CommandInterpreter &interpreter, Language::GetNameForLanguageType(static_cast<lldb::LanguageType>(bit))); } } + +void CommandCompletions::FrameIndexes(CommandInterpreter &interpreter, + CompletionRequest &request, + SearchFilter *searcher) { + const ExecutionContext &exe_ctx = interpreter.GetExecutionContext(); + if (!exe_ctx.HasProcessScope()) + return; + + lldb::ThreadSP thread_sp = exe_ctx.GetThreadSP(); + const uint32_t frame_num = thread_sp->GetStackFrameCount(); + for (uint32_t i = 0; i < frame_num; ++i) { + lldb::StackFrameSP frame_sp = thread_sp->GetStackFrameAtIndex(i); + StreamString strm; + frame_sp->Dump(&strm, false, true); + request.TryCompleteCurrentArg(std::to_string(i), strm.GetString()); + } +} |