Chapter Contents |
Previous |
Next |
Command Directory |
Check for Changes Made to an Object
m{onitor}
monitor
command causes the debugger to test for changes in the value of the monitored
object at every line-number hook. If the value changes, the program is interrupted.
EXPRESSION identifies the object (such as a variable) to be monitored.
The following options can be specified in any order:
typedef
, or an arithmetic type. If neither LENGTH
nor CTYPE is specified, the length used is the length corresponding to the
type of the object.
library
library
only if you suspect that an object is being modified inadvertently
by a library
function. You cannot use this
keyword with the in (FUNCTION-NAME) or in (SECTION-NAME) options.
print
print
command when the monitor is triggered. If print is used,
the debugger prints the new value of the object. If the object is no more
than 256 bytes in length, the debugger also prints the old value. The values
are formatted appropriately for the type of the object. If the object is an
aggregate and less than 256 bytes in length, only those fields that have changed
are displayed.
where
where
command when the monitor is triggered. The traceback
is produced only once, even if more than one monitor is triggered at the same
line-number hook.
If the object is identified by the form
arr[index_expression]
, where the index expression is not constant, then the current value
of the index expression is used to determine the location of the object to
be monitored. This means that the monitored location does not change if the
value of the index expression changes.
A simple identifier has class auto if it is an automatic
variable or a parameter. The identifier has class static if it is a
static
or
extern
variable. Expressions used to represent portions
of an array or structure (for example,
arr[index_expression]
,
*(arr + index_expression)
, where
arr
is an array, or
str.mem1
, where
str
is a structure) have the same
class as the array or structure. Expressions that involve some form of indirection
(for example,
*(p+5), p-->a
, where
p
is a pointer or
*0p
address) have class address.
If a static object is in a subsidiary load module, and
the load module is unloaded via the
unloadm
function, the debugger
automatically drops the monitor and issues a message to that effect. Similarly,
if a monitored object of class address is in storage that was allocated via
the malloc
function, and the
storage is freed by free
, the
debugger drops the monitor and issues a message.
The debugger distinguishes monitor requests by the type of the object. Types of Objects for the monitor Command shows how the debugger treats monitor requests for objects by type.
monitor
command, given the following declarations:
int loopcnt; struct ABC *p; int arr[10] ; char buf[100] ;
monitor loopcnt print
loopcnt
variable. If the
monitor is triggered, both the old and new values are printed.
monitor *p library
p
. The value of
p
when the monitor is installed is
used to determine the address being monitored. The debugger checks for changes
to the structure, even while library functions are executing.
monitor *p 20 in (sect1)
p
when any function in
sect1
is executing. The
value of
p
when the monitor is installed is used to determine
the address being monitored.
monitor *arr where
arr
.
If the monitor is triggered, the debugger produces a traceback.
monitor *buf 8 in func1
buf
,
only when
func1
is executing.
PROFILE | no |
configuration file | no |
Source window prefix | none |
monitor
command uses command scope to resolve references to all identifiers.
Unsuccessful: 1 | |
Successful: 0 |
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.