2024年4月16日发(作者:)
gdb调试方法说明(GDB debug method instructions)
GDB debugging essence and examples
List of column files
(GDB) list, Line1, line2
Two: executive procedure
To run the program for debugging, you can use the run command,
behind it can follow to any of the parameters of the program,
including the standard input and output descriptor (< and >)
and shell wildcards (* and? [[]]).
If you use the run command without arguments, it is useful for
GDB to use the parameters you gave to the previous run command
again.
Using the set args command, you can modify the parameters that
are sent to the program, and you can use the show args command
to see a list of its default parameters.
(GDB) set args - B - x
(GDB) show args
The backtrace command provides a backward tracking function for
the stack.
The Backtrace command generates a list that contains the
parameters that start with the recent process, so the effective
procedure and the parameters that call them.
Three: display data
Using the print command, you can check the values of each
variable.
(GDB) print p (P is a variable name)
The whatis command displays the type of a variable
(GDB) whatis p
Type = int *
Print is a powerful command of GDB that uses it to display any
valid expressions in the language being debugged. In addition
to containing variables in your program, expressions can
include the following:
L calls to functions in a program
(GDB) print find_entry (1,0)
L data structures and other complex objects
(GDB) print *table_start
$8={e=reference= '000', location=0x0, next=0x0}


发布评论