aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/lldb/source/Commands/CommandObjectFrame.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/lldb/source/Commands/CommandObjectFrame.cpp')
-rw-r--r--contrib/llvm-project/lldb/source/Commands/CommandObjectFrame.cpp45
1 files changed, 27 insertions, 18 deletions
diff --git a/contrib/llvm-project/lldb/source/Commands/CommandObjectFrame.cpp b/contrib/llvm-project/lldb/source/Commands/CommandObjectFrame.cpp
index 6ebad9b5c488..a656a99a1c71 100644
--- a/contrib/llvm-project/lldb/source/Commands/CommandObjectFrame.cpp
+++ b/contrib/llvm-project/lldb/source/Commands/CommandObjectFrame.cpp
@@ -291,17 +291,12 @@ public:
void
HandleArgumentCompletion(CompletionRequest &request,
OptionElementVector &opt_element_vector) override {
- if (!m_exe_ctx.HasProcessScope() || request.GetCursorIndex() != 0)
+ if (request.GetCursorIndex() != 0)
return;
- lldb::ThreadSP thread_sp = m_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());
- }
+ CommandCompletions::InvokeCommonCompletionCallbacks(
+ GetCommandInterpreter(), CommandCompletions::eFrameIndexCompletion,
+ request, nullptr);
}
Options *GetOptions() override { return &m_options; }
@@ -898,12 +893,14 @@ bool CommandObjectFrameRecognizerAdd::DoExecute(Args &command,
RegularExpressionSP(new RegularExpression(m_options.m_module));
auto func =
RegularExpressionSP(new RegularExpression(m_options.m_symbols.front()));
- StackFrameRecognizerManager::AddRecognizer(recognizer_sp, module, func);
+ GetSelectedOrDummyTarget().GetFrameRecognizerManager().AddRecognizer(
+ recognizer_sp, module, func);
} else {
auto module = ConstString(m_options.m_module);
std::vector<ConstString> symbols(m_options.m_symbols.begin(),
m_options.m_symbols.end());
- StackFrameRecognizerManager::AddRecognizer(recognizer_sp, module, symbols);
+ GetSelectedOrDummyTarget().GetFrameRecognizerManager().AddRecognizer(
+ recognizer_sp, module, symbols);
}
#endif
@@ -921,7 +918,9 @@ public:
protected:
bool DoExecute(Args &command, CommandReturnObject &result) override {
- StackFrameRecognizerManager::RemoveAllRecognizers();
+ GetSelectedOrDummyTarget()
+ .GetFrameRecognizerManager()
+ .RemoveAllRecognizers();
result.SetStatus(eReturnStatusSuccessFinishResult);
return result.Succeeded();
}
@@ -941,7 +940,7 @@ public:
if (request.GetCursorIndex() != 0)
return;
- StackFrameRecognizerManager::ForEach(
+ GetSelectedOrDummyTarget().GetFrameRecognizerManager().ForEach(
[&request](uint32_t rid, std::string rname, std::string module,
llvm::ArrayRef<lldb_private::ConstString> symbols,
bool regexp) {
@@ -973,7 +972,9 @@ protected:
return false;
}
- StackFrameRecognizerManager::RemoveAllRecognizers();
+ GetSelectedOrDummyTarget()
+ .GetFrameRecognizerManager()
+ .RemoveAllRecognizers();
result.SetStatus(eReturnStatusSuccessFinishResult);
return result.Succeeded();
}
@@ -993,7 +994,14 @@ protected:
return false;
}
- StackFrameRecognizerManager::RemoveRecognizerWithID(recognizer_id);
+ if (!GetSelectedOrDummyTarget()
+ .GetFrameRecognizerManager()
+ .RemoveRecognizerWithID(recognizer_id)) {
+ result.AppendErrorWithFormat("'%s' is not a valid recognizer id.\n",
+ command.GetArgumentAtIndex(0));
+ result.SetStatus(eReturnStatusFailed);
+ return false;
+ }
result.SetStatus(eReturnStatusSuccessFinishResult);
return result.Succeeded();
}
@@ -1011,7 +1019,7 @@ public:
protected:
bool DoExecute(Args &command, CommandReturnObject &result) override {
bool any_printed = false;
- StackFrameRecognizerManager::ForEach(
+ GetSelectedOrDummyTarget().GetFrameRecognizerManager().ForEach(
[&result, &any_printed](
uint32_t recognizer_id, std::string name, std::string module,
llvm::ArrayRef<ConstString> symbols, bool regexp) {
@@ -1106,8 +1114,9 @@ protected:
return false;
}
- auto recognizer =
- StackFrameRecognizerManager::GetRecognizerForFrame(frame_sp);
+ auto recognizer = GetSelectedOrDummyTarget()
+ .GetFrameRecognizerManager()
+ .GetRecognizerForFrame(frame_sp);
Stream &output_stream = result.GetOutputStream();
output_stream.Printf("frame %d ", frame_index);