Debugging with GDB (September 2007)
94 Debugging with GDB
(gdb) whatis v
type = struct complex
(gdb) ptype v
type = struct complex {
double real;
double imag;
}
As with whatis, using ptype without an argument re fers to the type of $, the
last value in the value history.
info types regexp
info types
Print a brief description of all types whose names match regexp (or all types in
your program, if you supply no argument). Each complete type name is matched
as though it were a complete line; thus, ‘i type value’ gives information on
all types in your program whose names include the string value, but ‘i type
^value$’ gives information only on types whose complete name is value.
This command differs from ptype in two ways: first, like whatis, it does not
print a detailed description; second, it lists all source files where a type is
defined.
info source
Show the name of the current source file—that is, the source file for the function
containing the current point of execution—and the language it was written in.
info sources
Print the names of all source files in your program for which there is debugging
information, organized into two lists: files whose symbols have already been
read, and files whose symbols will be read when needed.
info functions
Print the names and data types of all defined functions.
info functions regexp
Print the names and data types of all defined functions whose names contain a
match for regular expression regexp. Thus, ‘info fun step’ finds all functions
whose names include step; ‘info fun ^step’ finds those whose names start
with step.
info variables
Print the names and data types of all variables that are declared outside of
functions (i.e., excluding local variables).
info variables regexp
Print the names and data types of all variables (exc ept for local variables) whose
names contain a match for regular expression regexp.
Some systems allow individual object files that make up your program to be
replaced without stopping and restarting your program. For example, in Vx-
Works you can simply recompile a defective object file and keep on running.
If you are running on one of these systems, you can allow GDB to reload the
symbols for automatically relinked modules: