Linux——gdb debugging and makefile

1.gdb debugging

basic instruction
-g Compile the executable file with this parameter to get the debug table
gdb ./a.out Execute the debug file a.out
b  20       Set a breakpoint on line 20
run/r run the program
n/next Execute the next instruction (passes over the function)
s/step Execute the next instruction (will enter the function)
p/print  i Check the value of the variable i
continue Continue to execute follow-up commands after power-off
quit Exit gdb debugging
other instructions
run Find where the segmentation fault occurs
finish end the current function call
set args Set the main function command line parameters
run string 1 Set the main function command line parameters
info b View breakpoint information table
ptype View variable type
bt List the stack frames of the current program that are alive
frame Switch stack frames according to the stack frame number
display Set tracking variables
undisplay Unset the tracking variable. number of tracked variables used

2.makefile

 

 

 

Guess you like

Origin blog.csdn.net/Strive_LiJiaLe/article/details/128544801