13.3.2. Changing the value in a memory location

To change memory contents:

  1. Display the Memory pane, if it is not visible, and set the start address of the memory area you want to view (see Examining memory in the Memory pane). Figure 13.13 shows and example.

    Figure 13.13. Memory pane showing address contents

    Memory pane showing address contents
  2. Right-click on the value at the required memory location to display the context menu.

  3. Select Set Value... from the context menu. The memory value dialog box is displayed, shown in Figure 13.14.

    Figure 13.14. Memory value dialog box

    Memory value dialog box
  4. Enter the new value for the location.

    You can enter data values in a format that is different from the display format.

    You can also use the drop-down arrow to select from a browser or to re-use a value that you entered previously. The drop-down also gives access to your list of personal favorites where you can store a data value for re-use in this, or future, debugging sessions.

  5. Click Set to update the Memory pane, shown in Figure 13.15. See Display colors in the Memory pane for a description of the display colors used in the Memory pane.

    Figure 13.15. Memory pane showing changed value

    Memory pane showing changed value

Demonstration of changing memory values with the Memory pane

The following procedure demonstrates how you can change memory locations in the Memory pane:

  1. Load the debug version of the dhrystone.axf image.

  2. Click on the Src tab to view the source file dhry_1.c.

  3. Double-click in the gray margin at line 301 of dhry_1.c. This sets a simple breakpoint (see Setting a simple breakpoint).

  4. Click Run to start execution.

  5. Enter 5000 when asked for the number of runs.

    The program starts and then stops when execution reaches the breakpoint at line 301. The red box marks the location of the PC when execution stops.

  6. Use the Pane menu, in the Memory pane, to set the start address to 0x883A and display the ASCII values, shown in Figure 13.16.

    Figure 13.16. Example memory display

    Example memory display

    The memory locations 0000889B-0000889E contain the four hexadecimal values 0x33, 0x27, 0x52, and 0x44 corresponding to the string 3’RD.

  7. Change the contents of location 0000889B as follows:

    1. Right-click in the value at 0000889B, that is 0x33, to display the context menu.

    2. Select Set Value... from the context menu to display the address value dialog box, shown in Figure 13.14.

    3. Enter the character 'N' (or the equivalent hexadecimal value 0x4E).

      If you enter the value as a character, you must include the quotes.

    4. Click Set to update the memory display.

      The new value is displayed in blue and the ASCII value changes from 3 to N.

  8. Change the value at location 0000889C, as follows:

    1. Double-click on the value at location 0000889C. In-place editing is enabled for the location.

    2. Change the value from 0x27 to 0x6F (or enter lowercase 'o', including the quotes)

    3. Press Enter to apply the change:

      • the new value is displayed in blue

      • the value at location 0000889B is colored light blue to show that it was changed on the a previous update, shown in Figure 13.17.

        Figure 13.17. Memory updated

        Memory updated

      If you press Esc instead of Enter, then any changes you made in the highlighted field are ignored.

  9. Change the value at location 0000889D, as follows:

    1. Click on the value at location 0000889D.

    2. Enter the decimal value 32 (or enter a space character ' ', including the quotes). In-place editing is enabled for the location.

    3. Press Enter to apply the change:

      • the new value is displayed in blue

      • the value at location 0000889C is colored light blue to show that it was changed on the a previous update

      • the value at location 0000889B is now colored black, shown in Figure 13.18.

        Figure 13.18. Memory updated

        Memory updated
  10. Change the value at location 0000889E, as follows:

    1. Click on the value at location 0000889E.

    2. Enter the value 0x32 (or enter '2', including the quotes). In-place editing is enabled for the location.

    3. Press Enter to apply the change:

      • the new value is displayed in blue

      • the value at location 0000889D is colored light blue to show that it was changed on the a previous update

      • the value at location 0000889C is now colored black.

    The string 3’RD has now been replaced by No 2, shown in Figure 13.19.

    Figure 13.19. Memory updated

    Memory updated
  11. Double-click on the red marker disc at line 301 of dhry_1.c. This clears the breakpoint.

Copyright © 2002-2006 ARM Limited. All rights reserved.ARM DUI 0153H
Non-Confidential