The Memory view lets you view and change the contents of
memory or memory areas used by your program.
About this task
To add a new memory monitor from the Variables view, Monitors
view, Registers view, or editor:
- In the Variables view, Monitors view, or Registers view, right
click the variable, expression, or register for which you want to
monitor memory. Or, in the editor, highlight and right-click the expression
for which you want to monitor memory.
Note: If the expression is a
pointer, the value of the expression will be used to address memory.
If the expression is an lvalue (with an address in
memory), its address will be used to address memory. Otherwise, the
value of the expression will be used as the address. For example,
given the declaration int i = 0x44;, if the expression
is i, the memory monitor will be at the address of i.
If the expression is i+1, the memory monitor will
be at the location given by the value of the expression i+1,
which is 0x45.
- Select Monitor Memory > <rendering> from
the pop-up menu, where <rendering> is the
rendering that you want to display in the Renderings portion
of the Memory view.
Procedure
To add a new memory monitor for an expression from the
Memory view:
- Click the Memory view Add Memory Monitor push
button (
).
- In the Monitor Memory dialog box, enter the expression
in the field (the expression must evaluate to an address).
- Click OK.
- The Monitors (left-hand) portion
of the Memory view displays the expression that you entered for monitoring.
If you have multiple memory monitors, this section displays a list
of expressions that you are monitoring.
- The Renderings (right-hand) portion
of the Memory view populates with HEX and ASCII renderings.
Results
To view the contents of a C or C++ variable (such
as an integer) in a memory monitor, you do not need to precede the
variable with an ampersand (&) or select a pointer that points
to that variable. For example, given the following C or C++ source
code:
int i=10; int* p=&i;
You can
monitor the memory for the variable i by entering
either i or p in the Monitor Memory
dialog box or by choosing either value in the editor and selecting Monitor
Memory > <rendering> from the pop-up menu.