Chapter Contents

Previous

Next
The Windowing Interface

Using the Primary Windows

The SAS/C Debugger gives you maximum control over your debugging session. It also provides you with a wealth of information about the program you are debugging. The key to harnessing this capability is the windowing interface.

The Command, Log, Status, and Source windows are your primary interface to the SAS/C Debugger when it is running in full-screen mode.


Using the Command Window

The SAC/C Debugger offers a powerful set of commands that are used to control your debugging session. When the debugger is running in full-screen mode, you submit these commands either from the command window or by pressing a PF key.

Note:    The Keys window is used to assign debugger commands to PF keys. For a quick look at the default command assignments, see Using PF Keys.  [cautionend]
The Command window, shown in The Command Window, is used to submit debugger commands. The method is similar to the way that you submit commands in a line-mode session. You can issue any line-mode commands after the Cdebug: prompt and then submit the command to the debugger by pressing the ENTER key. As the debugger executes the command, it may display output or messages about the execution in the Log window or in one of the other windows that are described in Types of Windows.

The Command Window

[IMAGE]

If a command is too long for the Command window to display, you can type the command into the Log window, using a backslash for continuation.

The debugger maintains a circular list of the commands that you issue.. However, issuing a command more than once in succession results in only one copy of the command being maintained in the list. You can cycle through the list by using the window scroll up and window scroll down commands, which are assigned to the PF19 and PF20 keys by default. To issue a previously issued command, press the ENTER key when the command is displayed. The previously entered commands are accessed in first-in, first-out order. As the list fills up, the oldest commands are deleted. Use the window clear command to clear the list.


Using the Log Window

As shown in The Log Window, the Log window contains a log of commands that are issued during the current session. It also displays output from certain commands and some error messages. Commands that are echoed in the Log window are those commands that are issued either in the Command window or in the Log window. The window scroll up and window scroll down commands provide the capability to view previous commands and their output. The PF19 and PF20 keys are dedicated by default to vertically scrolling the window that contains the cursor.

The Log Window

[IMAGE]


Using the Status Window

During a debugging session, control passes back and forth between your program and the debugger. See The Status Window. The Status window provides information about the current status of your debugging session, including your current location in the code. This information consists of the following:

The Status Window

[IMAGE]


Transferring Control to the Debugger

The point in your code at which control can be passed from your program to the debugger is called a hook. Whenever control is passed to the debugger, the Status window displays the location of the hook and the reason that control was transferred. For example, in the Status window shown in Status Window, Showing Run Scope and Command Scope, a step command that was issued at the entry hook of the getname function caused control to be transferred to the debugger.

Run Scope and Command Scope

The location in your program at which execution stops determines the run scope. The debugger usually uses this location to resolve any references to variables. The debugger recognizes expressions that are visible to your programs at the point where execution stops without any additional actions on your part. However, if you want to view the value of expressions that are not visible at the point in your code indicated by your run scope, you must change the scope to a new location. This new scope, which you control, is called the command scope. Status Window, Showing Run Scope and Command Scope shows a Status window that displays both a run scope and a command scope.

Status Window, Showing Run Scope and Command Scope

[IMAGE]

There are two ways in which you can change the command scope. The scope command, which is described in Command Directory, provides the greatest control. However, if you have more than one function in your calling sequence, you can move the cursor into the Status window and use the PF19 or PF20 keys to change command scope. The window scroll <> up or window scroll <> down commands are assigned to these keys by default. The PF19 key causes the command scope to move up in the calling sequence, and the PF20 key causes the run scope to move down in the calling sequence.


Using the Source Window

The Source window displays your source code and highlights the line on which the debugger has stopped, as shown in The Source Window. The top border, which is always present, contains the name of the source file.(footnote 1) The first line of the window provides information that always displays the following:

Module
identifies the compilation that is currently displayed in the source window

Line
is the line number of the first line of source code that is displayed in the visible portion of the Source window text area.

