LLDB  mainline
Classes | Public Types | Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
lldb_private::IRMemoryMap Class Reference

Encapsulates memory that may exist in the process but must also be available in the host process. More...

#include "lldb/Expression/IRMemoryMap.h"

Inheritance diagram for lldb_private::IRMemoryMap:
Inheritance graph
Collaboration diagram for lldb_private::IRMemoryMap:
Collaboration graph


struct  Allocation

Public Types

enum  AllocationPolicy : uint8_t { eAllocationPolicyInvalid, eAllocationPolicyHostOnly, eAllocationPolicyMirror, eAllocationPolicyProcessOnly }

Public Member Functions

 IRMemoryMap (lldb::TargetSP target_sp)
 ~IRMemoryMap ()
lldb::addr_t Malloc (size_t size, uint8_t alignment, uint32_t permissions, AllocationPolicy policy, bool zero_memory, Status &error)
void Leak (lldb::addr_t process_address, Status &error)
void Free (lldb::addr_t process_address, Status &error)
void WriteMemory (lldb::addr_t process_address, const uint8_t *bytes, size_t size, Status &error)
void WriteScalarToMemory (lldb::addr_t process_address, Scalar &scalar, size_t size, Status &error)
void WritePointerToMemory (lldb::addr_t process_address, lldb::addr_t address, Status &error)
void ReadMemory (uint8_t *bytes, lldb::addr_t process_address, size_t size, Status &error)
void ReadScalarFromMemory (Scalar &scalar, lldb::addr_t process_address, size_t size, Status &error)
void ReadPointerFromMemory (lldb::addr_t *address, lldb::addr_t process_address, Status &error)
bool GetAllocSize (lldb::addr_t address, size_t &size)
void GetMemoryData (DataExtractor &extractor, lldb::addr_t process_address, size_t size, Status &error)
lldb::ByteOrder GetByteOrder ()
uint32_t GetAddressByteSize ()
ExecutionContextScopeGetBestExecutionContextScope () const
lldb::TargetSP GetTarget ()

Protected Member Functions

lldb::ProcessWP & GetProcessWP ()

Private Types

typedef std::map< lldb::addr_t, AllocationAllocationMap

Private Member Functions

lldb::addr_t FindSpace (size_t size)
bool ContainsHostOnlyAllocations ()
AllocationMap::iterator FindAllocation (lldb::addr_t addr, size_t size)
bool IntersectsAllocation (lldb::addr_t addr, size_t size) const

Static Private Member Functions

static bool AllocationsIntersect (lldb::addr_t addr1, size_t size1, lldb::addr_t addr2, size_t size2)

Private Attributes

lldb::ProcessWP m_process_wp
lldb::TargetWP m_target_wp
AllocationMap m_allocations

Detailed Description

Encapsulates memory that may exist in the process but must also be available in the host process.

This class encapsulates a group of memory objects that must be readable or writable from the host process regardless of whether the process exists. This allows the IR interpreter as well as JITted code to access the same memory. All allocations made by this class are represented as disjoint intervals.

Point queries against this group of memory objects can be made by the address in the tar at which they reside. If the inferior does not exist, allocations still get made-up addresses. If an inferior appears at some point, then those addresses need to be re-mapped.

Definition at line 34 of file IRMemoryMap.h.

Member Typedef Documentation

◆ AllocationMap

Definition at line 120 of file IRMemoryMap.h.

Member Enumeration Documentation

◆ AllocationPolicy


It is an error for an allocation to have this policy.


This allocation was created in the host and will never make it into the process.

It is an error to create other types of allocations while such allocations exist.


The intent is that this allocation exist both in the host and the process and have the same content in both.


The intent is that this allocation exist only in the process.

Definition at line 39 of file IRMemoryMap.h.

Constructor & Destructor Documentation

◆ IRMemoryMap()

IRMemoryMap::IRMemoryMap ( lldb::TargetSP  target_sp)

Definition at line 22 of file IRMemoryMap.cpp.

References m_process_wp.

◆ ~IRMemoryMap()

IRMemoryMap::~IRMemoryMap ( )

Definition at line 27 of file IRMemoryMap.cpp.

References lldb_private::Status::Clear(), Free(), m_allocations, and m_process_wp.

Member Function Documentation

