linux

Improve gcore and support dumping ELF headers

Back in 2016, when life was simpler, a Fedora GDB user reported a bug (or a feature request, depending on how you interpret it) saying that GDB’s gcore command did not respect the COREFILTER_ELF_HEADERS flag, which instructs it to dump memory pages containing ELF headers. As you may or may not remember, I have already written about the broader topic of revamping GDB’s internal corefile dump algorithm; it’s an interesting read and I recommend it if you don’t know how Linux (or GDB) decides which mappings to dump to a corefile.

Memory mappings, core dumps, GDB and Linux

After spending the last weeks struggling with this, I decided to write a blog post. First, what is “this” that you are talking about? The answer is: Linux kernel’s concept of memory mapping. I found it utterly confused, beyond my expectations, and so I believe that a blog post is the write way to (a) preserve and (b) share this knowledge. So, let’s do it! First things first First, I cannot begin this post without a few acknowledgements and “thank you’s”.