Using gdb debug core_dump in cmake


龟龟是最可爱的猫

Using Cmake to generate gdb core file

in CMakeLists.txt:

set(CMAKE_BUILD_TYPE RelWithDebInfo)
set(CMAKE_BUILD_TYPE Debug)

then rebuild your project

Generate core file when meet a core dump

ulimit -c

if reult is '0', no coredump file will be generated

then :

ulimic -c unlimited

echo it into .bashrc to make it permanent

ulimit -c unlimited
cd /
mkdir corefile    ## corefile saving path
echo "/corefile/core-%e%-p%-%t" > /proc/sys/kernel/core_pattern    ##change corefile saving path

Using gdb to debug core dump

gdb [your_program] [core_file]

你可能感兴趣的:(Using gdb debug core_dump in cmake)