gawk: Debugger Info
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:
'args'
List arguments of the selected frame.
'break'
List all currently set breakpoints.
'display'
List all items in the automatic display list.
'frame'
Give a description of the selected stack frame.
'functions'
List all function definitions including source file names and
line numbers.
'locals'
List local variables of the selected frame.
'source'
Print 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 '-f'
option. The 'list FILENAME:LINENO' command can be used at any
time to change the current source.
'sources'
List all program sources.
'variables'
List all global variables.
'watch'
List 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_size'
Set the maximum number of lines to keep in the history file
'./.gawk_history'. The default is 100.
'listsize'
Specify the number of lines that 'list' prints. The default
is 15.
'outfile'
Send 'gawk' output to a file; debugger output still goes to
standard output. An empty string ('""') resets output to
standard output.
'prompt'
Change the debugger prompt. The default is 'gawk> '.
'save_history' ['on' | 'off']
Save command history to file './.gawk_history'. The default
is 'on'.
'save_options' ['on' | 'off']
Save current options to file './.gawkrc' upon exit. The
default is 'on'. 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 (Options).