Scenario (Ubuntu 16.04):
I compile and run a C program (with -g
, I get the traditional Segmentation Fault (core dumped)
, and then (of course) there is no mythical "core" file to be found. Some digging says to modify /proc/sys/kernel/core_pattern
with a command to the effect of: echo '|tee /home/me/my_core_folder/my_core_file' | sudo tee /proc/sys/kernel/core_pattern
, and after doing this, I stop getting (core dumped)
and start only getting the plain Segmentation Fault
. I try things like gdb ./program_object_file.out core.pid
which obviously doesn't exist (I was getting desperate), and of course try the plain gdb ./a.out
followed by (gdb) core core.pid
and variants of the commands where I spam the tab
key desperately trying to get auto-completion to get me to where I need to be.
Question:
Is there a generalized way I can get to core dumps? I recognize that every machine that I touch seems to have a Michael Bay's Transformers-esque ability to reconfigure hardware and software such that no device I own can be expected to work normally out-of-the-box. Is there a simple algorithm/recipe I can follow to locate core dumps on my own machine as well as on other peoples' machines? I always find myself tutoring friends on stuff like this after no small amount of work to get things working for myself and it would be nice to be able to run a command or something to get core files dumped to the directory which the executable was run from... is there any way to do this that should work on most (I would settle for "some") Linux/Unix machines?
coredumpctl
. – meuh Oct 14 '16 at 15:16