◆ AllocationsIntersect()

bool IRMemoryMap::AllocationsIntersect ( lldb::addr_t  addr1,
size_t  size1,
lldb::addr_t  addr2,
size_t  size2 

Definition at line 212 of file IRMemoryMap.cpp.

Referenced by IntersectsAllocation().

◆ ContainsHostOnlyAllocations()

bool lldb_private::IRMemoryMap::ContainsHostOnlyAllocations ( )

◆ FindAllocation()

IRMemoryMap::AllocationMap::iterator IRMemoryMap::FindAllocation ( lldb::addr_t  addr,
size_t  size 

Definition at line 165 of file IRMemoryMap.cpp.

References LLDB_INVALID_ADDRESS, and m_allocations.

Referenced by GetAllocSize(), GetMemoryData(), ReadMemory(), and WriteMemory().

◆ FindSpace()

lldb::addr_t IRMemoryMap::FindSpace ( size_t  size)

◆ Free()

void IRMemoryMap::Free ( lldb::addr_t  process_address,
Status error 

◆ GetAddressByteSize()

uint32_t IRMemoryMap::GetAddressByteSize ( )

◆ GetAllocSize()

bool IRMemoryMap::GetAllocSize ( lldb::addr_t  address,
size_t &  size 

◆ GetBestExecutionContextScope()

ExecutionContextScope * IRMemoryMap::GetBestExecutionContextScope ( ) const

◆ GetByteOrder()

lldb::ByteOrder IRMemoryMap::GetByteOrder ( )

◆ GetMemoryData()

void IRMemoryMap::GetMemoryData ( DataExtractor extractor,
lldb::addr_t  process_address,
size_t  size,
Status error 

◆ GetProcessWP()

lldb::ProcessWP& lldb_private::IRMemoryMap::GetProcessWP ( )

Definition at line 86 of file IRMemoryMap.h.

References m_process_wp.

Referenced by lldb_private::IRExecutionUnit::GetRunnableInfo().

◆ GetTarget()

lldb::TargetSP lldb_private::IRMemoryMap::GetTarget ( )

Definition at line 80 of file IRMemoryMap.h.

References m_target_wp.

Referenced by IRForTarget::CreateResultVariable().

◆ IntersectsAllocation()

bool IRMemoryMap::IntersectsAllocation ( lldb::addr_t  addr,
size_t  size 
) const

Definition at line 183 of file IRMemoryMap.cpp.

References AllocationsIntersect(), LLDB_INVALID_ADDRESS, and m_allocations.

◆ Leak()

void IRMemoryMap::Leak ( lldb::addr_t  process_address,
Status error 

◆ Malloc()

lldb::addr_t IRMemoryMap::Malloc ( size_t  size,
uint8_t  alignment,
uint32_t  permissions,
AllocationPolicy  policy,
bool  zero_memory,
Status error 

◆ ReadMemory()

void IRMemoryMap::ReadMemory ( uint8_t *  bytes,
lldb::addr_t  process_address,
size_t  size,
Status error 

◆ ReadPointerFromMemory()

void IRMemoryMap::ReadPointerFromMemory ( lldb::addr_t address,
lldb::addr_t  process_address,
Status error 

◆ ReadScalarFromMemory()

void IRMemoryMap::ReadScalarFromMemory ( Scalar scalar,
lldb::addr_t  process_address,
size_t  size,
Status error 

◆ WriteMemory()

void IRMemoryMap::WriteMemory ( lldb::addr_t  process_address,
const uint8_t *  bytes,
size_t  size,
Status error 

◆ WritePointerToMemory()

void IRMemoryMap::WritePointerToMemory ( lldb::addr_t  process_address,
lldb::addr_t  address,
Status error 

◆ WriteScalarToMemory()

void IRMemoryMap::WriteScalarToMemory ( lldb::addr_t  process_address,
Scalar scalar,
size_t  size,
Status error 

Member Data Documentation

◆ m_allocations

AllocationMap lldb_private::IRMemoryMap::m_allocations

◆ m_process_wp

lldb::ProcessWP lldb_private::IRMemoryMap::m_process_wp

◆ m_target_wp

lldb::TargetWP lldb_private::IRMemoryMap::m_target_wp

The documentation for this class was generated from the following files: