1 //===-- Unwind.h ------------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef liblldb_Unwind_h_
11 #define liblldb_Unwind_h_
15 // Other libraries and framework includes
17 #include "lldb/lldb-private.h"
18 #include "lldb/Host/Mutex.h"
20 namespace lldb_private {
25 //------------------------------------------------------------------
26 // Classes that inherit from Unwind can see and modify these
27 //------------------------------------------------------------------
28 Unwind(Thread &thread) :
30 m_unwind_mutex(Mutex::eMutexTypeRecursive)
43 Mutex::Locker locker(m_unwind_mutex);
51 Mutex::Locker locker(m_unwind_mutex);
52 return DoGetFrameCount();
56 GetFramesUpTo (uint32_t end_idx)
62 for (idx = 0; idx < end_idx; idx++)
64 if (!DoGetFrameInfoAtIndex (idx, cfa, pc))
73 GetFrameInfoAtIndex (uint32_t frame_idx,
77 Mutex::Locker locker(m_unwind_mutex);
78 return DoGetFrameInfoAtIndex (frame_idx, cfa, pc);
81 lldb::RegisterContextSP
82 CreateRegisterContextForFrame (StackFrame *frame)
84 Mutex::Locker locker(m_unwind_mutex);
85 return DoCreateRegisterContextForFrame (frame);
95 //------------------------------------------------------------------
96 // Classes that inherit from Unwind can see and modify these
97 //------------------------------------------------------------------
102 DoGetFrameCount() = 0;
105 DoGetFrameInfoAtIndex (uint32_t frame_idx,
107 lldb::addr_t& pc) = 0;
109 virtual lldb::RegisterContextSP
110 DoCreateRegisterContextForFrame (StackFrame *frame) = 0;
113 Mutex m_unwind_mutex;
115 DISALLOW_COPY_AND_ASSIGN (Unwind);
118 } // namespace lldb_private
120 #endif // liblldb_Unwind_h_