10.2.4. Editing a macro

You can edit the macro that you have created and retest it to verify the changes:

  1. Select Debug → Add/Edit Debugger Macros... to display the Add/Edit Macros dialog. The Existing Macros display list shows the tutorial macro you created and it is highlighted.

  2. Click Show to see the contents of the macro.

  3. In the Macro Entry Area change the body of the macro to read:

    $fprintf 250, “value=%d\n”,var1$;

    This change displays the output of the macro in a window instead of the Output pane.

  4. In the Macro Entry Area add this line at the end of the macro:


    This change causes the macro to return the value of the variable. If the value is True, that is nonzero, then RealView Debugger continues program execution after reporting the result. If the value returned is False, that is zero, then execution stops. The macro now looks like the one shown in Figure 10.2.

    Figure 10.2. Editing a macro body

    Editing a macro body
  5. Click Update to pass the macro definition to RealView Debugger.

  6. View the Output pane message:

    def int tutorial(var1)
  7. Click the Save button and save the updated macro in the same location. This generates a prompt to enable you to Append or Replace the existing file. Click No to replace the existing tutorial.inc.

  8. Click the Close button to close the Add/Edit Macros dialog.

Test the macro you have created by running the program and then calling the macro from the command line:

  1. Select File → Reload Image to Target to reload the image to your debug target.

  2. Enter this command:

    >VOPEN 250

    This opens a window ready to display the results returned from the macro.

  3. Click Go to start execution. When asked for the number of runs, use a small number, for example, 5000.

  4. When the program reaches the breakpoint, enter the command:


    on the command line of the Code window and press the Enter key. This displays the current value of the variable Int_2_Loc in the window.

  5. Step through the program a few more times using the macro to monitor the variable. You can use the up arrow to step back through the commands already submitted on the command line.

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