MemoryAccessor 1
A command-line front-end for exploring virtual memory of a linux process by accessing /proc/PID/mem file.
Loading...
Searching...
No Matches
SegmentInfo Class Reference

A class to store the information of a memory segment. More...

#include <segmentinfo.h>

Public Member Functions

uint8_t DecodePermissions (const std::string &permissions) noexcept
 Get permissions stored to mode_ field from std::string.
std::string EncodePermissions () const noexcept
 Get permissions stored as std::string processed from the mode_ field.

Public Attributes

size_t start_ {0}
 Start address.
size_t end_ {0}
 End address (first address that does not belong to the segment)
size_t offset_ {0}
 (e.g., executable from ROM)
uint8_t mode_ {0}
 is 1 (private - shared)
uint32_t major_id_ {0}
 Major ID.
uint32_t minor_id_ {0}
 Minor ID.
size_t inode_id_ {0}
 ROM)
std::string path_
 Path or name.

Detailed Description

A class to store the information of a memory segment.

This class stores the information of one memory segment in a way it is given in /proc/PID/maps file. It uses its own style of storing the permissions though.

Member Function Documentation

◆ DecodePermissions()

uint8_t SegmentInfo::DecodePermissions ( const std::string & permissions)
noexcept

Get permissions stored to mode_ field from std::string.

Parameters
[in]permissionsPermissions stored as std::string, for example, "rwxp". Some additional characters after are not prohibited.
Returns
Exit code, 0 is success, 1 is failure.

Store permissions of a memory segment from std::string to mode_ field. In case of an error permissions are not stored and 1 is returned.

◆ EncodePermissions()

std::string SegmentInfo::EncodePermissions ( ) const
noexcept

Get permissions stored as std::string processed from the mode_ field.

Returns
Permissions stored as std::string, for example, "rwxp".

Process permissions of a memory segment from the mode_ field to std::string.

Member Data Documentation

◆ inode_id_

size_t SegmentInfo::inode_id_ {0}

ROM)

Inode ID if it is a file mapping (e.g., executable from

◆ mode_

uint8_t SegmentInfo::mode_ {0}

is 1 (private - shared)

Permissions, are stored as 0000rwx(p/s), where p is 0, s

◆ offset_

size_t SegmentInfo::offset_ {0}

(e.g., executable from ROM)

Offset from the start of the file if it is a file mapping


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