| 189 | } |
| 190 | |
| 191 | bool KittyMemoryMgr::dumpMemELF(const ElfScanner &elf, const std::string &destination) const |
| 192 | { |
| 193 | if (!isMemValid() || !elf.base() || !elf.loadSize()) |
| 194 | return false; |
| 195 | |
| 196 | bool dumped = dumpMemRange(elf.base(), elf.end(), destination); |
| 197 | if (dumped && elf.isFixedBySoInfo()) |
| 198 | { |
| 199 | KittyIOFile destIO(destination, O_WRONLY); |
| 200 | destIO.open(); |
| 201 | KT_ElfW(Ehdr) fixedHdr = elf.header(); |
| 202 | destIO.pwrite(0, &fixedHdr, sizeof(fixedHdr)); |
| 203 | destIO.close(); |
| 204 | } |
| 205 | |
| 206 | return dumped; |
| 207 | } |