Jason Molenda | 8280cbe | 2010-10-25 11:12:07 +0000 | [diff] [blame] | 1 | //===-- 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 | |
Jason Molenda | 8280cbe | 2010-10-25 11:12:07 +0000 | [diff] [blame] | 13 | #include <vector> |
| 14 | |
Greg Clayton | b344843 | 2011-03-24 21:19:54 +0000 | [diff] [blame] | 15 | #include "lldb/lldb-public.h" |
Greg Clayton | c3c4661 | 2011-02-15 00:19:15 +0000 | [diff] [blame] | 16 | #include "lldb/Symbol/FuncUnwinders.h" |
| 17 | #include "lldb/Symbol/UnwindPlan.h" |
| 18 | #include "lldb/Target/RegisterContext.h" |
| 19 | #include "lldb/Target/Unwind.h" |
| 20 | |
| 21 | #include "RegisterContextLLDB.h" |
Jason Molenda | 8280cbe | 2010-10-25 11:12:07 +0000 | [diff] [blame] | 22 | |
| 23 | namespace lldb_private { |
| 24 | |
| 25 | class UnwindLLDB : public lldb_private::Unwind |
| 26 | { |
| 27 | public: |
| 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 | |
Greg Clayton | 08d7d3a | 2011-01-06 22:15:06 +0000 | [diff] [blame] | 47 | lldb::RegisterContextSP |
Jason Molenda | 8280cbe | 2010-10-25 11:12:07 +0000 | [diff] [blame] | 48 | CreateRegisterContextForFrame (lldb_private::StackFrame *frame); |
| 49 | |
| 50 | private: |
| 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 |
Greg Clayton | c3c4661 | 2011-02-15 00:19:15 +0000 | [diff] [blame] | 56 | RegisterContextLLDB::SharedPtr reg_ctx; // These are all RegisterContextLLDB's |
Jason Molenda | 8280cbe | 2010-10-25 11:12:07 +0000 | [diff] [blame] | 57 | |
| 58 | Cursor () : start_pc (LLDB_INVALID_ADDRESS), cfa (LLDB_INVALID_ADDRESS), sctx(), reg_ctx() { } |
Jason Molenda | d6ef16a | 2010-11-09 01:21:22 +0000 | [diff] [blame] | 59 | private: |
Jason Molenda | a6b71de | 2010-11-04 09:40:56 +0000 | [diff] [blame] | 60 | DISALLOW_COPY_AND_ASSIGN (Cursor); |
Jason Molenda | 8280cbe | 2010-10-25 11:12:07 +0000 | [diff] [blame] | 61 | }; |
| 62 | |
Jason Molenda | 800d11d | 2010-11-04 00:53:20 +0000 | [diff] [blame] | 63 | typedef lldb::SharedPtr<Cursor>::Type CursorSP; |
| 64 | std::vector<CursorSP> m_frames; |
Jason Molenda | 8280cbe | 2010-10-25 11:12:07 +0000 | [diff] [blame] | 65 | |
Greg Clayton | 54b3841 | 2011-05-24 23:06:02 +0000 | [diff] [blame] | 66 | bool AddOneMoreFrame (ABI *abi); |
Jason Molenda | 1da513b | 2010-11-09 02:31:21 +0000 | [diff] [blame] | 67 | bool AddFirstFrame (); |
| 68 | |
Jason Molenda | 8280cbe | 2010-10-25 11:12:07 +0000 | [diff] [blame] | 69 | //------------------------------------------------------------------ |
| 70 | // For UnwindLLDB only |
| 71 | //------------------------------------------------------------------ |
| 72 | DISALLOW_COPY_AND_ASSIGN (UnwindLLDB); |
| 73 | }; |
| 74 | |
Greg Clayton | fd11999 | 2011-01-07 06:08:19 +0000 | [diff] [blame] | 75 | } // namespace lldb_private |
Jason Molenda | 8280cbe | 2010-10-25 11:12:07 +0000 | [diff] [blame] | 76 | |
| 77 | #endif // lldb_UnwindLLDB_h_ |