A few gdb useful commands
bt
backtrace, shows the stack frames (subroutine calls) that lead to the position you are now in code.
bt full
shows every frame with the values of the local variables, usually too much verbose, only do this if you want to send the output to another person to analyse.
up/down number
e.g.: up 5: goes up 5 stack frames. By default, whenever you enter gdb, you will be placed in frame number 0. With the aid of the source code of the program you should be able to select the subroutine where you want to inspect the variables.
frame number
goes straight to the selected frame.
info locals
prints the value of all local variables belonging to the current frame.
p variable
e.g.: p *cur_src. Prints the named variable. Usually C like syntax will be allowed here.
l
prints 10 lines of source code around the current line. A separate editor for source browsing is usualy better, but this can be a quick way to see the code.
help/help command
Do I need to explain that? :)
阅读(687) | 评论(0) | 转发(0) |