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]
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 12,136评论 0 10
  • mean to add the formatted="false" attribute?.[ 46% 47325/...
    ProZoom阅读 7,593评论 0 3
  • NAME dnsmasq - A lightweight DHCP and caching DNS server....
    ximitc阅读 7,938评论 0 0
  • **2014真题Directions:Read the following text. Choose the be...
    又是夜半惊坐起阅读 13,409评论 0 23
  • 昨天弟弟突然问我你爱国吗?一惊!从来没有考虑过这个问题,什么是爱国?我爱国吗?就像哲学课上的问题,我从哪里来?我又...
    旅行在路上1993阅读 695评论 0 0