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