Unable to create a core file for my crashed program

前端 未结 4 2329
遥遥无期
遥遥无期 2021-02-20 13:30

I am using Ubuntu 12.04 LTS. I wrote a simple program as follows to create crash

// null.c
#include

int main()
{
   int *p = NULL;
   int k=*p;
          


        
相关标签:
4条回答
  • 2021-02-20 14:12

    you do not need to use core pattern. its just dumps in that format %e.%p

    what you need to do is #ulimit -c unlimited

    and check #ulimit -a

    and confirm if core file size is set properly. You will get the core as core.pid after that.

    0 讨论(0)
  • 2021-02-20 14:20

    You need to adjust your core dump size limit with following command:

    ulimit -S -c maximum-core-dump-size

    The the value is given in Kb.

    0 讨论(0)
  • 2021-02-20 14:31

    Your real question appears to be not "where is my core dump", but rather "how can I modify /proc/sys/kernel/core_pattern".

    sudo bash -c 'echo core.%e.%p > /proc/sys/kernel/core_pattern'
    

    should do the trick.

    0 讨论(0)
  • 2021-02-20 14:36

    My understanding is that using ulimit is not permanent, i.e. if you reboot then the limit goes back to 0. To have unlimited permanent, you need to change /etc/security/limits.conf. Similarly for core pattern etc, change /etc/sysctl.conf.

    0 讨论(0)
提交回复
热议问题