0

I used to use GDB to debug my C/C++ program. But after the server crashed and reinstalled, the GDB is not working properly. After the program reports a 'core dumped', actually the core file is not found. My flags to compile is:

CFLAGS=     -ggdb -g -pg -Wall -O2 $(shell pkg-config --libs glib-2.0 gthread-2.0 --cflags glib-2.0)

And I also set this:

ulimit -c unlimited

I already remove all object/executable files and recompile. But the core file is simply missing. Could anybody tell what is other probable reason? Thanks.

Joy
  • 9,430
  • 11
  • 44
  • 95
  • 1
    [This](http://stackoverflow.com/questions/2065912/core-dumped-but-core-file-is-not-in-current-directory) question might help. – devnull Nov 13 '13 at 08:00

1 Answers1

1

On my machine (Ubuntu 12.04), the file /proc/sys/kernel/core_pattern pipes the core dumped result to /usr/share/apport/apport:

|/usr/share/apport/apport %p %s %c

So changed to pattern:

sudo bash -c 'echo core.%e.%p > /proc/sys/kernel/core_pattern'

It works.

Reference: Unable to create a core file for my crashed program

Community
  • 1
  • 1
Joy
  • 9,430
  • 11
  • 44
  • 95