I'd like to extract the stacktrace from crashing applications with large memory footprints. Ideally, the user wouldn't need to wait while the entire coredump is written to disk.
My current thinking is to install a coredump hook at /proc/sys/kernel/core_pattern
which would parse the incoming coredump via stdin and extract just the stacktrace. But, creating a complete copy of the coredump in memory would be impractical, so a streaming approach would be better.
I'm new to the ELF format (http://en.wikipedia.org/wiki/Executable_and_Linkable_Format) and was wondering if it might support a streaming parser. I haven't written a streaming parser of any kind yet - I'm familiar with the concept but need pointers on how to analyze a format for stream-ability.
As a first attempt, I tried:
cat core | readelf -a
But, it doesn't seem like readelf supports input from stdin.
I also found this python elf parser, but it appears at first glance like it reads the entire elf into memory: https://github.com/eliben/pyelftools
But, if needed, maybe I could use their implementation as reference for a streaming parser.
Thanks a bunch!