Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

getting stacktrace from core dump

Tags:

linux

coredump

How can I get a stack trace from a core dump file? The file is about 14 mb and is generated after my application exits saying "segmentation fault"

I'm on Red Hat 5.5

like image 812
user391986 Avatar asked Apr 21 '11 14:04

user391986


People also ask

How do I analyze a core dump file?

With a core file, we can use the debugger (GDB) to inspect the state of the process at the moment it was terminated and to identify the line of code that caused the problem. That's a situation where a core dump file could be produced, but it's not by default.

How do I debug a core dump?

You just need a binary (with debugging symbols included) that is identical to the one that generated the core dump file. Then you can run gdb path/to/the/binary path/to/the/core/dump/file to debug it. When it starts up, you can use bt (for backtrace) to get a stack trace from the time of the crash.

How do I open a core dump file?

Select Run | Open Core Dump from the main menu or call this action from Help | Find Action ( Ctrl+Shift+A ). If there are no Core Dump Debug configurations in the project, the Open Core Dump dialog will be shown right away. Otherwise, select New Core Dump from the popup menu.


1 Answers

gdb /usr/bin/myapp.binary corefile 

Then, use one of:

(gdb) bt (gdb) bt full (gdb) info threads (gdb) thread apply all bt (gdb) thread apply all bt full 

Note that installing debug symbols for the related libraries will help

like image 88
sehe Avatar answered Nov 04 '22 18:11

sehe