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]
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi閱讀 7,872評論 0 10
  • mean to add the formatted="false" attribute?.[ 46% 47325/...
    ProZoom閱讀 3,224評論 0 3
  • NAME dnsmasq - A lightweight DHCP and caching DNS server....
    ximitc閱讀 2,996評論 0 0
  • **2014真題Directions:Read the following text. Choose the be...
    又是夜半驚坐起閱讀 11,224評論 0 23
  • 昨天弟弟突然問我你愛國嗎?一驚!從來沒有考慮過這個(gè)問題,什么是愛國?我愛國嗎?就像哲學(xué)課上的問題,我從哪里來?我又...
    旅行在路上1993閱讀 123評論 0 0

友情鏈接更多精彩內(nèi)容