joaomlneto / procmap

C++ wrapper around /proc/self/maps

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Status

procmap

A simple C++ wrapper around /proc/self/maps

This tool makes it simpler to help visualize the memory map of your process.

It's super simplistic and was created to suit my own needs. Hopefully it provides a good start for you and you'll enhance it with a few more options (and submit a PR!) :-)

Examples

Reading /proc/self/maps

Couldn't be easier.

MemoryMap m;

Visualizing /proc/self/maps

MemoryMap m;
m.print();

screenshot 2018-11-05 at 19 04 40

Iterating through the entries and selecting only those that are writeable

MemoryMap map;
for (auto &segment : map) {
  if (segment.isWriteable()) {
    segment.print();
  }
}

image

Reference

MemoryMap is basically a collection of MemorySegments. Use it as you would a std::vector.

MemorySegment represents a single entry/line in /proc/*/maps. It provides a plethora of utility functions to make life more pleasant. Check the header file for a complete list.

Suggestions / Complaints

Open an issue! :-)

Contributing

PRs are more than welcome.