Ask Your Question
5

Where is core dump located?

asked 2016-12-18 10:22:31 -0600

wolfv gravatar image

updated 2016-12-18 19:19:46 -0600

I am writing a little C++ program and when I run it, this error comes up:

Segmentation fault (core dumped)

Tutorials on how to debug segmentation fault suggest the command

gdb executable core

There is no "core" file in the directory of executable and not in my /var/cache/abrt-di/ Where is the core dump located?

I'm running Fedora 24. Thank you.

Update: I followed Mattdm's suggestion. Unfortunately cordumpctl is not working as expected, No coredumps found:

[wolfv@localhost examples]$  /usr/sbin/sysctl kernel.core_pattern
kernel.core_pattern = |/usr/lib/systemd/systemd-coredump %P %u %g %s %t %c %e

[wolfv@localhost examples]$  keybrd_generator "matrix1" "instantiations_scannersLEDs1" "layout2" "instantiations_layerCodes2" "sketch4"
Segmentation fault (core dumped)

[wolfv@localhost examples]$  coredumpctl list keybrd_generator 
No coredumps found.

Continuing, ... is not a core dump: File format not recognized ... backtrace finds No stack:

[wolfv@localhost examples]$  coredumpctl gdb
           PID: 32597 (keybrd_generato)
           UID: 1000 (wolfv)
           GID: 1000 (wolfv)
        Signal: 11 (SEGV)
     Timestamp: Sun 2016-12-18 12:28:35 MST (15s ago)
  Command Line: keybrd_generator matrix1 instantiations_scannersLEDs1 layout2 instantiations_layerCodes2 sketch4
    Executable: /home/wolfv/Documents/Arduino/keybrd_proj/keybrd/generator/keybrd_generator
 Control Group: /user.slice/user-1000.slice/user@1000.service/gnome-terminal-server.service
          Unit: user@1000.service
     User Unit: user@1000.service
         Slice: user-1000.slice
     Owner UID: 1000 (wolfv)
       Boot ID: b09370154f7e46c389b6766dfdc9b82d
    Machine ID: 1498952a8d994012ba42281b38b5d969
      Hostname: localhost.localdomain
      Coredump: /var/lib/systemd/coredump/core.keybrd_generato.1000.b09370154f7e46c389b6766dfdc9b82d.32597.1482089315000000000000
       Message: Process 32597 (keybrd_generato) of user 1000 dumped core.

GNU gdb (GDB) Fedora 7.11.1-86.fc24
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /home/wolfv/Documents/Arduino/keybrd_proj/keybrd/generator/keybrd_generator...done.
"/var/lib/systemd/coredump/core.keybrd_generato.1000.b09370154f7e46c389b6766dfdc9b82d.32597.1482089315000000000000" is not a core dump: File format not recognized
(gdb) list
7   #include <string>
8   //#include <vector>
9   
10  #include "file_functions.h"                     //createFolder(), openOutFile()
11  #include "Matrix.h"                             //contains matrix data
12  #include "Layout.h"                             //contains layout data
13  #include "ScancodeInstantiations.h"             //streams to output file
14  #include "generate_rowInstantiations.h"         //streams to output file
15  #include "generate_sketch.h"                    //streams to output file
16  
(gdb) backtrace
No stack.
(gdb) q

Using the above PID:

[wolfv@localhost examples]$  coredumpctl info 32597
           PID: 32597 (keybrd_generato)
           UID: 1000 (wolfv)
           GID: 1000 (wolfv)
        Signal: 11 (SEGV)
     Timestamp: Sun 2016-12-18 12:28:35 MST (6min ago)
  Command Line: keybrd_generator matrix1 instantiations_scannersLEDs1 layout2 instantiations_layerCodes2 sketch4
    Executable: /home/wolfv/Documents/Arduino/keybrd_proj/keybrd/generator/keybrd_generator
 Control Group: /user.slice/user-1000.slice/user@1000.service/gnome-terminal-server.service ...
(more)
edit retag flag offensive close merge delete

Comments

@mattdm, I have been running unlimited since before the original post.

$ ulimit -c
unlimited
wolfv gravatar imagewolfv ( 2016-12-18 18:32:39 -0600 )edit

Hmmm. If you do coredumpctl dump -o keybrd_generato.core, what does the resulting file look like? (Run file keybrd_generato.core)

mattdm gravatar imagemattdm ( 2016-12-18 18:56:45 -0600 )edit

@mattdm,

keybrd_generato.core: empty

The entire output is appended to the original post above.

wolfv gravatar imagewolfv ( 2016-12-18 19:22:28 -0600 )edit

1 Answer

Sort by » oldest newest most voted
5

answered 2016-12-18 11:29:11 -0600

mattdm gravatar image

updated 2016-12-18 17:05:09 -0600

First, shells in Fedora default to limiting corefile size to 0, which will disable them. Run ulimit -c to see this:

$ ulimit -c
0

You can change this with ulimit -c unlimited:

$ ulimit -c unlimited
$ ulimit -c 
unlimited

Having done that, we're on to the next thing, which is that...

By default, core dumps go to a service called "abrt", which can report them to Fedora developers for debugging. This is useful when Fedora-shipped packages crash, but not so useful when it's your own stuff. You can see this by looking at the kernel sysctl value core_pattern:

$ /usr/sbin/sysctl kernel.core_pattern
kernel.core_pattern = |/usr/libexec/abrt-hook-ccpp %s %c %p %u %g %t %P %I

To disable this, run:

sudo systemctl disable --now abrt-ccpp

and you will now see

$ /usr/sbin/sysctl kernel.core_pattern
kernel.core_pattern = |/usr/lib/systemd/systemd-coredump %P %u %g %s %t %c %e

You could disable that, but — actually, you probably don't want to. Take a look at man coredumpctl to see what it can do. Examples from the man page include:

EXAMPLES
   Example 1. List all the core dumps of a program named foo

       # coredumpctl list foo

   Example 2. Invoke gdb on the last core dump

       # coredumpctl gdb

   Example 3. Show information about a process that dumped core, matching
   by its PID 6654

       # coredumpctl info 6654

   Example 4. Extract the last core dump of /usr/bin/bar to a file named
   bar.coredump

       # coredumpctl -o bar.coredump dump /usr/bin/bar
edit flag offensive delete link more

Comments

Thank you for the informative answer Mattdm. Update is appended to the question.

wolfv gravatar imagewolfv ( 2016-12-18 13:58:21 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-12-18 10:22:31 -0600

Seen: 5,812 times

Last updated: Dec 18 '16