Keil Logo

µVISION DEBUGGER: SOURCE CODE SYNCHRONIZATION PROBLEMS


Information in this article applies to:

  • C166 All Versions
  • C251 All Versions
  • C51 All Versions
  • RealView Compiler All Versions

QUESTION

On occasion the µVision debugger does not show executable code for my source code. What can be the reason for that?

ANSWER

The Keil compiler is an optimizing compiler that is tuned to reduce program size and increase execution speed. To accomplish that, sometimes the optimizer merges identical code sequences to save code space. When it does, it is not always possible to synchronize the source code with the assembly code while debugging (since there may be more than one source line that corresponds to the assembly code).

If your focus is source code synchronization, then you should reduce the optimization level to 3 or below. However, this causes program size to grow and execution speed to slow down. Typically, in embedded systems it is more important to debug the actual production code and accept the shortcomings in source code display.

Source line synchronization problems typically occur because of the following optimizations:

  • Common code blocks: These are created when the compiler or linker generates subroutines for identical code sequences.
  • Switch/case statements: These are created when the compiler merges identical paths of case blocks into a single block.

The ARM RealView Compiler contains several optimizations the affect the source code synchronization. When you are using Optimize Level 2 or 3 the compiler:

  • performs function in-lining
  • re-arranges code to minimize memory waitstates and pipeline effects
  • combines several statements into one or two CPU instructions

You may therefore see effects such as missing debug information for certain source lines. You may reduce the optimize level to improve the debug illusion or view the generated code in the µVision Disassembly Window.

SEE ALSO

FORUM THREADS

The following Discussion Forum threads may provide information related to this topic.

Last Reviewed: Monday, July 10, 2006


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.