How to detect where my app collapsed in linux

c, debugging, linux, memory-leaks

Solution

Before you start the program, enable core dumps:

ulimit -c unlimited

(and make sure the working directory of the process is writeable by the process)

After the process crashes, it should leave behind a `core` file, which you can then examine with `gdb`:

gdb /some/bin/executable core

Alternatively, you can run the process under `gdb` when you start it - `gdb` will wake up when the process crashes.

Problem

HI, i am recently in a project in linux written in C. This app has several processes and they share a block of shared memory...When the app run for about several hrs, a process collapsed without any footprints so it's very diffficult to know what the problem was or where i can start to review the codes.... well, it could be memory overflown or pointer malused...but i dunno exactly... Do you have any tools or any methods to detect the problems... It will very appreciated if it get resolved. thanx for your advice...

Original source