Modifying the value of a C variable
To LIST the contents of a single variable, move the cursor to the
variable name and press PF4 (LIST
).
The value is displayed in the Log window. This is equivalent to
entering LIST TITLED variable
on
the command line.
Example: sample C program for debugging
Run the CALC program
above to the statement labeled CALC1 ,
move the cursor over num and press PF4 (
LIST
).
The following appears in the Log window: LIST ( num ) ;
num = 2
To modify the value of num to 22, type
over the num = 2
line with num = 22
,
press Enter to put it on the command line, and press Enter again to
issue the command.
You can enter most C expressions on the command line.
Now step into the call to
push()
by pressing PF2 (STEP
)
and step until the statement labeled PUSHPOP2 is reached. To view
the attributes of variable ptr, issue the z/OS® Debugger command:
DESCRIBE ATTRIBUTES *ptr;
The result in the
Log window is similar to the following: ATTRIBUTES for * ptr
Its address is 0BB6E010 and its length is 8
struct int_link
struct int_link *next;
int i;
You can use this action to browse structures
and unions.You can list all the values of the members of the structure pointed
to by ptr with the command:
LIST *ptr ;
with
results in the Log window appearing similar to the following: LIST * ptr ;
(* ptr).next = 0x00000000
(* ptr).i = 0
You can change the value of a structure member by issuing the assignment
as a command as in the following example:
(* ptr).i = 33 ;