#ifndef MEMORY_HH_ #define MEMORY_HH_ #include #include #include #include #include #include namespace memory { class maps { public: struct region { public: void* start; void* end; char perms[5]; std::string offset; // TODO who cares std::string dev; int inode; std::string pathname; public: region() noexcept = default; region(const region&) = default; region(region&&) = default; public: bool is_read() const noexcept { return this->perms[0] == 'r'; } bool is_write() const noexcept { return this->perms[1] == 'w'; } bool is_execute() const noexcept { return this->perms[2] == 'x'; } bool is_protected() const noexcept { return this->perms[3] == 'p'; } }; using regions_t = std::vector; private: std::string pid; regions_t regions; public: auto begin() const noexcept { return std::begin(this->regions); } auto end() const noexcept { return std::end(this->regions); } public: maps(const char* const name); maps(const maps& m) = default; maps(maps&&) = default; public: const std::string& get_pid() const noexcept { return this->pid; } const regions_t& get_regions() const noexcept { return this->regions; } }; } // namespace memory #endif