How to generate a core dump in Linux on a segmentation fault?

前端 未结 12 1228
余生分开走
余生分开走 2020-11-22 17:06

I have a process in Linux that\'s getting a segmentation fault. How can I tell it to generate a core dump when it fails?

12条回答
  •  遥遥无期
    2020-11-22 17:21

    As explained above the real question being asked here is how to enable core dumps on a system where they are not enabled. That question is answered here.

    If you've come here hoping to learn how to generate a core dump for a hung process, the answer is

    gcore 
    

    if gcore is not available on your system then

    kill -ABRT 
    

    Don't use kill -SEGV as that will often invoke a signal handler making it harder to diagnose the stuck process

提交回复
热议问题