27 switch (triple.getOS()) {
28 case llvm::Triple::Darwin:
29 case llvm::Triple::MacOSX:
30 case llvm::Triple::IOS:
31 case llvm::Triple::TvOS:
32 case llvm::Triple::WatchOS:
33 case llvm::Triple::BridgeOS:
34 case llvm::Triple::DriverKit:
35 case llvm::Triple::XROS:
39 case llvm::Triple::Linux:
47 case llvm::Triple::Win32:
48 if (!triple.isWindowsMSVCEnvironment()) {
50 LLDB_LOG(log,
"AssertFrameRecognizer::GetAbortLocation Unsupported "
51 "Windows environment");
62 LLDB_LOG(log,
"AssertFrameRecognizer::GetAbortLocation Unsupported OS");
79 switch (triple.getOS()) {
80 case llvm::Triple::Darwin:
81 case llvm::Triple::MacOSX:
82 case llvm::Triple::IOS:
83 case llvm::Triple::TvOS:
84 case llvm::Triple::WatchOS:
85 case llvm::Triple::BridgeOS:
86 case llvm::Triple::DriverKit:
87 case llvm::Triple::XROS:
91 case llvm::Triple::Linux:
96 case llvm::Triple::Win32:
97 if (!triple.isWindowsMSVCEnvironment()) {
99 LLDB_LOG(log,
"AssertFrameRecognizer::GetAssertLocation Unsupported "
100 "Windows environment");
108 LLDB_LOG(log,
"AssertFrameRecognizer::GetAssertLocation Unsupported OS");
125 std::make_shared<AssertFrameRecognizer>(),
131 std::string module_re =
"^";
138 std::string symbol_re =
"^(";
139 for (
auto it = location.
symbols.cbegin(); it != location.
symbols.cend();
141 if (it != location.
symbols.cbegin())
143 symbol_re += it->GetStringRef();
146 symbol_re +=
")(@.*)?$";
148 std::make_shared<AssertFrameRecognizer>(),
149 std::make_shared<RegularExpression>(std::move(module_re)),
150 std::make_shared<RegularExpression>(std::move(symbol_re)),
159 ThreadSP thread_sp = frame_sp->GetThread();
160 ProcessSP process_sp = thread_sp->GetProcess();
161 Target &target = process_sp->GetTarget();
168 const uint32_t frames_to_fetch = 6;
169 const uint32_t last_frame_index = frames_to_fetch - 1;
173 for (uint32_t frame_index = 0; frame_index < frames_to_fetch; frame_index++) {
174 prev_frame_sp = thread_sp->GetStackFrameAtIndex(frame_index);
176 if (!prev_frame_sp) {
178 LLDB_LOG(log,
"Abort Recognizer: Hit unwinding bound ({} frames)!",
184 prev_frame_sp->GetSymbolContext(eSymbolContextEverything);
190 if (!triple.isOSWindows() &&
196 if (llvm::is_contained(location.
symbols, func_name)) {
202 StackFrameSP most_relevant_frame_sp = thread_sp->GetStackFrameAtIndex(
203 std::min(frame_index + 1, last_frame_index));
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
llvm::Triple & GetTriple()
Architecture triple accessor.
lldb::RecognizedStackFrameSP RecognizeFrame(lldb::StackFrameSP frame_sp) override
Holds the stack frame where the assert is called from.
AssertRecognizedStackFrame(lldb::StackFrameSP most_relevant_frame_sp)
lldb::StackFrameSP m_most_relevant_frame
lldb::StackFrameSP GetMostRelevantFrame() override
A uniqued constant string class.
llvm::StringRef GetFilename() const
Filename string const get accessor.
A plug-in interface definition class for debugging a process.
Target & GetTarget()
Get the target object pointer for this module.
void AddRecognizer(lldb::StackFrameRecognizerSP recognizer, std::string module, std::vector< ConstString > symbols, Mangled::NamePreference symbol_mangling, bool first_instruction_only=true)
Add a new recognizer that triggers on a given symbol name.
Defines a symbol context baton that can be handed other debug core functions.
ConstString GetFunctionName(Mangled::NamePreference preference=Mangled::ePreferDemangled) const
Find a name of the innermost function for the symbol context.
lldb::ModuleSP module_sp
The Module for a given query.
StackFrameRecognizerManager & GetFrameRecognizerManager()
const ArchSpec & GetArchitecture() const
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
bool GetAbortLocation(const llvm::Triple &triple, SymbolLocation &location)
Fetches the abort frame location depending on the current platform.
bool GetAssertLocation(const llvm::Triple &triple, SymbolLocation &location)
Fetches the assert frame location depending on the current platform.
void RegisterAssertFrameRecognizer(Process *process)
Registers the assert stack frame recognizer.
std::shared_ptr< lldb_private::StackFrame > StackFrameSP
std::shared_ptr< lldb_private::RecognizedStackFrame > RecognizedStackFrameSP
std::shared_ptr< lldb_private::Thread > ThreadSP
std::shared_ptr< lldb_private::Process > ProcessSP
Stores a function module spec, symbol name and possibly an alternate symbol name.
std::vector< ConstString > symbols