2

Following question describe for windows How to create minidump for my process when it crashes?

But how can I create mini crash text dump on linux ?

phuclv
  • 37,963
  • 15
  • 156
  • 475
Vivek Goel
  • 22,942
  • 29
  • 114
  • 186

2 Answers2

2

You need to write a signal handler.

Here is a slide deck on how to do it:

http://www.scribd.com/doc/3726406/Crash-N-Burn-Writing-Linux-application-fault-handlers

Here is the code form the slide deck:

https://github.com/gby/libcrash

gby
  • 14,900
  • 40
  • 57
1

I'm not sure you can get the exact same thing as a .NET MiniDump - but you will be able to produce a core dump on Linux that should get the information you are after. Make sure that core files are enabled by issuing a command such as:

ulimit -c unlimited

This will also set the maximum size of core dumps to be unlimited - you can tailor this as you wish to achieve the 'mini' aspect of your question. man ulimit is your friend here.

Then, run your process and while you it is running kill it. The signal I usually send is SIG_ABRT (Signal 6) as so:

kill -6 <pid>

If you don't know what the pid is, or how to get a pid, you probably need to read up some more on Linux.

  • 1
    Make sure your code is compiled with the `-g` flag (debug symbols) so you can make sense of the core dump. You can also use the signal's name (without the `SIG` prefix) to `kill` so you don't have to memorize the numbers: `kill -ABRT ` – Mike DeSimone Sep 19 '11 at 13:03
  • Thanks for the additions, Mike! –  Sep 19 '11 at 14:00
  • I am already generating core dump but I want to generate a small readable text dump – Vivek Goel Sep 20 '11 at 12:46