gdb: Frame Info
8.4 Information About a Frame
=============================
There are several other commands to print information about the selected
stack frame.
'frame'
'f'
When used without any argument, this command does not change which
frame is selected, but prints a brief description of the currently
selected stack frame. It can be abbreviated 'f'. With an
argument, this command is used to select a stack frame.
Selecting a Frame Selection.
'info frame'
'info f'
This command prints a verbose description of the selected stack
frame, including:
* the address of the frame
* the address of the next frame down (called by this frame)
* the address of the next frame up (caller of this frame)
* the language in which the source code corresponding to this
frame is written
* the address of the frame's arguments
* the address of the frame's local variables
* the program counter saved in it (the address of execution in
the caller frame)
* which registers were saved in the frame
The verbose description is useful when something has gone wrong
that has made the stack format fail to fit the usual conventions.
'info frame [ FRAME-SELECTION-SPEC ]'
'info f [ FRAME-SELECTION-SPEC ]'
Print a verbose description of the frame selected by
FRAME-SELECTION-SPEC. The FRAME-SELECTION-SPEC is the same as for
the 'frame' command (Selecting a Frame Selection.). The
selected frame remains unchanged by this command.
'info args [-q]'
Print the arguments of the selected frame, each on a separate line.
The optional flag '-q', which stands for 'quiet', disables printing
header information and messages explaining why no argument have
been printed.
'info args [-q] [-t TYPE_REGEXP] [REGEXP]'
Like 'info args', but only print the arguments selected with the
provided regexp(s).
If REGEXP is provided, print only the arguments whose names match
the regular expression REGEXP.
If TYPE_REGEXP is provided, print only the arguments whose types,
as printed by the 'whatis' command, match the regular expression
TYPE_REGEXP. If TYPE_REGEXP contains space(s), it should be
enclosed in quote characters. If needed, use backslash to escape
the meaning of special characters or quotes.
If both REGEXP and TYPE_REGEXP are provided, an argument is printed
only if its name matches REGEXP and its type matches TYPE_REGEXP.
'info locals [-q]'
Print the local variables of the selected frame, each on a separate
line. These are all variables (declared either static or
automatic) accessible at the point of execution of the selected
frame.
The optional flag '-q', which stands for 'quiet', disables printing
header information and messages explaining why no local variables
have been printed.
'info locals [-q] [-t TYPE_REGEXP] [REGEXP]'
Like 'info locals', but only print the local variables selected
with the provided regexp(s).
If REGEXP is provided, print only the local variables whose names
match the regular expression REGEXP.
If TYPE_REGEXP is provided, print only the local variables whose
types, as printed by the 'whatis' command, match the regular
expression TYPE_REGEXP. If TYPE_REGEXP contains space(s), it
should be enclosed in quote characters. If needed, use backslash
to escape the meaning of special characters or quotes.
If both REGEXP and TYPE_REGEXP are provided, a local variable is
printed only if its name matches REGEXP and its type matches
TYPE_REGEXP.
The command 'info locals -q -t TYPE_REGEXP' can usefully be
combined with the commands 'frame apply' and 'thread apply'. For
example, your program might use Resource Acquisition Is
Initialization types (RAII) such as 'lock_something_t': each local
variable of type 'lock_something_t' automatically places a lock
that is destroyed when the variable goes out of scope. You can
then list all acquired locks in your program by doing
thread apply all -s frame apply all -s info locals -q -t lock_something_t
or the equivalent shorter form
tfaas i lo -q -t lock_something_t