gdb debugger
First, understand the relevant information
1, the release process has two modes: "debug" and "release"
2, executable under Linux gcc / g ++ is generated by default "release" mode
3, when debugging with gdb, you must add the -g option when generating executable program
Why? In order to generate debug symbols gdb debugging information needed, if not the option, debug debug operation is not related to the use of dogs
Second, the basic operation of gdb
<L / list> followed by a number, the display lines of code before and after each of 5, then the last position to the following, each row 10 column
Followed by the function name, the code function inside the display
<R / run> Run Program
<N / next> by the process, a single execution
<S / step> stepping into, enter function calls
<B / break> break point
b # marked with a breakpoint in a row
b function names marked with a breakpoint at the head of the function
disable Num disable the line break
enable Num to enable the bank breakpoint
ib (info breakpoints) View breakpoint information
delete breakpoints [] [] indicate the internal breakpoint information without deleting all breakpoints, plus digital representation remove a breakpoint
Value <p / print> print the expression may be modified variable values or a function call by the expression
Value <i locals> Print scope of temporary variables
<C / continue> continue
<Display> value [Variable Name] tracking variables
<Bt / where> view the call stack
<Q / quit> Exit gdb
Three, readelf command calls