13#include "clang/CodeGen/ModuleBuilder.h"
20 StackFrameSP most_relevant_frame_sp, std::string stop_desc)
21 : m_most_relevant_frame(most_relevant_frame_sp) {
27 if (frame_sp->GetFrameIndex())
30 ThreadSP thread_sp = frame_sp->GetThread();
31 ProcessSP process_sp = thread_sp->GetProcess();
33 StackFrameSP most_relevant_frame_sp = thread_sp->GetStackFrameAtIndex(1);
35 if (!most_relevant_frame_sp) {
39 "Failed to find most relevant frame: Hit unwinding bound (1 frame)!");
43 SymbolContext sc = frame_sp->GetSymbolContext(eSymbolContextEverything);
62 if (func_name.empty())
65 static auto trap_regex =
66 llvm::Regex(llvm::formatv(
"^{0}\\$(.*)\\$(.*)$", ClangTrapPrefix).str());
67 SmallVector<llvm::StringRef, 3> matches;
68 std::string regex_err_msg;
69 if (!trap_regex.match(func_name, &matches, ®ex_err_msg)) {
71 "Failed to parse match trap regex for '%s': %s", func_name.data(),
72 regex_err_msg.c_str());
81 if (matches.size() != 3) {
83 "Unexpected function name format. Expected '<trap prefix>$<trap "
84 "category>$<trap message>'$ but got: '%s'.",
90 auto category = matches[1];
91 auto message = matches[2];
93 std::string stop_reason =
94 category.empty() ?
"<empty category>" : category.str();
95 if (!message.empty()) {
97 stop_reason += message.str();
100 return std::make_shared<VerboseTrapRecognizedStackFrame>(
101 most_relevant_frame_sp, std::move(stop_reason));
112 auto symbol_regex_sp = std::make_shared<RegularExpression>(
113 llvm::formatv(
"^{0}", ClangTrapPrefix).str());
116 std::make_shared<VerboseTrapFrameRecognizer>();
119 srf_recognizer_sp, module_regex_sp, symbol_regex_sp,
false);
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
#define LLDB_LOGF(log,...)
A class that describes a single lexical block.
Block * GetContainingInlinedBlock()
Get the inlined block that contains this block.
const InlineFunctionInfo * GetInlinedFunctionInfo() const
Get const accessor for any inlined function information.
llvm::StringRef GetStringRef() const
Get the string value as a llvm::StringRef.
A class that describes information for an inlined function.
ConstString GetName() const
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, ConstString module, llvm::ArrayRef< ConstString > symbols, bool first_instruction_only=true)
Defines a symbol context baton that can be handed other debug core functions.
Block * block
The Block for a given query.
StackFrameRecognizerManager & GetFrameRecognizerManager()
lldb::RecognizedStackFrameSP RecognizeFrame(lldb::StackFrameSP frame) override
lldb::StackFrameSP GetMostRelevantFrame() override
lldb::StackFrameSP m_most_relevant_frame
VerboseTrapRecognizedStackFrame(lldb::StackFrameSP most_relevant_frame_sp, std::string stop_desc)
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.
void RegisterVerboseTrapFrameRecognizer(Process &process)
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::RegularExpression > RegularExpressionSP
std::shared_ptr< lldb_private::Process > ProcessSP
std::shared_ptr< lldb_private::StackFrameRecognizer > StackFrameRecognizerSP