I'm trying to generate a core dump of a running process (without killing it, just like the gdb command gcore
) using python.
The objective is, from a given pid, to generate a gdb-readable core dump.
Core dumps are in the ELF format and I've not been able to find python libraries to create ELF files from scratch (the elffile
library is outdated and other libraries only allow reading ELF files).
And even if it existed, I am not able to find precise explanations on what portions of memory are written in the core dump file and what portions aren't.
My question is, can I generate core dumps through python easily, or do I need to re-write the gcore
command in python entirely (meaning writing the ELF file manually)?