UnwindTable.h revision 5b0afcceea3807fa8f518e0138f0a8043dfc3315
14950e88e0fa7c44c0b54e2f64ddf57415ed83d40Chris Lattner//===-- Symtab.h ------------------------------------------------*- C++ -*-===//
29769ab22265b313171d201b5928688524a01bd87Misha Brukman//
34950e88e0fa7c44c0b54e2f64ddf57415ed83d40Chris Lattner//                     The LLVM Compiler Infrastructure
44950e88e0fa7c44c0b54e2f64ddf57415ed83d40Chris Lattner//
57ed47a13356daed2a34cd2209a31f92552e3bdd8Chris Lattner// This file is distributed under the University of Illinois Open Source
67ed47a13356daed2a34cd2209a31f92552e3bdd8Chris Lattner// License. See LICENSE.TXT for details.
79769ab22265b313171d201b5928688524a01bd87Misha Brukman//
84950e88e0fa7c44c0b54e2f64ddf57415ed83d40Chris Lattner//===----------------------------------------------------------------------===//
94950e88e0fa7c44c0b54e2f64ddf57415ed83d40Chris Lattner
104950e88e0fa7c44c0b54e2f64ddf57415ed83d40Chris Lattner
119769ab22265b313171d201b5928688524a01bd87Misha Brukman#ifndef liblldb_UnwindTable_h
124950e88e0fa7c44c0b54e2f64ddf57415ed83d40Chris Lattner#define liblldb_UnwindTable_h
134950e88e0fa7c44c0b54e2f64ddf57415ed83d40Chris Lattner
144950e88e0fa7c44c0b54e2f64ddf57415ed83d40Chris Lattner#include <map>
154950e88e0fa7c44c0b54e2f64ddf57415ed83d40Chris Lattner
164950e88e0fa7c44c0b54e2f64ddf57415ed83d40Chris Lattner#include "lldb/lldb-private.h"
174950e88e0fa7c44c0b54e2f64ddf57415ed83d40Chris Lattner
184950e88e0fa7c44c0b54e2f64ddf57415ed83d40Chris Lattnernamespace lldb_private {
194950e88e0fa7c44c0b54e2f64ddf57415ed83d40Chris Lattner
204950e88e0fa7c44c0b54e2f64ddf57415ed83d40Chris Lattner// A class which holds all the FuncUnwinders objects for a given ObjectFile.
214950e88e0fa7c44c0b54e2f64ddf57415ed83d40Chris Lattner// The UnwindTable is populated with FuncUnwinders objects lazily during
2235fa43907e2ea751ad35bfbaab8c4d3511422c14Reid Spencer// the debug session.
235a6c1a840ad343c0ed2fa54a0edb50b61f828f0fEvan Cheng
244950e88e0fa7c44c0b54e2f64ddf57415ed83d40Chris Lattnerclass UnwindTable
254950e88e0fa7c44c0b54e2f64ddf57415ed83d40Chris Lattner{
264950e88e0fa7c44c0b54e2f64ddf57415ed83d40Chris Lattnerpublic:
274950e88e0fa7c44c0b54e2f64ddf57415ed83d40Chris Lattner    UnwindTable(ObjectFile& objfile);
28d19534add90a2a894af61523b830887097bb780bDan Gohman    ~UnwindTable();
29789558db70d9513a017c11c5be30945839fdff1cNick Lewycky
303e6307698084e7adfc10b739442ae29742beefd0Nick Lewycky    lldb_private::DWARFCallFrameInfo *
314950e88e0fa7c44c0b54e2f64ddf57415ed83d40Chris Lattner    GetEHFrameInfo ();
324950e88e0fa7c44c0b54e2f64ddf57415ed83d40Chris Lattner
334950e88e0fa7c44c0b54e2f64ddf57415ed83d40Chris Lattner    lldb::FuncUnwindersSP
344950e88e0fa7c44c0b54e2f64ddf57415ed83d40Chris Lattner    GetFuncUnwindersContainingAddress (const Address& addr, SymbolContext &sc);
354950e88e0fa7c44c0b54e2f64ddf57415ed83d40Chris Lattner
364950e88e0fa7c44c0b54e2f64ddf57415ed83d40Chris Lattner// Normally when we create a new FuncUnwinders object we track it in this UnwindTable so it can
37246b2564d3bbbafe06ebf6a67745cd24141b5cb4Dan Gohman// be reused later.  But for the target modules show-unwind we want to create brand new
38246b2564d3bbbafe06ebf6a67745cd24141b5cb4Dan Gohman// UnwindPlans for the function of interest - so ignore any existing FuncUnwinders for that
394950e88e0fa7c44c0b54e2f64ddf57415ed83d40Chris Lattner// function and don't add this new one to our UnwindTable.
409a6ae965d69b131d692de8fc69545b6c7aaea0b2Dan Gohman// This FuncUnwinders object does have a reference to the UnwindTable but the lifetime of this
419769ab22265b313171d201b5928688524a01bd87Misha Brukman// uncached FuncUnwinders is expected to be short so in practice this will not be a problem.
424950e88e0fa7c44c0b54e2f64ddf57415ed83d40Chris Lattner    lldb::FuncUnwindersSP
434950e88e0fa7c44c0b54e2f64ddf57415ed83d40Chris Lattner    GetUncachedFuncUnwindersContainingAddress (const Address& addr, SymbolContext &sc);
444950e88e0fa7c44c0b54e2f64ddf57415ed83d40Chris Lattner
454950e88e0fa7c44c0b54e2f64ddf57415ed83d40Chris Lattnerprivate:
464950e88e0fa7c44c0b54e2f64ddf57415ed83d40Chris Lattner    void
474950e88e0fa7c44c0b54e2f64ddf57415ed83d40Chris Lattner    Dump (Stream &s);
484950e88e0fa7c44c0b54e2f64ddf57415ed83d40Chris Lattner
494950e88e0fa7c44c0b54e2f64ddf57415ed83d40Chris Lattner    void Initialize ();
504950e88e0fa7c44c0b54e2f64ddf57415ed83d40Chris Lattner
514950e88e0fa7c44c0b54e2f64ddf57415ed83d40Chris Lattner    typedef std::map<lldb::addr_t, lldb::FuncUnwindersSP> collection;
524950e88e0fa7c44c0b54e2f64ddf57415ed83d40Chris Lattner    typedef collection::iterator iterator;
534950e88e0fa7c44c0b54e2f64ddf57415ed83d40Chris Lattner    typedef collection::const_iterator const_iterator;
544950e88e0fa7c44c0b54e2f64ddf57415ed83d40Chris Lattner
554950e88e0fa7c44c0b54e2f64ddf57415ed83d40Chris Lattner    ObjectFile&         m_object_file;
56afc0dc7184cf73ff7ac64e516284fbe0c7023ba4Chris Lattner    collection          m_unwinds;
57246b2564d3bbbafe06ebf6a67745cd24141b5cb4Dan Gohman
58246b2564d3bbbafe06ebf6a67745cd24141b5cb4Dan Gohman    bool                m_initialized;  // delay some initialization until ObjectFile is set up
59afc0dc7184cf73ff7ac64e516284fbe0c7023ba4Chris Lattner
60afc0dc7184cf73ff7ac64e516284fbe0c7023ba4Chris Lattner    UnwindAssembly* m_assembly_profiler;
61afc0dc7184cf73ff7ac64e516284fbe0c7023ba4Chris Lattner
625a6c1a840ad343c0ed2fa54a0edb50b61f828f0fEvan Cheng    DWARFCallFrameInfo* m_eh_frame;
635a6c1a840ad343c0ed2fa54a0edb50b61f828f0fEvan Cheng
645a6c1a840ad343c0ed2fa54a0edb50b61f828f0fEvan Cheng    DISALLOW_COPY_AND_ASSIGN (UnwindTable);
655a6c1a840ad343c0ed2fa54a0edb50b61f828f0fEvan Cheng};
66b7ef72963b2215ca23c27fa8ea777bada06994d0Dan Gohman
674950e88e0fa7c44c0b54e2f64ddf57415ed83d40Chris Lattner} // namespace lldb_private
684950e88e0fa7c44c0b54e2f64ddf57415ed83d40Chris Lattner
694950e88e0fa7c44c0b54e2f64ddf57415ed83d40Chris Lattner#endif  // liblldb_UnwindTable_h
704950e88e0fa7c44c0b54e2f64ddf57415ed83d40Chris Lattner