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 and step into the first call of function IntStack::push(int) until just after the IntLink has been allocated. Enter the z/OS® Debugger command:
LIST TITLED num
z/OS Debugger displays the following in the Log window:
LIST TITLED 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.

To view the attributes of variable ptr in IntStack::push(int), issue the z/OS Debugger command:
DESCRIBE ATTRIBUTES *ptr;
The result in the Log window is:
ATTRIBUTES for * ptr
Its address is 0BA25EB8 and its length is 8
  class IntLink
    signed int i
    struct IntLink *next
So for most classes, structures, and unions, this can act as a browser.
You can list all the values of the data members of the class object pointed to by ptr with the command:
LIST *ptr ;
with results in the Log window similar to:
LIST * ptr ; * ptr.i = 0 * ptr.next = 0x00000000
You can change the value of data member of a class object by issuing the assignment as a command, as in this example:
(* ptr).i = 33 ;

Refer to the following topics for more information related to the material discussed in this topic.