Setting Breakpoints

When debugging code, it can be useful to suspend execution at a specific location in code so that variable values can be examined. To do this, use breakpoints.

For more information on breakpoints, see also NetBeans Help:

Debugging C/C++ Projects Tutorial>Creating Breakpoints

Set Breakpoint

If your code is running, end execution by clicking the “Finish Debugger Session” icon .

In the Projects window, under “Source Files,” double click on the file main.c to open it in an Editor window. Set a breakpoint on the line in the figure by clicking in the left margin of the line.

Figure 1. Breakpoint Set in Code

Halt at Breakpoint

Click the “Debug Project” icon to execute the program again. The program will halt at the breakpoint. Hover over the pot_value variable to see its current value.

Figure 2. Program Execution Halted at Breakpoint

Troubleshooting

If you see a bulb warning icon next to lines of code in the editor, you may need to set the path for include files. See:

Set The Include Directory Path

Note: For MPLAB XC8 v2.xx, both AVR and PIC MCUs are supported, so the compiler install directory structure has changed.