Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:42:53

0001 //===-- AssertFrameRecognizer.cpp -------------------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLDB_TARGET_ASSERTFRAMERECOGNIZER_H
0010 #define LLDB_TARGET_ASSERTFRAMERECOGNIZER_H
0011 
0012 #include "lldb/Target/Process.h"
0013 #include "lldb/Target/StackFrameRecognizer.h"
0014 #include "lldb/Utility/ConstString.h"
0015 #include "lldb/Utility/FileSpec.h"
0016 
0017 #include <tuple>
0018 
0019 namespace lldb_private {
0020 
0021 /// Registers the assert stack frame recognizer.
0022 ///
0023 /// \param[in] process
0024 ///    The process that is currently asserting. This will give us information on
0025 ///    the target and the platform.
0026 void RegisterAssertFrameRecognizer(Process *process);
0027 
0028 /// \class AssertRecognizedStackFrame
0029 ///
0030 /// Holds the stack frame where the assert is called from.
0031 class AssertRecognizedStackFrame : public RecognizedStackFrame {
0032 public:
0033   AssertRecognizedStackFrame(lldb::StackFrameSP most_relevant_frame_sp);
0034   lldb::StackFrameSP GetMostRelevantFrame() override;
0035 
0036 private:
0037   lldb::StackFrameSP m_most_relevant_frame;
0038 };
0039 
0040 /// \class AssertFrameRecognizer
0041 ///
0042 /// When a thread stops, it checks depending on the platform if the top frame is
0043 /// an abort stack frame. If so, it looks for an assert stack frame in the upper
0044 /// frames and set it as the most relavant frame when found.
0045 class AssertFrameRecognizer : public StackFrameRecognizer {
0046 public:
0047   std::string GetName() override { return "Assert StackFrame Recognizer"; }
0048   lldb::RecognizedStackFrameSP
0049   RecognizeFrame(lldb::StackFrameSP frame_sp) override;
0050 };
0051 
0052 } // namespace lldb_private
0053 
0054 #endif // LLDB_TARGET_ASSERTFRAMERECOGNIZER_H