PowerAda Getting Information for Debugging

From OC Systems Wiki!
< PowerAda:APPENDIX F. Debugger Command Reference
Revision as of 00:36, 25 April 2019 by imported>WikiVisor (Text replacement - """ to """)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


The commands in this section allow you to get different types of information for debugging. For example, they allow you to view specified source lines, program execution statistics, the call chain, current tasks, and so forth.

Displaying Call Chains: CALLS

This command displays the call chain of the current task. The call chain is the list of calls leading to the current location. The syntax of CALLS is:

calls [TaskName]

where TaskName is an alphabetic label associated with a task. CALLS uses the least ambiguous name for a task, as described in "Specifying Task Names". The TASKS command displays the identifiers of all tasks that have not ended.

CALLS without a parameter displays the call chain of the currently executing task. In programs with no tasks declared, the main program is always the current task. CALLS with a parameter displays the call chain of the specified task. For each subprogram in the call chain, starting with the most recent, CALLS displays the level, the line number, the compilation unit name, and the name of the containing subprogram.

If your program calls non-Ada code or if the intermediate files are not available for all compilation units in the program, the debugger may not be able to determine all of the information for a subprogram. In this case, the debugger displays as much information as possible, perhaps using machine addresses, but the call chain may be incomplete.

The following example of a CALLS display shows the call chain, starting with the current line, 192, where a breakpoint was encountered. The current line is contained in subprogram LEX_3, which is called from subprogram LEX_2. LEX_2 is called from subprogram LEX_1, which is called from the main program, NEWTEST.

Debug 1> calls
  192,sec/newtest (lex_3)
  Called from 209,sec/newtest (lex_2)
  Called from 222,sec/newtest (lex_1)
  Called from 241,sec/newtest (newtest)

Displaying Ada Source: SOURCE

This command displays a specified range of source code lines from a given compilation unit:

