7.2.4. Changing memory contents

RealView Debugger enables you to change memory values in several different ways. For an example of how to change memory contents:

  1. Select File → Reload Image to Target to reload the image dhrystone.axf.

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

  3. Set a simple breakpoint by double-clicking on line 150.

  4. Click Go 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 150. 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 0x8B00 and display the ASCII values, shown in Figure 7.6.

    Figure 7.6. Example memory display

    Example memory display

    The memory locations 00008B0B-00008B0E contain the four hexadecimal values 0x32, 0x27, 0x4E, and 0x44 corresponding to the string 2’ND.

    Right-click in the value at 00008B0B, that is 0x32, to display the context menu shown in Figure 7.5.

    This enables you to change the contents at the specified location. Select the option Set Value... from the context menu to display the selection box, shown in Figure 7.4, where you can enter the new value.

    You can also use the drop-down arrow to select from a browser or to re-use a value 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.

    Enter the required hexadecimal value 0x4E, or enter ‘N’, and click Set to update the memory display. You can use uppercase or lowercase to enter the new value.

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

  7. Change the value at location 00008B0C from 0x27 to 0x6F (lowercase o).

  8. Data values can be entered in a format that is different from the display format. Right-click in the location 00008B05 (0x4E), for example, enter the decimal value 32 and then click Set. The memory pane is updated with the new value, a space, displayed in the chosen display format.

  9. You can also use in-place editing to change memory contents. Double-click in the value 0x44 (D) at location 00008B0E and change it to 0x32. Press Enter to confirm the new value.

    If you press Escape then any changes you made in the highlighted field are ignored.

  10. View the changed values in the memory display. Each new value is displayed in blue as the pane contents are updated.

  11. View the changes you have made in the messages displayed when your program completes. The string “2’ND” has been replaced by “No 2”.

  12. Double-click on the red marker disc to clear the breakpoint at line 150.

Copyright © 2003, 2004 ARM Limited. All rights reserved.ARM DUI 0234B