Chapter Contents |
Previous |
Next |
Window Directory |
print
or dump
command, displaying the expression
or area of memory each time control is transferred to the debugger. As shown
in Watch Window,
the Watch window contains several fields that are used to control the window,
as well as two areas that are used to display the expressions or areas of
memory being watched.
print
or dump
command can be issued, provided that
it can be evaluated at the time that the watch is entered. When the ENTER
key is pressed, the expression is displayed in the watch name field, and its
value is displayed in the expression value area.
Display area After a watch is selected, it is displayed in the following areas:
d
in the prefix area
and pressing ENTER you can drop any of the watches that are displayed in the
window.
c
is displayed in the first two watch name areas.
The first watch for
c
uses the default format, the second
watch for
c
is formatted by %c.
If an expression that you are watching belongs to a function that is different from that of the command scope, the expression that is displayed in the watch name area is prefixed with the name of the function to which it belongs. For example, if you were to step through the program that is shown in the Watch window in Watch Window, each of the expressions that are being watched would be prefixed with MAIN: in the event that you stepped into another function. The reason for this is that the command scope would no longer be the same as the scope of the expressions that are being watched.
print
command. Typing a number in the N: field causes the information to be formatted in a manner
similar to the output from the dump
command.
Unions, structures, and arrays are displayed as a list
of values separated by commas and enclosed by braces. If a format is specified,
it is used to display the value of all items of the aggregate; if no format
is specified,
%d
is used for signed integral items,
%u
is used for unsigned integral items,
%g
for floating-point items,
and
0p%08x
for pointers. If there is not sufficient
space in the expression value area, the list is ended with an ellipsis (...).
Calling sequence You can watch
an expression that is anywhere within the calling sequence for your program.
However, when you set the watch it must be located inside your command scope.
You cannot use the FUNCTION-NAME:IDENTIFIER format to specify an expression
that is outside the command scope; you must change your command scope before
you type the watch. This format is described in Specifying Identifiers Outside the Current Function. The scope
command can be used to change your command scope to any function that is in
your calling sequence.
Thus, each watch has a function that is associated with
it. The scope of this function is set each time the debugger evaluates the
watch expression, which occurs each time that control is transferred from
your program to the debugger. Watches that are based on variables of the extern
or static
storage class
can always be evaluated; watches that
are based on an automatic variable or parameter can be evaluated only if the
function is in the calling sequence. As soon as the function ends, the automatic
variable or parameter-based watch is deactivated; the next time the function
is typed, the watch is reactivated. This also applies to watches that are
based on automatic variables or parameters in a recursive function. Since
the watch is reactivated only if inactive, recursive invocations of the function
do not set additional watches.
dump
, print
, and watch
commands for
the following:
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.