tags:

views:

52

answers:

1

We have a binary that generates coredump. So I ran the gdb command to analyze the issue. Please note the binary and code are in two different locations and we cannot build the whole binary using debugging symbols. Hence how and what details can I find from below backtarce:

gdb binary corefile

(gdb) where
#0  0x101fa37a in f1()
#1  0x10203812 in operator f2< ()
#2  0x085f6244 in f3 ()
#3  0x085f1574 in f4()
#4  0x0805b27b in sigsegv_handler ()
#5  <signal handler called>
#6  0x1018d945 in f5()
#7  0x1018e021 in f6()
..................................
#29 0x08055c5c in main ()
(gdb)

Please provide me gdb commands that I can issue to find what’s data inside each stack frame, what’s the issue probably is, where it is failing, other debugging methods if any?

A: 

You can use help in gdb. To navigate the stack : help stack

The main useful commands to navigate the stack are up and down. If you have debugging symbols at hand, you can use list to see where you are. Then to get information, you need print (abbreviated as 'p'). For example, if you have an int called myInt then you just type p myInt. With no debug info it will be harder. From your stack frame it seems that the problem is in f5(). One thing you can do is start your program inside gdb. it will stop right where the segfault happens. When you have hints about the part of your code that segfaults, you can compile this code unit with debugging options.

That the basics. Tell us more if you want more help.

my2c

neuro