Displaying values of C and C++ variables or expressions
To display the values of variables or expressions, use the LIST
command.
The LIST
command causes z/OS® Debugger to log
and display the current values (and names, if requested) of variables,
including the evaluated results of expressions.
Suppose you
want to display the program variables
X
, row[X]
,
and col[X]
, and their values at line 25. If you
issue the following command: AT 25 LIST ( X, row[X], col[X] ); GO;
z/OS Debugger sets
a breakpoint at line 25 (AT
), begins execution of
the program (GO
), stops at line 25, and displays
the variable names and their values.If you want to see the result of their addition, enter:
AT 25 LIST ( X + row[X] + col[X] ); GO;
z/OS Debugger sets
a breakpoint at line 25 (AT
), begins execution of
the program (GO
), stops at line 25, and displays
the result of the expression.Put commas between the variables when listing more than one. If
you do not want to display the variable names when issuing the LIST
command,
enter LIST UNTITLED
.
You can also list variables with the
printf
function
call as follows: printf ("X=%d, row=%d, col=%d\n", X, row[X], col[X]);
The output from printf
, however, does not appear
in the Log window and is not recorded in the log file unless you SET
INTERCEPT ON FILE stdout
.