PowerAda Miscellaneous Commands
The debugger commands covered in this sections are general purpose commands that you would use during a debugging session. For example, the EDIT command can be used to modify your Ada source file; the EXIT command lets you end a debugging session; the HELP command explains how to use the debugger; and the SYSTEM command allows you to execute UNIX commands without exiting the debugger.
Modifying Ada Source Files: EDIT
Use this command to edit an Ada source file with the editor of your choice. This command has a syntax that takes one of the following forms:
edit file FileName
Edit the source file specified by FileName.
Edit the source file associated with CompilationUnit in the library.
[ CompilationUnit.] Subprogram
Edit the source file associated with the subprogram or package specified by Subprogram.
LineNumber [, CompilationUnit]
Edit the default or specified CompilationUnit starting at LineNumber.
The debugger uses the contents of the debugger variable EDITOR to run an editor of your choice. If you want to pass parameters such as the file name or line number to the editor, include these as part of the variable string.
Specify the file name as "%f" and the line number as "%n"; the debugger substitutes the current file name and line number before calling the editor. To use a single percent sign in the string, specify it as "%%". For example, use the following debugger command to make the debugger use the vi editor as its default:
editor := "vi +%n %f"
The variable that holds the editor name is a debugger variable, not a shell variable.
You do not have to specify the source file name or line number as part of the editor invocation command.
Depending on the type of terminal you use, you can specify the editor invocation command to run either a character-oriented editor, or an editor that runs in a separate window.
When using the debugger in a UNIXwindow, setting the debugger variable EDITOR using the command
editor := "xterm -e vi +%n %f &"
allows you to spawn several editing sessions from within the debugger, each running in a separate window.
Ending a Debugging Session: EXIT
exit [debugger] [when Expression]
EXIT DEBUGGER ends a debugging session and causes the target program and the debugger to end. Within a structured statement, EXIT ends the execution of the innermost loop in which it appears. If no loop is active then EXIT also ends the debugging session. A conditional statement can cause the EXIT command to be executed only when a given expression evaluates to TRUE.
Upon exiting the debugger, the log file is closed. If EXIT occurs in a script, the debugger closes the log file, ends, and does not process the rest of the script.
Requesting Help: HELP
The debugger has an on-line help facility that you can access by using the HELP command. With the HELP command, you may obtain information on a command or topic at any point during a debugging session. The command syntax is:
help [Command | Topic]
In addition to providing information on debugger commands, HELP provides information on the following topics:
intro introduces you to the debugger
commands provides general information about all commands
comp_units tells how to specify compilation-unit arguments to commands
defaults explains how defaults are used in the debugger
explains how to manipulate debugger variables
editor explains how to use the macro editor
expressions describes expressions accepted by the debugger
describes source program locations
describes target program addresses
describes features that are new in this release
statements describes structured statements
syntax describes the syntax of the debugger commands in the help file
task_names explains how the debugger creates task names
views explains how the debugger looks at the target program
Entering HELP with no parameter displays a summary listing all commands and additional help topics. To display information about one of the help topics, type
help followed by the topic's name. The debugger provides a one or two page description detailing all the forms of a command. For example, entering
help load displays help for the LOAD command. You may specify help topic and command keywords in either upper or lower case, but you may not abbreviate them.
Examples of HELP command entries are:
Running Shell Commands: SYSTEM
The SYSTEM command executes operating-system commands, then returns you to the debugger. The CommandString is a single operating-system command.
When you do not specify a CommandString, SYSTEM starts a new shell interpreter, allowing you to execute multiple commands. To exit from this shell interpreter, type the end-of-file character (usually Ctrl-D) or enter exit.
Operating-system commands that expect keyboard input can cause unexpected results if given as a command to SYSTEM.
Here is an example of SYSTEM: