Debugger Info (The GNU Awk User’s Guide)
Next: Miscellaneous Debugger Commands, Previous: Execution Stack, Up: List of Debugger Commands [Contents][Index]
14.3.5 Obtaining Information About the Program and the Debugger State
Besides looking at the values of variables, there is often a need to get other sorts of information about the state of your program and of the debugging environment itself. The gawk debugger has one command that provides this information, appropriately called info. info is used with one of a number of arguments that tell it exactly what you want to know:
info what
i what
The value for what should be one of the following:
argsList arguments of the selected frame.
breakList all currently set breakpoints.
displayList all items in the automatic display list.
frameGive a description of the selected stack frame.
functionsList all function definitions including source file names and line numbers.
localsList local variables of the selected frame.
sourcePrint the name of the current source file. Each time the program stops, the current source file is the file containing the current instruction. When the debugger first starts, the current source file is the first file included via the
-foption. The ‘list filename:lineno’ command can be used at any time to change the current source.sourcesList all program sources.
variablesList all global variables.
watchList all items in the watch list.
Additional commands give you control over the debugger, the ability to save the debugger’s state, and the ability to run debugger commands from a file. The commands are:
option [name[=value]]
o [name[=value]]
Without an argument, display the available debugger options and their current values. ‘option name’ shows the current value of the named option. ‘option name=value’ assigns a new value to the named option. The available options are:
history_sizeSet the maximum number of lines to keep in the history file
./.gawk_history. The default is 100.listsizeSpecify the number of lines that
listprints. The default is 15.outfileSend
gawkoutput to a file; debugger output still goes to standard output. An empty string ("") resets output to standard output.promptChange the debugger prompt. The default is ‘
gawk>’.save_history[on|off]Save command history to file
./.gawk_history. The default ison.save_options[on|off]Save current options to file
./.gawkrcupon exit. The default ison. Options are read back into the next session upon startup.trace[on|off]Turn instruction tracing on or off. The default is
off.
save filename
Save the commands from the current session to the given file name, so that they can be replayed using the source command.
source filename
Run command(s) from a file; an error in any command does not terminate execution of subsequent commands. Comments (lines starting with ‘#’) are allowed in a command file. Empty lines are ignored; they do not repeat the last command. You can’t restart the program by having more than one run command in the file. Also, the list of commands may include additional source commands; however, the gawk debugger will not source the same file more than once in order to avoid infinite recursion.
In addition to, or instead of, the source command, you can use the -D file or --debug=file command-line options to execute commands from a file non-interactively (see section Command-Line Options).
Next: Miscellaneous Debugger Commands, Previous: Execution Stack, Up: List of Debugger Commands [Contents][Index]