1

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)?

jps
  • 20,041
  • 15
  • 75
  • 79
Pixmaip
  • 11
  • 1
  • 2
  • Does this answer your question? [Is it possible to get a core dump of a running process and its symbol table?](https://stackoverflow.com/questions/68160/is-it-possible-to-get-a-core-dump-of-a-running-process-and-its-symbol-table) – quamrana Jun 08 '20 at 09:43
  • Not really, because I'm trying to get python to create the core dump, as the host running the script may not have the ```gcore``` command installed – Pixmaip Jun 08 '20 at 09:44
  • send a SIGABRT signal to call the python3 default handler which creates a core dump by default... – R Yoda Jul 13 '23 at 10:47

0 Answers0