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 #include <vector> 14 15 #include "lldb/Target/Unwind.h" 16 #include "lldb/lldb-private.h" 17 18 class UnwindMacOSXFrameBackchain : public lldb_private::Unwind { 19 public: 20 UnwindMacOSXFrameBackchain(lldb_private::Thread &thread); 21 22 ~UnwindMacOSXFrameBackchain() override = default; 23 24 protected: DoClear()25 void DoClear() override { m_cursors.clear(); } 26 27 uint32_t DoGetFrameCount() override; 28 29 bool DoGetFrameInfoAtIndex(uint32_t frame_idx, lldb::addr_t &cfa, 30 lldb::addr_t &pc) override; 31 32 lldb::RegisterContextSP 33 DoCreateRegisterContextForFrame(lldb_private::StackFrame *frame) override; 34 35 friend class RegisterContextMacOSXFrameBackchain; 36 37 struct Cursor { 38 lldb::addr_t pc; // Program counter 39 lldb::addr_t fp; // Frame pointer for us with backchain 40 }; 41 42 private: 43 std::vector<Cursor> m_cursors; 44 45 size_t GetStackFrameData_i386(const lldb_private::ExecutionContext &exe_ctx); 46 47 size_t 48 GetStackFrameData_x86_64(const lldb_private::ExecutionContext &exe_ctx); 49 50 //------------------------------------------------------------------ 51 // For UnwindMacOSXFrameBackchain only 52 //------------------------------------------------------------------ 53 DISALLOW_COPY_AND_ASSIGN(UnwindMacOSXFrameBackchain); 54 }; 55 56 #endif // lldb_UnwindMacOSXFrameBackchain_h_ 57