MCPcopy Create free account
hub / github.com/MJx0/KittyMemoryEx / getAppDirectory

Function getAppDirectory

KittyMemoryEx/KittyMemoryEx.cpp:381–397  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

379
380 std::vector<std::vector<ProcMap>> getFileMappings(pid_t pid,
381 const std::string &path,
382 const std::vector<ProcMap> &maps)
383 {
384 auto matched_maps = getMaps(pid, EProcMapFilter::EndWith, path, maps);
385 if (matched_maps.empty())
386 return {};
387
388 std::sort(matched_maps.begin(), matched_maps.end(), [](const auto &a, const auto &b) {
389 return a.startAddress < b.startAddress;
390 });
391
392 std::vector<std::vector<ProcMap>> mappings;
393 mappings.emplace_back();
394 mappings.back().push_back(matched_maps.front());
395
396 uint64_t expectedNextOffset = matched_maps.front().offset + matched_maps.front().length;
397
398 for (size_t i = 1; i < matched_maps.size(); ++i)
399 {
400 const auto &prev = mappings.back().back();

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected