4.10 Setting Breakpoints
When debugging, 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:
Set Breakpoint
If your code is running, end execution by clicking the Finish Debugger Session icon
![](GUID-18FACEAD-8BBF-465A-BA83-56BADBDB8098-high.png)
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.
For the device used in this tutorial, there is only one hardware breakpoint but software breakpoints are available. A notebox will pop up asking about your choice of breakpoint type. Since stepping through code in the next section requires another breakpoint, click Yes to use software breakpoints.
For more on breakpoint type selection, see 5.17.1 Choose Hardware or Software Breakpoints.
![](GUID-7F9A87F3-540C-42AA-BDBC-66C1F6DB4E73-high.png)
Halt at Breakpoint
Click the Debug Project icon
![](GUID-500F5689-8F8C-488E-BEAC-FE076FB6844A-high.png)
![](GUID-C2A1384E-A692-4A04-9368-0601E160C354-high.png)