1 //===-- HistoryUnwind.cpp ---------------------------------------*- 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 #include "lldb/lldb-private.h"
12 #include "Plugins/Process/Utility/RegisterContextHistory.h"
13 #include "Plugins/Process/Utility/HistoryUnwind.h"
15 #include "lldb/Target/StackFrame.h"
16 #include "lldb/Target/Thread.h"
17 #include "lldb/Target/Process.h"
18 #include "lldb/Target/Target.h"
21 using namespace lldb_private;
25 HistoryUnwind::HistoryUnwind (Thread &thread,
26 std::vector<lldb::addr_t> pcs,
27 bool stop_id_is_valid) :
30 m_stop_id_is_valid (stop_id_is_valid)
36 HistoryUnwind::~HistoryUnwind ()
41 HistoryUnwind::DoClear ()
43 Mutex::Locker locker(m_unwind_mutex);
45 m_stop_id_is_valid = false;
48 lldb::RegisterContextSP
49 HistoryUnwind::DoCreateRegisterContextForFrame (StackFrame *frame)
51 RegisterContextSP rctx;
54 addr_t pc = frame->GetFrameCodeAddress().GetLoadAddress (&frame->GetThread()->GetProcess()->GetTarget());
55 if (pc != LLDB_INVALID_ADDRESS)
57 rctx.reset (new RegisterContextHistory (*frame->GetThread().get(), frame->GetConcreteFrameIndex(),
58 frame->GetThread()->GetProcess()->GetAddressByteSize(), pc));
65 HistoryUnwind::DoGetFrameInfoAtIndex (uint32_t frame_idx, lldb::addr_t& cfa, lldb::addr_t& pc)
67 Mutex::Locker (m_unwind_mutex); // FIXME do not throw away the lock after we acquire it..
68 if (frame_idx < m_pcs.size())
71 pc = m_pcs[frame_idx];
78 HistoryUnwind::DoGetFrameCount ()