SectionLoadList.h revision 49480b158ee907f30afea651d2c81a67b5dbc971
1//===-- SectionLoadList.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 liblldb_SectionLoadList_h_ 11#define liblldb_SectionLoadList_h_ 12 13// C Includes 14// C++ Includes 15// Other libraries and framework includes 16// Project includes 17#include "lldb/lldb-include.h" 18#include "lldb/Core/ThreadSafeSTLMap.h" 19 20namespace lldb_private { 21 22class SectionLoadList 23{ 24public: 25 //------------------------------------------------------------------ 26 // Constructors and Destructors 27 //------------------------------------------------------------------ 28 SectionLoadList () : 29 m_section_load_info () 30 { 31 } 32 33 ~SectionLoadList() 34 { 35 } 36 37 bool 38 IsEmpty() const; 39 40 void 41 Clear (); 42 43 lldb::addr_t 44 GetSectionLoadAddress (const Section *section) const; 45 46 bool 47 ResolveLoadAddress (lldb::addr_t load_addr, Address &so_addr) const; 48 49 bool 50 SetSectionLoadAddress (const Section *section, lldb::addr_t load_addr); 51 52 // The old load address should be specified when unloading to ensure we get 53 // the correct instance of the section as a shared library could be loaded 54 // at more than one location. 55 bool 56 SetSectionUnloaded (const Section *section, lldb::addr_t load_addr); 57 58 // Unload all instances of a section. This function can be used on systems 59 // that don't support multiple copies of the same shared library to be 60 // loaded at the same time. 61 size_t 62 SetSectionUnloaded (const Section *section); 63 64 65protected: 66 typedef ThreadSafeSTLMap<lldb::addr_t, const Section *> collection; 67 collection m_section_load_info; ///< A mapping of all currently loaded sections. 68 69private: 70 DISALLOW_COPY_AND_ASSIGN (SectionLoadList); 71}; 72 73} // namespace lldb_private 74 75#endif // liblldb_SectionLoadList_h_ 76