UnwindTable.h revision 269024
1//===-- Symtab.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
11#ifndef liblldb_UnwindTable_h
12#define liblldb_UnwindTable_h
13
14#include <map>
15
16#include "lldb/lldb-private.h"
17
18namespace lldb_private {
19
20// A class which holds all the FuncUnwinders objects for a given ObjectFile.
21// The UnwindTable is populated with FuncUnwinders objects lazily during
22// the debug session.
23
24class UnwindTable
25{
26public:
27    UnwindTable(ObjectFile& objfile);
28    ~UnwindTable();
29
30    lldb_private::DWARFCallFrameInfo *
31    GetEHFrameInfo ();
32
33    lldb::FuncUnwindersSP
34    GetFuncUnwindersContainingAddress (const Address& addr, SymbolContext &sc);
35
36// Normally when we create a new FuncUnwinders object we track it in this UnwindTable so it can
37// be reused later.  But for the target modules show-unwind we want to create brand new
38// UnwindPlans for the function of interest - so ignore any existing FuncUnwinders for that
39// function and don't add this new one to our UnwindTable.
40// This FuncUnwinders object does have a reference to the UnwindTable but the lifetime of this
41// uncached FuncUnwinders is expected to be short so in practice this will not be a problem.
42    lldb::FuncUnwindersSP
43    GetUncachedFuncUnwindersContainingAddress (const Address& addr, SymbolContext &sc);
44
45private:
46    void
47    Dump (Stream &s);
48
49    void Initialize ();
50
51    typedef std::map<lldb::addr_t, lldb::FuncUnwindersSP> collection;
52    typedef collection::iterator iterator;
53    typedef collection::const_iterator const_iterator;
54
55    ObjectFile&         m_object_file;
56    collection          m_unwinds;
57
58    bool                m_initialized;  // delay some initialization until ObjectFile is set up
59
60    lldb::UnwindAssemblySP m_assembly_profiler;
61
62    DWARFCallFrameInfo* m_eh_frame;
63
64    DISALLOW_COPY_AND_ASSIGN (UnwindTable);
65};
66
67} // namespace lldb_private
68
69#endif  // liblldb_UnwindTable_h
70