A core file or core dump is a dump of the application state, including all memory contents, to the disk for further inspection. If collectd crashes due to a bug, the best way to debug this is via such a file. Using a debugger it is possible where exactly the problem occurred and under which circumstances.
In order to create and use a core file, you need to take the following steps:
- Create an executable with debugging symbols embedded. You can either re-compile with special flags or install a debugging package if one is available.
- Enable creation of core files.
- Wait until the daemon crashes again.
- Inspect the core file to find the source of the problem.
In order to get meaningful information from a core file, the executable must be built with debugging symbols.
From a package
The easiest way to obtain debugging symbols is by installing an appropriate debugging package. If you're using Debian, you can install such a debugging package using:
apt-get install collectd-dbg
Other distributions may provide debugging packages, too. If you know of such a distribution, please add the information here.
If you installed collectd from source or your distribution doesn't provide a debugging package, you can recompile with the appropriate compiler flags.
The exact flags required depend on the compiler used. If you use the C compiler from the GNU Compiler Collection (GCC), the flag
-g enables the inclusion of debugging symbols. While you're at it, disable optimization using
-O0. This makes it easier to interpret the output of the debugger.
Pass the flags to the configure script using:
$ ./configure $OTHER_FLAGS CFLAGS="-g -O0"
Other compilers may differ. If you know how, please add the information here.