GDB Notes
2017.9.17
In CSDN: nancygreen's column to study "linux c/c++ GDB tutorial detailed" , I have a little perceptual understanding of GDB debugging.
Order:
Enter to execute the previous command
list show source code
- list [number] [number] shows the source code from line to line
break sets a breakpoint, which can be a function name or a line number in the source file
- info break View breakpoint information
run runs the program, the program will stop at the first breakpoint
nextSingle -step program executes only one statement, then stops
- next [number] execute n steps
print print, followed by a variable, can display the value of the variable
continue to run, the program will continue to run, and stop at breakpoints
finish finishes the function running
quit to quit GDB
2017.9.19
Command found by myself:
- delete delete breakpoint
- delete [number] delete the specified breakpoint, the number is obtained from info
Newly learned commands:
clear [number] deletes all breakpoints before the specified number
print *[array name]@[array length n] print array
2017.11.2
Newly learned commands:
set args [arguments] set command line arguments
show args prints command line arguments
Step single-step entry, encountering a function will enter the function
until stops before the loop body exits
jump [number] jumps to the nth line, but will continue to execute not a single step
return forces a return to the current function
break [line number or function name] if [expression] set a conditional breakpoint, stop when the condition is met
watch [expression] Stop when the expression is not satisfied
kill kills running programs