4.1.2. Debugging hello.c

Follow these steps to debug hello.c at the source level:

  1. Quit the debugger if it is still running.

  2. Enter armcc -g+ hello.c -o hello2 to recompile the program with high-level debugging information.

    The -g+ option instructs the compiler to include debug information.

  3. Enter armsd hello2 to load hello2 into the debugger.

  4. Enter break main at the armsd prompt to set a breakpoint on the first statement in main().

  5. Enter go to execute the program up to the breakpoint.

    The debugger reports that it has stopped at breakpoint #1, and displays the source line.

  6. You can enter debugging commands to examine register contents and source code:

    • To display the contents of the registers enter: reg.

    • To list the C source, enter: type.

      This displays the whole source file. The type command can also display sections of code. For example, enter: type 1,6 to display lines 1 to 6 of the source.

    • To list the assembly code enter: list

    The assembly code around the current position in the program is shown. You can also list memory at a given address, for example: list 0x8080

Refer to armsd or the ARM Software Development Toolkit Reference Guide for more information on using the command-line debugger.

Copyright © 1997, 1998 ARM Limited. All rights reserved.ARM DUI 0040D
Non-Confidential