Core dump file analysis [duplicate]

陌路散爱 提交于 2019-11-26 12:34:48

You just need a binary (with debugging symbols included) that is identical to the one that generated the core. Then you can run gdb path/to/the/binary path/to/the/core to debug it.

When it starts up, you can use bt (for backtrace) to get a stack trace from the time of the crash. In the backtrace, each function invocation is given a number. You can use frame number (replacing number with the corresponding number in the stack trace) to select a particular stack frame. You can then use list to see code around that function, and info locals to see the local variables. You can also use print name_of_variable (replacing "name_of_variable" with a variable name) to see its value.

Typing help within GDB will give you a prompt that will let you see additional commands.

Mayank

Steps to debug coredump using GDB:

Some generic help:

gdb start GDB, with no debugging les

gdb program begin debugging program

gdb program core debug coredump core produced by program

gdb --help describe command line options

1- First of all find the directory where the corefile is generated.

2- Then use ls -ltr command in the directory to find the latest generated corefile.

3- To load the corefile use

gdb binary path of corefile

This will load the corefile.

4- Then you can get the information using bt command. For detailed backtrace use bt full.

5- To print the variables use print variable-name or p variable-name

6- To get any help on GDB, use the help option or use apropos search-topic

7- Use frame frame-number to go to the desired frame number.

8- Use up n and down n commands to select frame n frames up and select frame n frames down respectively.

9- To stop GDB, use quit or q.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!