LLDB  mainline
AssertFrameRecognizer.h
Go to the documentation of this file.
1 //===-- AssertFrameRecognizer.cpp -------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLDB_TARGET_ASSERTFRAMERECOGNIZER_H
10 #define LLDB_TARGET_ASSERTFRAMERECOGNIZER_H
11 
12 #include "lldb/Target/Process.h"
15 #include "lldb/Utility/FileSpec.h"
16 
17 #include <tuple>
18 
19 namespace lldb_private {
20 
21 /// Registers the assert stack frame recognizer.
22 ///
23 /// \param[in] process
24 /// The process that is currently asserting. This will give us information on
25 /// the target and the platform.
26 void RegisterAssertFrameRecognizer(Process *process);
27 
28 /// \class AssertRecognizedStackFrame
29 ///
30 /// Holds the stack frame where the assert is called from.
32 public:
33  AssertRecognizedStackFrame(lldb::StackFrameSP most_relevant_frame_sp);
34  lldb::StackFrameSP GetMostRelevantFrame() override;
35 
36 private:
37  lldb::StackFrameSP m_most_relevant_frame;
38 };
39 
40 /// \class AssertFrameRecognizer
41 ///
42 /// When a thread stops, it checks depending on the platform if the top frame is
43 /// an abort stack frame. If so, it looks for an assert stack frame in the upper
44 /// frames and set it as the most relavant frame when found.
46 public:
47  std::string GetName() override { return "Assert StackFrame Recognizer"; }
48  lldb::RecognizedStackFrameSP
49  RecognizeFrame(lldb::StackFrameSP frame_sp) override;
50 };
51 
52 } // namespace lldb_private
53 
54 #endif // LLDB_TARGET_ASSERTFRAMERECOGNIZER_H
A class that represents a running process on the host machine.
Holds the stack frame where the assert is called from.
A base class for frame recognizers.
AssertRecognizedStackFrame(lldb::StackFrameSP most_relevant_frame_sp)
void RegisterAssertFrameRecognizer(Process *process)
Registers the assert stack frame recognizer.
When a thread stops, it checks depending on the platform if the top frame is an abort stack frame...
lldb::StackFrameSP GetMostRelevantFrame() override
This class provides extra information about a stack frame that was provided by a specific stack frame...