The Source Window

[IMAGE]

The remaining portion of the Source window contains text and line number areas that are used to view source code. The left side of each line number field is a prefix area. The prefix area displays the location of requests that have been assigned to a specific line in your code.

The SAS/C Debugger uses a request system that keeps track of the breakpoint and action requests that you specify with debugger commands. These requests, which tell the debugger to interrupt program execution at a hook, are assigned to one line or a range of lines in your source code. As shown in The Source Window, the prefix area includes an indication of the commands that have been requested, such as break, ignore, on, and trace. The prefix area can also be used to issue prefix-area commands that are used to either make or control debugger requests. Prefix-area commands are explained under Source Window.

The code that is displayed in the Source window changes as debugger commands are executed. When you issue step, go, continue, or any other command that causes additional lines of your program to run, the highlighted line advances through the text field of the Source window. If the cursor is in the text field, it stays in step with the highlighted line as your program runs. Leaving the cursor on any of the other areas disables this tracking behavior.

Note:    The print command is assigned to the PF16 key by default. If you move the cursor to a variable that is located within the run scope and you issue the print command with a PF key, then the log window displays the value of the variable. The tracking behavior of the cursor within the Source window is particularly useful with this technique.  [cautionend]

Moving Around in the Source Window

To view your source code, you can either scroll through the window or jump directly to a specific line. After viewing a portion of your source code, you can use the list command to return to your current line.

Scrolling By scrolling through the text field of the Source window, you can view any line of your source code. The following window scroll commands are assigned to PF keys by default:
PF7 window scroll source up
PF8 window scroll source down
PF 19 window scroll <> up
PF 20 window scroll <> down
PF 22 window scroll <> left
PF 23 window scroll <> right
The <> symbol is used as a placeholder to specify the window in which the cursor is currently located. When you press the PF key, the name of your current window is substituted for <>, and the command is executed. See Placeholders in Commands and window for additional information about the <> placeholder.

You must position the cursor in the Source window before you use the PF19, PF20, PF22, or PF23 keys. However, the PF7 and PF8 keys have been assigned window scroll commands that cause the Source window to be scrolled regardless of the position of the physical cursor. These two keys are useful when your cursor is located in the Command window and you want to scroll the source code without moving the cursor into the Source window. See Command Directory for additional information about the window scroll command.

As you scroll through your source code, the line number and text areas scroll together. Although the text field can be scrolled either horizontally or vertically, the line number area can be scrolled only vertically. Thus, the line number is always visible, even if you scroll to the far right side of the text area.

Scroll amount By default, the position of the cursor in a window controls the amount that is scrolled up and down. You can override the default scroll value during a session by issuing a window scroll command or specifying a new value in the Config window. Valid values are cursor, half, page, and max.

The initial scroll amount, which has a default value of cursor, can also be set by a window scroll command in the configuration file. A scroll amount of max cannot be specified in the configuration file. The configuration file is used to customize the attributes of the windowing interface. See Setting Up a Configuration File for more information.

Jumping to a line Scrolling is a simple and fast way to move through displayed lines. However, it is not an effective way to reach parts of your code that are located far from your current position. Another way to view a part of the displayed module is to type the line number at the Line: prompt of the Source window. Sources from a different module in the calling sequence can be viewed by typing the module name after the Module: prompt. If either the module name or line number is invalid, a window pops up so that you can correct the invalid input.

Note:    You can use the list command to produce the same effect during a full-screen session. See Command Directory for information about the list command.  [cautionend]

Returning to the highlighted line After viewing source code from different modules, or viewing a different area of the current source file, you can quickly return to the highlighted line by issuing the list command with no parameters in the Command window.


FOOTNOTE 1:   The form of the source filename displayed in the Source window is operating-environment specific. The Source Window illustrates a CMS source filename. [arrow]


Chapter Contents

Previous

Next

Top of Page

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.