title: Core dump in Linux
body: <p>I want to create a core dump whenever my process crashes. Currently I am following this approach:</p>
  
  <ol>
  <li>Build a special "debug" version of the program using "-g" of gcc/g++.</li>
  <li>Execute "ulimit -c unlimited"</li>
  <li>Now we get the core dump whenever the program crashes.</li>
  </ol>
  
  <p>But I want to minimize the number of steps so that:</p>
  
  <ul>
  <li>Core dump should always get created. Even if it is "release" build. The user should not be asked to execute the command "<code>ulimit -c unlimited</code>" manually.</li>
  <li>That core dump's backtrace should be able to give the file, function, line number of the calls. That is stack trace in a human readable form.</li>
  <li>I don't want to build the program as a debug build with "-g". Or at least it shouldn't contain any other debugging information which is not required to produce the human readable stack trace. Because this would be a release build of the program.</li>
  </ul>
  
  <p>So I have two questions:</p>
  
  <ol>
  <li>How to create a core dump in the "release" build of a program?</li>
  <li>Always. Without manually executing the "<code>ulimit -c unlimited</code>"</li>
  </ol>