| 163 | } |
| 164 | |
| 165 | bool KittyMemoryMgr::dumpMemFile(const std::string &memFile, const std::string &destination) const |
| 166 | { |
| 167 | if (!isMemValid() || memFile.empty() || destination.empty()) |
| 168 | return false; |
| 169 | |
| 170 | auto fileMaps = KittyMemoryEx::getMaps(_pid, EProcMapFilter::EndWith, memFile); |
| 171 | if (fileMaps.empty()) |
| 172 | return false; |
| 173 | |
| 174 | auto firstMap = fileMaps.front(); |
| 175 | uintptr_t lastEnd = firstMap.endAddress; |
| 176 | |
| 177 | for (size_t i = 1; i < fileMaps.size(); ++i) |
| 178 | { |
| 179 | const auto &it = fileMaps[i]; |
| 180 | if (firstMap.inode != 0 && it.inode == firstMap.inode && it.startAddress == lastEnd) |
| 181 | { |
| 182 | lastEnd = it.endAddress; |
| 183 | continue; |
| 184 | } |
| 185 | break; |
| 186 | } |
| 187 | |
| 188 | return dumpMemRange(firstMap.startAddress, lastEnd, destination); |
| 189 | } |
| 190 | |
| 191 | bool KittyMemoryMgr::dumpMemELF(const ElfScanner &elf, const std::string &destination) const |
| 192 | { |