crashpad::MemoryMap Class Reference

Accesses information about mapped memory in another process. More...

`#include "util/linux/memory_map.h"`

## Classes

struct | Mapping
| Information about a mapped region of memory. More...

## Public Member Functions

bool | Initialize (PtraceConnection *connection)
| Initializes this object with information about the mapped memory regions in the process connected via connection. More...
const Mapping * | FindMapping (LinuxVMAddress address) const
const Mapping * | FindMappingWithName (const std::string &name) const
std::vector< const Mapping * > | FindFilePossibleMmapStarts (const Mapping &mapping) const
| Find Mappings that share a Mapping's file, mapped from offset 0. More...

## Detailed Description

Accesses information about mapped memory in another process.

The target process must be stopped to guarantee correct mappings. If the target process is not stopped, mappings may be invalid after the return from Initialize(), and even mappings existing at the time Initialize() was called may not be found.

## Member Function Documentation

## FindFilePossibleMmapStarts()

std::vector< const MemoryMap::Mapping * > crashpad::MemoryMap::FindFilePossibleMmapStarts | ( | const Mapping & | mapping | ) | const

Find Mappings that share a Mapping's file, mapped from offset 0.

Executables and libaries are typically loaded into several mappings with varying permissions for different segments. Portions of an ELF file may be mapped multiple times as part of loading the file, for example, when initializing GNU_RELRO segments. This method searches for mappings at or below mapping in memory that are mapped from the same file as mapping from offset 0.

This method is intended to help identify the possible base address for loaded modules, but it is the caller's responsibility to determine which returned mapping is correct.

If mapping does not refer to a valid mapping, an empty vector will be returned and a message will be logged. If mapping is found but does not map a file, mapping is returned in possible_starts.

Parameters

  [in] | mapping | A Mapping whose series to find the start of.

Returns
  a vector of the possible mapping starts.

## FindMapping()

const MemoryMap::Mapping * crashpad::MemoryMap::FindMapping | ( | LinuxVMAddress | address | ) | const

Returns
  The Mapping containing address or `nullptr` if no match is found. The caller does not take ownership of this object. It is scoped to the lifetime of the MemoryMap object that it was obtained from.

## FindMappingWithName()

const MemoryMap::Mapping * crashpad::MemoryMap::FindMappingWithName | ( | const std::string & | name | ) | const

Returns
  The Mapping with the lowest base address whose name is name or `nullptr` if no match is found. The caller does not take ownership of this object. It is scoped to the lifetime of the MemoryMap object that it was obtained from.

## Initialize()

bool crashpad::MemoryMap::Initialize | ( | PtraceConnection * | connection | ) |

Initializes this object with information about the mapped memory regions in the process connected via connection.

This method must be called successfully prior to calling any other method in this class. This method may only be called once.

Parameters

  [in] | connection | A connection to the process create a map for.

Returns
  `true` on success, `false` on failure with a message logged.

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

- util/linux/memory_map.h
- util/linux/memory_map.cc