Segmentation Fault, no core dump

17,221

Solution 1

if your program runs as root (or with root capabilities) check:

cat /proc/sys/fs/suid_dumpable

or if program is a daemon check:

getsebool allow_daemons_dump_core

Solution 2

There could be several reasons

  • no write access to the directory
  • the program changes the working directory
    look for the core in other places too
  • disk is full
  • ulimit is set in one shell and the program is started in a different shell or environment

Solution 3

To get around the shell session issue, providing you don't object to being root to test:

#ifdef DEBUG
    // Enable core dumps
    struct rlimit corelim;

    corelim.rlim_cur = -1;
    corelim.rlim_max = -1;

    if (setrlimit (RLIMIT_CORE, &corelim) != 0)
    {
        log_error ("Couldn't set core limit");
    }
#endif
Share:
17,221
OBLE Codemonkey
Author by

OBLE Codemonkey

Updated on June 04, 2022

Comments

  • OBLE Codemonkey
    OBLE Codemonkey almost 2 years

    I am consistently getting a segmentation fault in my program, yet no core dump files are generated. ulimit shows a value of unlimited, did ulimit -c unlimited just to be sure, and it appears to be fine. Any ideas?