当前位置:Gxlcms > 数据库问题 > Gdb+Coredump learning

Gdb+Coredump learning

时间:2021-07-01 10:21:17 帮助过:2人阅读

udump -a | grep core

[root@os-t1 ~]# ulimit -a | grep core

core file size          (blocks, -c) 0

[root@os-t1 ~]#

 

Use the following command to set the limit of coredump file size:

ulimit -c unlimited

[root@os-t1 ~]# ulimit -c unlimited

[root@os-t1 ~]# ulimit -a | grep core

core file size          (blocks, -c) unlimited

[root@os-t1 ~]#

 

       Make sure the program is generated by gcc/g++ using flags of -O0 and -g. After running the program that will fail will generate the Core.[0-9]+ file after exit, this file contains the stack/mem/register infos.

       use gdb to restore the environment when the bug appears and program exits:

gdb program core.[0-9]+

gdb will point to the line will the program exits, use bt to view the stack infos, use up to get to the upper entry of the stack. Easy to find the problem in the program we write.

Gdb+Coredump learning

标签:

人气教程排行