Embedded Design Handbook

ID 683689
Date 8/28/2023
Public
Document Table of Contents

6.2.2.6. Debugger Stepping and Using No Optimizations

Use the None (–O0) optimization level compiler switch to disable optimizations for debugging. Otherwise, the breakpoint and stepping behavior of your debugger may not match the source code you wrote. This behavior mismatch between code execution and high-level original source code may occur even when you click the i button to use the instruction stepping mode at the assembler instruction level. This mismatch occurs because optimization and in-lining by the compiler eliminated some of your original source code.

To set the None (–O0) optimization level compiler switch in the Nios® II Software Build Tools for Eclipse, perform the following steps:

  1. In the Nios® II perspective, right-click your application project. A list of options appears.
    Figure 245. Application Project Options
  2. On the list, click Properties. The Properties for <project name> dialog box appears.
  3. In the left pane, click Nios® II Application Properties.
    Figure 246. Nios Application Properties
  4. In the Optimization Level list, select Off.
  5. Click Apply.
  6. Click OK