HOWTO: Enable Creating Core Dumps in Linux for GDB

Bug reports and feature requests. New features can only be added to the current development version. Bug-fixes may be back-ported.

Current release: 099 / Current development: 100
Post Reply
kevin
POL Developer
Posts: 53
Joined: Wed Sep 29, 2010 3:47 pm

HOWTO: Enable Creating Core Dumps in Linux for GDB

Post by kevin »

Hi all,

When reporting bugs, especially from SVN revisions that you build yourself, it is very important to include core dumps to help us determine how and where POL crashes. Not all environments are set up to create core dumps by default, so here's a small tutorial on how to make those dumps happen.
  1. Check the upper limit for core file sizes. In bash, use:

    Code: Select all

    $ ulimit -c
    0
    
  2. If this shows 0, that means core dumps will not be created. You can enable it for your current shell session by providing the 'unlimited' parameter to the -c switch:

    Code: Select all

    $ ulimit -c unlimited
    $ ulimit -c
    unlimited
    This will allow a core dump to have unlimited size, allowing you to capture the most amount of information (stack traces for all threads, memory information, etc). Now, whenever POL gets a segmentation fault, you should see a (core dumped) message after:

    Code: Select all

    Caught SIGSEGV (Segfault).  Please post the following on http://forums.polserver.com/tracker.php :
    === CUT ===
    Build: POL099-2011-05-02 Break Everything Even Rudder (debian - 64bit)
    Last Script: ... PC: ...
    Stack Backtrace:
    [0x.....]
    [0x.....]
    [0x.....]
    === CUT ===
    Segmentation fault (core dumped)
    You should be able to find the core dump in the executable's directory as a file named core or core.<pid>.


    To automatically set the core file limit to unlimited for your user, you can add the 'ulimit -c unlimited' command to your bash profile in $HOME/.bash_profile or $HOME/.bashrc (if using bash). To enable it globally for all users, you will have to do it as root. Check online for information how to do that.
  3. When submitting core dumps for non-official builds, we will also need your POL executable file. Make sure your POL binary is compiled to include debugging information by providing the -gstabs+ switch to your linker and compiler. I believe this is the default behavior in pol-core's makefile.gcc.
You can, of course, analyze the core dump yourself. However, that is way out of scope for this mini-howto. Check google on some suggestions on analyzing core dumps for multi-threaded applications.
Post Reply