5.14.4 Debug Considerations

When debugging your code, consider the following issues:

  • You need to be in a debug session (debug mode) to activate many debugging features – for example, to view variable values in the watch or memory windows.
  • MPLAB X IDE operation is always connected to the hardware tool. To connect only at runtime, see Tools > Options (MPLAB X IDE > Preferences for macOS), Embedded > Generic Settings, uncheck Maintain active connection to hardware tool.

    When unchecked, settings made in MPLAB X IDE will be passed to the tool only at runtime. Settings changed during a halt are updated only when runtime is initiated again.

  • For some applications you may need to break down the debug steps for independent execution. To do this, use the steps under Debug > Discrete Debugger Operation.
  • Disable compiler optimizations when debugging or use a debug optimization if available for your compiler. In the Project Properties window, select the language tool executable under Categories. Then select Optimizations from Options categories and choose the lowest level, i.e., 0 if available.