gawk: Debugger Info
1
1 14.3.5 Obtaining Information About the Program and the Debugger State
1 ---------------------------------------------------------------------
1
1 Besides looking at the values of variables, there is often a need to get
1 other sorts of information about the state of your program and of the
1 debugging environment itself. The 'gawk' debugger has one command that
1 provides this information, appropriately called 'info'. 'info' is used
1 with one of a number of arguments that tell it exactly what you want to
1 know:
1
1 'info' WHAT
1 'i' WHAT
1 The value for WHAT should be one of the following:
1
1 'args'
1 List arguments of the selected frame.
1
1 'break'
1 List all currently set breakpoints.
1
1 'display'
1 List all items in the automatic display list.
1
1 'frame'
1 Give a description of the selected stack frame.
1
1 'functions'
1 List all function definitions including source file names and
1 line numbers.
1
1 'locals'
1 List local variables of the selected frame.
1
1 'source'
1 Print the name of the current source file. Each time the
1 program stops, the current source file is the file containing
1 the current instruction. When the debugger first starts, the
1 current source file is the first file included via the '-f'
1 option. The 'list FILENAME:LINENO' command can be used at any
1 time to change the current source.
1
1 'sources'
1 List all program sources.
1
1 'variables'
1 List all global variables.
1
1 'watch'
1 List all items in the watch list.
1
1 Additional commands give you control over the debugger, the ability
1 to save the debugger's state, and the ability to run debugger commands
1 from a file. The commands are:
1
1 'option' [NAME['='VALUE]]
1 'o' [NAME['='VALUE]]
1 Without an argument, display the available debugger options and
1 their current values. 'option NAME' shows the current value of the
1 named option. 'option NAME=VALUE' assigns a new value to the named
1 option. The available options are:
1
1 'history_size'
1 Set the maximum number of lines to keep in the history file
1 './.gawk_history'. The default is 100.
1
1 'listsize'
1 Specify the number of lines that 'list' prints. The default
1 is 15.
1
1 'outfile'
1 Send 'gawk' output to a file; debugger output still goes to
1 standard output. An empty string ('""') resets output to
1 standard output.
1
1 'prompt'
1 Change the debugger prompt. The default is 'gawk> '.
1
1 'save_history' ['on' | 'off']
1 Save command history to file './.gawk_history'. The default
1 is 'on'.
1
1 'save_options' ['on' | 'off']
1 Save current options to file './.gawkrc' upon exit. The
1 default is 'on'. Options are read back into the next session
1 upon startup.
1
1 'trace' ['on' | 'off']
1 Turn instruction tracing on or off. The default is 'off'.
1
1 'save' FILENAME
1 Save the commands from the current session to the given file name,
1 so that they can be replayed using the 'source' command.
1
1 'source' FILENAME
1 Run command(s) from a file; an error in any command does not
1 terminate execution of subsequent commands. Comments (lines
1 starting with '#') are allowed in a command file. Empty lines are
1 ignored; they do _not_ repeat the last command. You can't restart
1 the program by having more than one 'run' command in the file.
1 Also, the list of commands may include additional 'source'
1 commands; however, the 'gawk' debugger will not source the same
1 file more than once in order to avoid infinite recursion.
1
1 In addition to, or instead of, the 'source' command, you can use
1 the '-D FILE' or '--debug=FILE' command-line options to execute
1 commands from a file non-interactively (⇒Options).
1