There are several other commands to print information about the selected stack frame.
frame
f
f
. With an
argument, this command is used to select a stack frame.
See Selecting a Frame.
info frame
info f
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 ]info args [-q]
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]
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]
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]
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