What is a good way to dump a Linux core file from inside a process?

We have a server (written in C and C++) that currently catches a SEGV and dumps some internal info to a file. I would like to generate a core file and write it to disk at the time we catch the SEGV, so our support reps and customers don't have to fuss with ulimit and then wait for the crash to happen again in order to get a core file. We have used the abort function in the past, but it is subject to the ulimit rules and doesn't help.

We have some legacy code that reads /proc/pid/map and manually generates a core file, but it is out of date, and doesn't seem very portable (for example, I'm guessing it would not work in our 64 bit builds). What is the best way to generate and dump a core file in a Linux process?


Google has a library for generating coredumps from inside a running process called google-coredumper. This should ignore ulimit and other mechanisms.

The documentation for the call that generates the core file is here. According to the documentation, it seems that it is feasible to generate a core file in a signal handler, though it is not guaranteed to always work.

Need Your Help

Mercurial Named Branches + Multiple Repositories for CI Releases

version-control mercurial jenkins continuous-integration

Our development group has a group of mercurial repositories for each of our projects that we're working on. Each repository has several named branches: a development branch and the last two stable

vaadin push not working on label

multithreading vaadin

I have an async-thread running that is periodically checking a database for an insert to occur. When the record is found, the UI is then loaded.