Thread: Enable core dumping

  1. #1
    UK2
    Join Date
    Sep 2003
    Posts
    112

    Enable core dumping

    Hello,

    I would like to enable core dumping. I have a program even though I have down this delibrately to cause a core dump. I don't get any core dump file in my current directory.

    Code:
    int *ptrInt = 1000;
    printf("*ptrInt %d", *ptrInt);
    I am compiling on kubuntu 8.10 linux 2.6.24.

    Code:
    I am using gcc -g example.c -o example
    I thought when you compile with the switch -g that would create a core dump file?

    Many thanks,

  2. #2
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Make sure core dumping is actually enabled. Type "ulimit -c unlimited" to enable it.

    Also, apport, if installed, might be catching those crashes. If there is a file /etc/default/apport, edit it and change the "enabled" field to 0.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  3. #3
    UK2
    Join Date
    Sep 2003
    Posts
    112
    Hello

    I didn't need to change anything in the apport file. It was already set correctly.

    However, when I used this ulimit -c 20. I don't want unlimited. I was still in the etc/default directory. The core dump didn't happen.

    However, I went to the current directory that my program is in, and executed the ulimit -c 20. The program left a core dump file.

    Does this mean that the ulimit -c always has to be done in the current directory that you have you program?

    Many thanks,

  4. #4
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    No, it means you don't have permission to write files in /etc/default.

    Also, limiting the core file size might make it unusable.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. having a core dump
    By justins in forum C Programming
    Replies: 6
    Last Post: 05-21-2008, 12:00 PM
  2. buying a laptop ; intel dual core?
    By BobMcGee123 in forum A Brief History of Cprogramming.com
    Replies: 27
    Last Post: 07-30-2006, 02:28 PM
  3. program segfaults without dumping a core
    By ladar in forum C Programming
    Replies: 4
    Last Post: 04-04-2005, 11:21 AM
  4. core dump
    By kermit in forum Linux Programming
    Replies: 0
    Last Post: 08-03-2004, 06:25 PM
  5. Core dumps
    By rotis23 in forum Linux Programming
    Replies: 4
    Last Post: 06-06-2003, 10:01 AM