1 //===-- UnwindMacOSXFrameBackchain.h ----------------------------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 #ifndef lldb_UnwindMacOSXFrameBackchain_h_ 11 #define lldb_UnwindMacOSXFrameBackchain_h_ 12 13 // C Includes 14 // C++ Includes 15 #include <vector> 16 17 // Other libraries and framework includes 18 // Project includes 19 #include "lldb/Target/Unwind.h" 20 #include "lldb/lldb-private.h" 21 22 class UnwindMacOSXFrameBackchain : public lldb_private::Unwind { 23 public: 24 UnwindMacOSXFrameBackchain(lldb_private::Thread &thread); 25 26 ~UnwindMacOSXFrameBackchain() override = default; 27 28 protected: 29 void DoClear() override { m_cursors.clear(); } 30 31 uint32_t DoGetFrameCount() override; 32 33 bool DoGetFrameInfoAtIndex(uint32_t frame_idx, lldb::addr_t &cfa, 34 lldb::addr_t &pc) override; 35 36 lldb::RegisterContextSP 37 DoCreateRegisterContextForFrame(lldb_private::StackFrame *frame) override; 38 39 friend class RegisterContextMacOSXFrameBackchain; 40 41 struct Cursor { 42 lldb::addr_t pc; // Program counter 43 lldb::addr_t fp; // Frame pointer for us with backchain 44 }; 45 46 private: 47 std::vector<Cursor> m_cursors; 48 49 size_t GetStackFrameData_i386(const lldb_private::ExecutionContext &exe_ctx); 50 51 size_t 52 GetStackFrameData_x86_64(const lldb_private::ExecutionContext &exe_ctx); 53 54 //------------------------------------------------------------------ 55 // For UnwindMacOSXFrameBackchain only 56 //------------------------------------------------------------------ 57 DISALLOW_COPY_AND_ASSIGN(UnwindMacOSXFrameBackchain); 58 }; 59 60 #endif // lldb_UnwindMacOSXFrameBackchain_h_ 61