UnwindTable.h revision 309124
1254721Semaste//===-- Symtab.h ------------------------------------------------*- C++ -*-===// 2254721Semaste// 3254721Semaste// The LLVM Compiler Infrastructure 4254721Semaste// 5254721Semaste// This file is distributed under the University of Illinois Open Source 6254721Semaste// License. See LICENSE.TXT for details. 7254721Semaste// 8254721Semaste//===----------------------------------------------------------------------===// 9254721Semaste 10254721Semaste 11254721Semaste#ifndef liblldb_UnwindTable_h 12254721Semaste#define liblldb_UnwindTable_h 13254721Semaste 14254721Semaste#include <map> 15309124Sdim#include <mutex> 16254721Semaste 17276479Sdim#include "lldb/lldb-private.h" 18254721Semaste 19254721Semastenamespace lldb_private { 20254721Semaste 21254721Semaste// A class which holds all the FuncUnwinders objects for a given ObjectFile. 22254721Semaste// The UnwindTable is populated with FuncUnwinders objects lazily during 23254721Semaste// the debug session. 24254721Semaste 25254721Semasteclass UnwindTable 26254721Semaste{ 27254721Semastepublic: 28254721Semaste UnwindTable(ObjectFile& objfile); 29254721Semaste ~UnwindTable(); 30254721Semaste 31254721Semaste lldb_private::DWARFCallFrameInfo * 32254721Semaste GetEHFrameInfo (); 33254721Semaste 34280031Sdim lldb_private::CompactUnwindInfo * 35280031Sdim GetCompactUnwindInfo (); 36280031Sdim 37296417Sdim ArmUnwindInfo * 38296417Sdim GetArmUnwindInfo (); 39296417Sdim 40254721Semaste lldb::FuncUnwindersSP 41254721Semaste GetFuncUnwindersContainingAddress (const Address& addr, SymbolContext &sc); 42254721Semaste 43309124Sdim bool 44309124Sdim GetAllowAssemblyEmulationUnwindPlans (); 45309124Sdim 46254721Semaste// Normally when we create a new FuncUnwinders object we track it in this UnwindTable so it can 47254721Semaste// be reused later. But for the target modules show-unwind we want to create brand new 48254721Semaste// UnwindPlans for the function of interest - so ignore any existing FuncUnwinders for that 49254721Semaste// function and don't add this new one to our UnwindTable. 50254721Semaste// This FuncUnwinders object does have a reference to the UnwindTable but the lifetime of this 51254721Semaste// uncached FuncUnwinders is expected to be short so in practice this will not be a problem. 52254721Semaste lldb::FuncUnwindersSP 53254721Semaste GetUncachedFuncUnwindersContainingAddress (const Address& addr, SymbolContext &sc); 54254721Semaste 55276479Sdim bool 56276479Sdim GetArchitecture (lldb_private::ArchSpec &arch); 57276479Sdim 58254721Semasteprivate: 59254721Semaste void 60254721Semaste Dump (Stream &s); 61254721Semaste 62254721Semaste void Initialize (); 63254721Semaste 64254721Semaste typedef std::map<lldb::addr_t, lldb::FuncUnwindersSP> collection; 65254721Semaste typedef collection::iterator iterator; 66254721Semaste typedef collection::const_iterator const_iterator; 67254721Semaste 68254721Semaste ObjectFile& m_object_file; 69254721Semaste collection m_unwinds; 70254721Semaste 71254721Semaste bool m_initialized; // delay some initialization until ObjectFile is set up 72309124Sdim std::mutex m_mutex; 73254721Semaste 74296417Sdim std::unique_ptr<DWARFCallFrameInfo> m_eh_frame_up; 75296417Sdim std::unique_ptr<CompactUnwindInfo> m_compact_unwind_up; 76296417Sdim std::unique_ptr<ArmUnwindInfo> m_arm_unwind_up; 77296417Sdim 78254721Semaste DISALLOW_COPY_AND_ASSIGN (UnwindTable); 79254721Semaste}; 80254721Semaste 81254721Semaste} // namespace lldb_private 82254721Semaste 83254721Semaste#endif // liblldb_UnwindTable_h 84