source [StartLine-EndLine[,CompilationUnit]
       | [StartLine..EndLine[,CompilationUnit]]
       | [CompilationUnit.] Subprogram [( Integer )]

where StartLine and EndLine are line numbers (or extended line numbers if you are debugging generic instantiations) within the compilation that contains the specified CompilationUnit. If SOURCE is used without a parameter after a CONTINUE command, the debugger displays the lines surrounding the current program location. = See "Debugging Generic Instantiations" in Chapter 6 for a description of the extended line number.

The parameters to SOURCE, StartLine and EndLine, may specify any part of the compilation, whether the lines are within the compilation unit or not. However, data about each line is derived only from information about the specified compilation unit. If no compilation unit is specified, the debugger assumes the current default.

When a Subprogram is supplied, the source lines associated with that subprogram are displayed. Overloaded subprograms must be distinguished by a selection integer by using the Integer. Use the SHOW SUBPROGRAMS command to get a list of overloaded subprogram names with their selection numbers.

The debugger issues an error message if you try to display more lines than the number of lines in the compilation.

Each line displayed is prefaced by the line number and one of three special characters:

>A breakpoint has been set at this line.
=You may set a breakpoint at this line.
:You may not set a breakpoint at this line.

Compilation units and files do not necessarily directly relate to one another. Because the line numbers are lines within files, if more than one compilation unit is in a file, then a single SOURCE command can display lines from multiple compilation units. Lines displayed from other compilation units are always prefaced with a ":".

Examples of SOURCE commands are:

source 17
source 20-30,lists
source 6.9-6.11
source 52.64

Displaying Information on Program Objects: SHOW

SHOW is a versatile command that can be used to show groups of program objects, debugger variables, and subprogram specifications. It is used to display information the debugger maintains about visible variables, both within the debugger and within the program. It can also be used to distinguish various subprograms from one another when they are overloaded. The syntax is one of several forms shown below.

Displaying Objects According to Visibility

show [all] { parameters | immediate | local | global |
             visible}

When ALL is specified to PARAMETERS, LOCAL, GLOBAL, or VISIBLE forms of the SHOW command, the respective object dump is repeated for each level of the dynamic call chain of the current task of reference, beginning with the current view position of that task. In addition, each level of display will be preceded with the call chain information describing that level.

show parameters displays the values of any parameters that are defined in the scope of the subprogram, package or task immediately enclosing the view position of the current task of reference. show immediate displays the values of all objects that are visible in the local scope of the current program location. (The local scope is the most immediately containing subprogram, declare block, loop, or accept block). show local displays the values of all objects that are in the local scope of the current program location. show global displays the values of all objects visible in the stack of scopes. show visible displays the values of all local and global objects as well as objects that are visible in the specifications of any packages that are included via a with clause.

Displaying Debugger Variables

show debugger

SHOW DEBUGGER displays the current values of all debugger variables. This display includes the names and current values of all variables created with the DECLARE command and not yet destroyed with the UNDECLARE command. It also includes any variables created by macro invocation and predefined variables maintained by the debugger.

Displaying Subprogram Specifications

show subprograms [CompilationUnit.] Subprogram

SHOW SUBPROGRAMS displays the definition of all subprograms with a particular name that are defined in the specified compilation unit. This information is useful in setting subprogram entry and exit breakpoints on subprograms with overloaded names, or simply to see what, if any, subprograms with a given name are visible. If no compilation unit is specified, the current default is used.

Displaying Compilation Units

show [all] units

SHOW UNITS displays the names of the compilation units that make up the target program. Unless you specify ALL, the debugger displays only those compilation units that are compiled for debugging. PowerAda run-time units are preceded by '+' in the display, while units compiled for debugging are preceded by '*'.

Displaying Task Status: TASKS

This command, when used without a parameter, displays a list of all tasks that have not ended; when used with a task identifier, it displays a single specified task. Its syntax is:

tasks [TaskName]

Task Status Types:

The following list displays the task status types and their meanings. References to the Ada95 Reference Manual list the chapter, section and paragraph that contain the information. For instance, <RM95: 9.3(2)> refers to the second paragraph in the third section of chapter 9 in the RM95.

Task Status Type Meaning RM95 Reference
Active The task is executing or ready to execute. <RM95: 9(10)>
Blocked The server task is executing a selective accept with an open delay alternative. <RM95: 9.7.1(16)>
Blocked PR The client is blocked waiting for protected record access. <RM95: 9.5.1(5)>
Blocked PR (timed) The client is blocked on a timed call for protected record access. <RM95: 9.7.2(5)>
Blocked (Timed) The server task is waiting for a call or executing a delay statement. <RM95: 9.7.1(16)>
Caller Rndvz The calling task is in an active rendezvous. <RM95: 9.5.2(25)>
Caller Timeout The timed entry call issued by the calling task has timed out. <RM95: 9.7.2(5)>
Complete The task has finished the execution of the sequence of statements in its body but has not yet ended. <RM95: 9.3(5)>
Not Started The task object has been elaborated but not yet activated. <RM95: 9.1(13)>
Queued The calling task is waiting to be accepted. <RM95: 9.5.3(12)>
Queued (Timed) The calling task is executing a timed entry call. <RM95: 9.7.2>
Rndvz Complete The rendezvous requested by the calling task has completed. <RM95: 9.5.2(25)>
Server Rndvz The server task is in an active rendezvous. <RM95: 9.5.2(25)>
Server Timeout The selective accept within the server task has timed out. <RM95: 9.7.1(18)>
Terminated The task has completed its execution, and all dependent tasks have also ended or are waiting to end. <RM95: 9.3(5)>
Wait Child Actv The task has one or more children who have not yet finished with activation. <RM95: 9.2(5)>
Wait Child Term The task has completed execution of a program unit containing tasks but has active children dependent on that unit. <RM95: 9.3(5)>

Displaying the Current Location: WHERE

This command displays the location where the target program has stopped. Its syntax is simply:

where

The command displays the line number, the compilation unit, and the containing subprogram. If the debugger cannot locate the containing subprogram, no information is displayed.