1 //===-- SectionLoadList.h -----------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef liblldb_SectionLoadList_h_
11 #define liblldb_SectionLoadList_h_
17 // Other libraries and framework includes
18 #include "llvm/ADT/DenseMap.h"
20 #include "lldb/lldb-public.h"
21 #include "lldb/Host/Mutex.h"
23 namespace lldb_private {
28 //------------------------------------------------------------------
29 // Constructors and Destructors
30 //------------------------------------------------------------------
34 m_mutex (Mutex::eMutexTypeRecursive)
39 SectionLoadList (const SectionLoadList& rhs);
43 // Call clear since this takes a lock and clears the section load list
44 // in case another thread is currently using this section load list
49 operator=(const SectionLoadList &rhs);
58 GetSectionLoadAddress (const lldb::SectionSP §ion_sp) const;
61 ResolveLoadAddress (lldb::addr_t load_addr, Address &so_addr) const;
64 SetSectionLoadAddress (const lldb::SectionSP §ion_sp, lldb::addr_t load_addr, bool warn_multiple = false);
66 // The old load address should be specified when unloading to ensure we get
67 // the correct instance of the section as a shared library could be loaded
68 // at more than one location.
70 SetSectionUnloaded (const lldb::SectionSP §ion_sp, lldb::addr_t load_addr);
72 // Unload all instances of a section. This function can be used on systems
73 // that don't support multiple copies of the same shared library to be
74 // loaded at the same time.
76 SetSectionUnloaded (const lldb::SectionSP §ion_sp);
79 Dump (Stream &s, Target *target);
82 typedef std::map<lldb::addr_t, lldb::SectionSP> addr_to_sect_collection;
83 typedef llvm::DenseMap<const Section *, lldb::addr_t> sect_to_addr_collection;
84 addr_to_sect_collection m_addr_to_sect;
85 sect_to_addr_collection m_sect_to_addr;
86 mutable Mutex m_mutex;
89 } // namespace lldb_private
91 #endif // liblldb_SectionLoadList_h_