Where to Find Core Dumps from Gcc and G++ Compiled Code?

I compiled some C code, once with gcc, and then with g++, so I got two output executable files. When executing both files I found that it told me:

Segmentation fault (core dumped)

But there is no sign of any core dumps in /var/crash to do with this (only old stuff) so where would they be (I wouldn't expect them to be in there, but just thought I'd mention that I had checked)? I am running Ubuntu GNOME 16.04 with GNOME 3.20.

2

1 Answer

Core dumping is disabled by default in Ubuntu by setting the maximum dumping file size to 0 for all users.

You can check this by:

ulimit -c

By default it would show 0.

Now to enable core dumping, set the size to the value you want (or unlimited).

For example, setting the maximum dumping file size as 4 KB:

ulimit -c 8

-c takes block numbers with each block being 512 Bytes.

Setting to unlimited (Not recommended):

ulimit -c unlimited

This will change the limit for the current user and not permanently. To make the changes effective for users selectively and permanently, you should edit the /etc/security/limits.conf file and set your desired values.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Elena Rostova

Elena Rostova

Lead Health, Wellness & Medical Journalist

Elena Rostova holds a Master's degree in Public Health Journalism. She covers groundbreaking medical research, holistic wellness trends, mental health awareness, and nutritional science.

Share this article
Twitter Facebook Pinterest