UnwindTable.h revision 344779
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#ifndef liblldb_UnwindTable_h 11254721Semaste#define liblldb_UnwindTable_h 12254721Semaste 13254721Semaste#include <map> 14309124Sdim#include <mutex> 15254721Semaste 16314564Sdim#include "lldb/lldb-private.h" 17254721Semaste 18254721Semastenamespace lldb_private { 19254721Semaste 20254721Semaste// A class which holds all the FuncUnwinders objects for a given ObjectFile. 21341825Sdim// The UnwindTable is populated with FuncUnwinders objects lazily during the 22341825Sdim// debug session. 23254721Semaste 24314564Sdimclass UnwindTable { 25254721Semastepublic: 26314564Sdim UnwindTable(ObjectFile &objfile); 27314564Sdim ~UnwindTable(); 28254721Semaste 29314564Sdim lldb_private::DWARFCallFrameInfo *GetEHFrameInfo(); 30321369Sdim lldb_private::DWARFCallFrameInfo *GetDebugFrameInfo(); 31254721Semaste 32314564Sdim lldb_private::CompactUnwindInfo *GetCompactUnwindInfo(); 33280031Sdim 34314564Sdim ArmUnwindInfo *GetArmUnwindInfo(); 35296417Sdim 36314564Sdim lldb::FuncUnwindersSP GetFuncUnwindersContainingAddress(const Address &addr, 37314564Sdim SymbolContext &sc); 38254721Semaste 39314564Sdim bool GetAllowAssemblyEmulationUnwindPlans(); 40309124Sdim 41314564Sdim // Normally when we create a new FuncUnwinders object we track it in this 42341825Sdim // UnwindTable so it can be reused later. But for the target modules show- 43341825Sdim // unwind we want to create brand new UnwindPlans for the function of 44341825Sdim // interest - so ignore any existing FuncUnwinders for that function and 45341825Sdim // don't add this new one to our UnwindTable. This FuncUnwinders object does 46341825Sdim // have a reference to the UnwindTable but the lifetime of this uncached 47341825Sdim // FuncUnwinders is expected to be short so in practice this will not be a 48341825Sdim // problem. 49314564Sdim lldb::FuncUnwindersSP 50314564Sdim GetUncachedFuncUnwindersContainingAddress(const Address &addr, 51314564Sdim SymbolContext &sc); 52254721Semaste 53344779Sdim ArchSpec GetArchitecture(); 54276479Sdim 55254721Semasteprivate: 56314564Sdim void Dump(Stream &s); 57254721Semaste 58314564Sdim void Initialize(); 59321369Sdim llvm::Optional<AddressRange> GetAddressRange(const Address &addr, 60321369Sdim SymbolContext &sc); 61254721Semaste 62314564Sdim typedef std::map<lldb::addr_t, lldb::FuncUnwindersSP> collection; 63314564Sdim typedef collection::iterator iterator; 64314564Sdim typedef collection::const_iterator const_iterator; 65254721Semaste 66314564Sdim ObjectFile &m_object_file; 67314564Sdim collection m_unwinds; 68254721Semaste 69314564Sdim bool m_initialized; // delay some initialization until ObjectFile is set up 70314564Sdim std::mutex m_mutex; 71296417Sdim 72314564Sdim std::unique_ptr<DWARFCallFrameInfo> m_eh_frame_up; 73321369Sdim std::unique_ptr<DWARFCallFrameInfo> m_debug_frame_up; 74314564Sdim std::unique_ptr<CompactUnwindInfo> m_compact_unwind_up; 75314564Sdim std::unique_ptr<ArmUnwindInfo> m_arm_unwind_up; 76314564Sdim 77314564Sdim DISALLOW_COPY_AND_ASSIGN(UnwindTable); 78254721Semaste}; 79254721Semaste 80254721Semaste} // namespace lldb_private 81254721Semaste 82314564Sdim#endif // liblldb_UnwindTable_h 83