Command |
Description |
Help |
Lists GDB help information. |
HelpTopic |
List the gdb commands in related topics. |
HelpCommand |
Lists command descriptions. |
AproposSearch-word |
Search for related topics. |
Info ARGs I ARGs |
List the command line parameters of the running program. |
Info breakpoints |
List breakpoints. |
Info break |
List breakpoint numbers. |
Info breakBreakpoint-Number |
Lists information about a specified breakpoint. |
Info watchpoints |
Lists observation points. |
Info registers |
List the registers used. |
Info threads |
List the current threads. |
Info set |
Lists the options that can be set. |
Break and watch |
|
BreakFuntion BreakLine-Number |
Set a breakpoint at the specified function or row number. |
Break +Offset Break-Offset |
Set a breakpoint in the front or back of the current position. |
BreakFile: func |
InFileFileFunc. |
BreakFile: nth |
InFileTheNthSet a breakpoint for the row. |
Break *Address |
Set a breakpoint at the specified address. GenerallySource code. |
BreakLine-NumberIfCondition |
If the conditions are met, set the breakpoint at the specified position. |
BreakLineThreadThread-Number |
Interrupt in the specified thread. UseInfo threadsDisplays the thread number. |
Tbreak |
Set a temporary breakpoint. After one interruption, the breakpoint will be deleted. |
WatchCondition |
Set an observation point when the conditions are met. |
Clear ClearFunc ClearNth |
Clear FunctionFunc. ClearNthThe breakpoint at the row. |
Delete D |
Delete all breakpoints or observation points. |
DeleteBreakpoint-Number DeleteRange |
Delete the specified breakpoint, observation point. |
DisableBreakpoint-number-or-Range EnableBreakpoint-number-or-Range |
If you do not delete a breakpoint, set it to invalid or valid. Example: Display breakpoint:Info break Invalid settings:Disable 2-9 |
Enable onceBreakpoint-Number |
Set the specified breakpoint to be valid, and set it to invalid when the breakpoint is reached. |
Enable delBreakpoint-Number |
Set the specified breakpoint to be valid. Delete it when it reaches the breakpoint. |
Finish |
The execution continues until the function ends. |
Line execution |
|
Step S StepNumber-of-steps-to-perform |
Enter the next lineCodeWill enter the function. |
Next N NextNumber |
Execute the next line of code. But does not enter the function. |
Until UntilLine-Number |
Continue to run until the specified row number, function, address, and so on are reached. |
Return ReturnExpression |
The selected stack frame is displayed ). If a parameter is specified later, the value of the expression is returned. |
Stepi Si Nexti Ni |
Execute the next Assembly/CPU command. |
Info Signals Info handle HandleSignal-nameOption |
When receiving a signal, perform the following actions: nostop (do not stop the program), stop (Stop program execution), print (display signal), noprint (do not show ), pass/noignore (allow the program to process signals), nopass/ignore (do not allow the program to accept signals) |
Where |
Displays the current row number and function. |
Program Stack |
|
Backtrace BT BTInner-function-nesting-Depth BT-Outer-function-nesting-Depth |
Displays the trace of the current stack, the current function. |
Backtrace full |
Print the values of all local variables. |
FrameNumber FNumber |
Select the stack frame. |
UpNumber DownNumber |
Move the specified number of stack frames up or down. |
Info FrameADDR |
Description of the selected stack frame. |
Info ARGs Info all-Reg Info locals Info catch |
Displays the stack frame parameters, local variables, and exception handling functions.All-RegThe floating-point registers are also listed. |
Source code |
|
List L ListLine-Number ListFunction List- ListStart #, end # ListFilename: Function |
List the source code. |
Set listsizeCount Show listsize |
SetListCommand to print the number of lines in the source code. |
DirectoryDirectory-name DirDirectory-name Show Directories |
Add the specified directory before the source code path. |
Directory |
Clear the source code directory if no parameters are followed. |
Examine Variables |
|
PrintVariable PVariable PFile: Variable P'File'::Variable |
Print the value of the specified variable. |
P *Array-VaR@Length |
PrintArrary-VaRBeforeLength. |
P/xVaR |
Print Integer Variables in hexadecimal notationVaR. |
P/dVaR |
Set VariablesVaRPrint as a signed integer. |
P/uVaR |
Set VariablesVaRPrint as an unsigned integer. |
P/oVaR |
Set VariablesVaRPrint it as an octal number. |
P/TVaR X/BAddress X/B &Variable |
Print in integer binary formatVaRVariable value. |
P/CVariable |
When the character is printed. |
P/FVariable |
Print variables in floating point formatVaR. |
P/Variable |
Print the hexadecimal address. |
X/WAddress X/4B &Variable |
Print the specified address in a group of four bytes. |
CallExpression |
SimilarPrint, But do not print void. |
DisassemADDR |
Deassembles the commands in a specified address. |
Controlling GDB |
|
SetGDB-Option Value |
Set GDB options. |
Set print array on Set print array off Show print Array |
Print the array in readable form. The default value is off. |
Set print array-indexes on Set print array-indexes off Show print array-Indexes |
Print the subscript of the array element. The default value is off. |
Set print pretty on Set print pretty off Show print pretty |
Format and print the output of the C struct. |
Set print Union on Set print Union off Show print Union |
Print the Consortium in C. The default value is on. |
Set print demangle on Set print demangle off Show print demangle |
Control the printing of names in C ++. The default value is on. |
Working files |
|
Info files Info share |
Lists the current files and shared libraries. |
FileFile |
SetFileAs a program for debugging. If no parameter is specified, it is discarded. |
CoreFile |
SetFileAs a core file. If no parameter is specified, it is discarded. |
ExecFile |
SetFileAs the execution program. If no parameter is specified, it is discarded. |
SymbolFile |
SlaveFile. If no parameter is specified, it is discarded. |
LoadFile |
Dynamic LinkFileFile and read its symbol table. |
PathDirectory |
DirectoryDirectoryAdd to the path for searching executable files and symbolic files. |
Start and Stop |
|
Run R RunCommand-line-arguments Run <Infile>OUTFILE |
You can also execute programs from the beginning and redirect them. |
Continue C |
Continue until the next breakpoint or observation point. |
ContinueNumber |
Continue execution, but the current breakpoint is ignoredNumberTimes. It is useful when a breakpoint is in a loop. |
Kill |
Stop program execution. |
Quit Q |
Exit the gdb debugger. |