3.7. Locating and changing memory values and verifying changes

To locate a value (of a variable or string, for example) in memory and change it:

  1. Select Reload Current Image from the File menu.

  2. Select Go from the Execute menu (or press F5) to reach the first breakpoint, set by default at the beginning of function main().

  3. Select Memory from the Search menu to display the Search Memory dialog.

  4. Enter 2’ND in the Search for field, set the In range and to addresses to 0x0 and 0xFFFF, and select ASCII for the Search string type, as shown in Figure 3.9.

    Figure 3.9. Searching for a string in memory

    Searching for a string in memory
  5. Click the Find button. The Memory processor view opens, and shows the contents of an area of memory, with the string you specified highlighted

  6. Click the Cancel button to close the Search Memory dialog. Reposition and resize the Memory window if necessary, to see a display similar to that in Figure 3.10.

    Figure 3.10. Changing contents of memory

    Changing contents of memory

    You might have to right-click in the window to display the pop-up menu and set Size to 8 bit and Format to Hex - No prefix.

  7. The four hexadecimal values highlighted are 32 27 4E 44.

    Double-click on the value 32 and, as an example of entering a hexadecimal value, type 0x4E and press Return.

    Double-click on the value 27 and, as an example of entering an ASCII value, type "o (a double quote followed by a lowercase letter o) and press Return.

    Double-click on the value 4E and, as an example of entering a decimal value, type 46 and press Return.

    Double-click on the value 44 and, as an example of entering an octal value, type o62 and press Return.

  8. Press F5 to continue execution, and enter a value of, say, 100 when you are prompted in the Console processor view for the number of runs to perform.

When the program displays its messages after completing its tests you can see that one of the lines that in earlier examples included the text 2’ND STRING now has No.2 STRING instead because of the change you made.

In this example, the change you made was not permanent, because you did not alter the source code or the executable image stored in a disk file. You altered only the temporary copy of the image in the target memory.

Copyright © 1999-2006 ARM Limited. All rights reserved.ARM DUI 0066G
Non-Confidential