1 //===-- SectionLoadHistory.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_SectionLoadHistory_h_
11 #define liblldb_SectionLoadHistory_h_
18 #include "lldb/lldb-public.h"
19 #include "lldb/Host/Mutex.h"
21 namespace lldb_private {
23 class SectionLoadHistory
27 // Pass eStopIDNow to any function that takes a stop ID to get
29 eStopIDNow = UINT32_MAX
31 //------------------------------------------------------------------
32 // Constructors and Destructors
33 //------------------------------------------------------------------
34 SectionLoadHistory () :
35 m_stop_id_to_section_load_list(),
36 m_mutex (Mutex::eMutexTypeRecursive)
42 // Call clear since this takes a lock and clears the section load list
43 // in case another thread is currently using this section load list
48 GetCurrentSectionLoadList ();
57 GetLastStopID() const;
59 // Get the section load address given a process stop ID
61 GetSectionLoadAddress (uint32_t stop_id,
62 const lldb::SectionSP §ion_sp);
65 ResolveLoadAddress (uint32_t stop_id,
66 lldb::addr_t load_addr,
70 SetSectionLoadAddress (uint32_t stop_id,
71 const lldb::SectionSP §ion_sp,
72 lldb::addr_t load_addr,
73 bool warn_multiple = false);
75 // The old load address should be specified when unloading to ensure we get
76 // the correct instance of the section as a shared library could be loaded
77 // at more than one location.
79 SetSectionUnloaded (uint32_t stop_id,
80 const lldb::SectionSP §ion_sp,
81 lldb::addr_t load_addr);
83 // Unload all instances of a section. This function can be used on systems
84 // that don't support multiple copies of the same shared library to be
85 // loaded at the same time.
87 SetSectionUnloaded (uint32_t stop_id,
88 const lldb::SectionSP §ion_sp);
97 GetSectionLoadListForStopID (uint32_t stop_id, bool read_only);
99 typedef std::map<uint32_t, lldb::SectionLoadListSP> StopIDToSectionLoadList;
100 StopIDToSectionLoadList m_stop_id_to_section_load_list;
101 mutable Mutex m_mutex;
104 DISALLOW_COPY_AND_ASSIGN (SectionLoadHistory);
107 } // namespace lldb_private
109 #endif // liblldb_SectionLoadHistory_h_