blob: 5c1211719b706271532d82b60f70a51537241b1e [file] [log] [blame]
Jason Molenda8280cbe2010-10-25 11:12:07 +00001//===-- UnwindLLDB.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_UnwindLLDB_h_
11#define lldb_UnwindLLDB_h_
12
13#include "lldb/lldb-private.h"
14#include "lldb/Target/Unwind.h"
15#include "lldb/Symbol/FuncUnwinders.h"
16#include "lldb/Symbol/UnwindPlan.h"
17#include "RegisterContextLLDB.h"
18#include "lldb/Target/RegisterContext.h"
19#include <vector>
20
21
22namespace lldb_private {
23
24class UnwindLLDB : public lldb_private::Unwind
25{
26public:
27 UnwindLLDB (lldb_private::Thread &thread);
28
29 virtual
30 ~UnwindLLDB() { }
31
32 void
33 Clear()
34 {
35 m_frames.clear();
36 }
37
38 virtual uint32_t
39 GetFrameCount();
40
41 bool
42 GetFrameInfoAtIndex (uint32_t frame_idx,
43 lldb::addr_t& cfa,
44 lldb::addr_t& start_pc);
45
46 lldb_private::RegisterContext *
47 CreateRegisterContextForFrame (lldb_private::StackFrame *frame);
48
49private:
50 struct Cursor
51 {
52 lldb::addr_t start_pc; // The start address of the function/symbol for this frame - current pc if unknown
53 lldb::addr_t cfa; // The canonical frame address for this stack frame
54 lldb_private::SymbolContext sctx; // A symbol context we'll contribute to & provide to the StackFrame creation
55 lldb::RegisterContextSP reg_ctx; // These are all RegisterContextLLDB's
56
57 Cursor () : start_pc (LLDB_INVALID_ADDRESS), cfa (LLDB_INVALID_ADDRESS), sctx(), reg_ctx() { }
58 };
59
60 std::vector<Cursor> m_frames;
61
62 //------------------------------------------------------------------
63 // For UnwindLLDB only
64 //------------------------------------------------------------------
65 DISALLOW_COPY_AND_ASSIGN (UnwindLLDB);
66};
67
68}
69
70#endif // lldb_UnwindLLDB_h_