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;
23 HistoryUnwind::HistoryUnwind (Thread &thread,
24 std::vector<lldb::addr_t> pcs,
26 bool stop_id_is_valid) :
30 m_stop_id_is_valid (stop_id_is_valid)
34 HistoryUnwind::~HistoryUnwind ()
39 HistoryUnwind::DoClear ()
41 Mutex::Locker locker(m_unwind_mutex);
43 m_stop_id_is_valid = false;
46 lldb::RegisterContextSP
47 HistoryUnwind::DoCreateRegisterContextForFrame (StackFrame *frame)
49 RegisterContextSP rctx;
52 addr_t pc = frame->GetFrameCodeAddress().GetLoadAddress (&frame->GetThread()->GetProcess()->GetTarget());
53 if (pc != LLDB_INVALID_ADDRESS)
55 rctx.reset (new RegisterContextHistory (*frame->GetThread().get(), frame->GetConcreteFrameIndex(),
56 frame->GetThread()->GetProcess()->GetAddressByteSize(), pc));
63 HistoryUnwind::DoGetFrameInfoAtIndex (uint32_t frame_idx, lldb::addr_t& cfa, lldb::addr_t& pc)
65 Mutex::Locker (m_unwind_mutex);
66 if (frame_idx < m_pcs.size())
69 pc = m_pcs[frame_idx];
76 HistoryUnwind::DoGetFrameCount ()