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#include "lldb/Utility/Locked.h"
14
15#include <map>
16#include <mutex>
17#include <optional>
18
19namespace lldb_private {
21public:
23
24 /// Remove all cached entries. Should be called whenever
25 /// Process resumes execution of the inferior.
26 void Clear();
27
28 /// Return a MemoryRegionInfo that covers \p load_addr,
29 /// returns empty optional if there is no entry.
30 std::optional<MemoryRegionInfo> GetMemoryRegion(lldb::addr_t load_addr);
31
32 /// Add a MemoryRegionInfo to the collection.
33 void AddRegion(const MemoryRegionInfo &region_info);
34
35 size_t GetSize();
36
37private:
39};
40} // namespace lldb_private
41
42#endif // LLDB_TARGET_MEMORYREGIONINFOCACHE_H
Bundles a value of type T with the Mutex that guards it.
Definition Locked.h:178
void Clear()
Remove all cached entries.
void AddRegion(const MemoryRegionInfo &region_info)
Add a MemoryRegionInfo to the collection.
Guarded< std::map< lldb::addr_t, MemoryRegionInfo >, std::mutex > m_region_infos
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