LLDB mainline
MemoryRegionInfoCache.h
Go to the documentation of this file.
1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLDB_TARGET_MEMORYREGIONINFOCACHE_H
10#define LLDB_TARGET_MEMORYREGIONINFOCACHE_H
11
13
14#include <map>
15#include <mutex>
16#include <optional>
17
18namespace lldb_private {
20public:
22
23 /// Remove all cached entries. Should be called whenever
24 /// Process resumes execution of the inferior.
25 void Clear();
26
27 /// Return a MemoryRegionInfo that covers \p load_addr,
28 /// returns empty optional if there is no entry.
29 std::optional<MemoryRegionInfo> GetMemoryRegion(lldb::addr_t load_addr);
30
31 /// Add a MemoryRegionInfo to the collection.
32 void AddRegion(const MemoryRegionInfo &region_info);
33
34 size_t GetSize();
35
36private:
37 std::map<lldb::addr_t, MemoryRegionInfo> m_region_infos;
38 std::mutex m_mutex;
39};
40} // namespace lldb_private
41
42#endif // LLDB_TARGET_MEMORYREGIONINFOCACHE_H
void Clear()
Remove all cached entries.
std::map< lldb::addr_t, MemoryRegionInfo > m_region_infos
void AddRegion(const MemoryRegionInfo &region_info)
Add a MemoryRegionInfo to the collection.
std::optional< MemoryRegionInfo > GetMemoryRegion(lldb::addr_t load_addr)
Return a MemoryRegionInfo that covers load_addr, returns empty optional if there is no entry.
A class that represents a running process on the host machine.
uint64_t addr_t
Definition lldb-types.h:80