aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Commands/CommandObjectFrame.cpp
diff options
context:
space:
mode:
authorRaphael Isemann <teemperor@gmail.com>2020-07-17 08:36:38 +0200
committerRaphael Isemann <teemperor@gmail.com>2020-07-17 09:26:27 +0200
commit1b7c9eae6dcad09c264e29e41a69bed0d34c2f5f (patch)
tree57241d42da54d2a003fc915567eac87ed92b871c /lldb/source/Commands/CommandObjectFrame.cpp
parentf5db2411c25399bf5e6e7258c9f7412dbee0b753 (diff)
downloadllvm-1b7c9eae6dcad09c264e29e41a69bed0d34c2f5f.zip
llvm-1b7c9eae6dcad09c264e29e41a69bed0d34c2f5f.tar.gz
llvm-1b7c9eae6dcad09c264e29e41a69bed0d34c2f5f.tar.bz2
[lldb] Store StackFrameRecognizers in the target instead of a global list
Summary: Currently the frame recognizers are stored in a global list (the list in the StackFrameRecognizersManagerImpl singleton to be precise). All commands and plugins that modify the list are just modifying that global list of recognizers which is shared by all Target and Debugger instances. This is clearly against the idea of LLDB being usable as a library and it also leads to some very obscure errors as now multiple tests are sharing the used frame recognizers. For example D83400 is currently failing as it reorders some test_ functions which permanently changes the frame recognizers of all debuggers/targets. As all frame recognizers are also initialized in a 'once' guard, it's also impossible to every restore back the original frame recognizers once they are deleted in a process. This patch just moves the frame recognizers into the current target. This seems the way everyone assumes the system works as for example the assert frame recognizers is using the current target to find the function/so-name to look for (which only works if the recognizers are stored in the target). Reviewers: jingham, mib Reviewed By: jingham, mib Subscribers: MrHate, JDevlieghere Differential Revision: https://reviews.llvm.org/D83757
Diffstat (limited to 'lldb/source/Commands/CommandObjectFrame.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectFrame.cpp27
1 files changed, 18 insertions, 9 deletions
diff --git a/lldb/source/Commands/CommandObjectFrame.cpp b/lldb/source/Commands/CommandObjectFrame.cpp
index 6ebad9b..b42020d 100644
--- a/lldb/source/Commands/CommandObjectFrame.cpp
+++ b/lldb/source/Commands/CommandObjectFrame.cpp
@@ -898,12 +898,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 +923,9 @@ public:
protected:
bool DoExecute(Args &command, CommandReturnObject &result) override {
- StackFrameRecognizerManager::RemoveAllRecognizers();
+ GetSelectedOrDummyTarget()
+ .GetFrameRecognizerManager()
+ .RemoveAllRecognizers();
result.SetStatus(eReturnStatusSuccessFinishResult);
return result.Succeeded();
}
@@ -941,7 +945,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 +977,9 @@ protected:
return false;
}
- StackFrameRecognizerManager::RemoveAllRecognizers();
+ GetSelectedOrDummyTarget()
+ .GetFrameRecognizerManager()
+ .RemoveAllRecognizers();
result.SetStatus(eReturnStatusSuccessFinishResult);
return result.Succeeded();
}
@@ -993,7 +999,9 @@ protected:
return false;
}
- StackFrameRecognizerManager::RemoveRecognizerWithID(recognizer_id);
+ GetSelectedOrDummyTarget()
+ .GetFrameRecognizerManager()
+ .RemoveRecognizerWithID(recognizer_id);
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);