Function Breakpoint in Visual Studio

Previously we discussed the concept of Hit Count breakpoints and Conditional breakpoints. We will now explain function breakpoints. This functionality allows us to set the name of a function as the condition for the breakpoint to hit.

Let's start by creating 2 functions, SetString() and GetString(), and call them as SetString() first and then GetString().

Breakpoint Function

Figure 1: Breakpoint Function

To set the breakpoints for this type, go to Debug, then Windows and select Breakpoints to open the Breakpoints window. Select the option New, then the Break at Function option from the window.

Break at Function

Figure 2: Break at Function

This opens up a new window and we specify the name of the GetString() function as the function condition for the breakpoint to be hit.

New breakpoint

Figure 3: New breakpoint

Hover over the breakpoint and we can see its details.

Tips Tricks Function

Figure 4: Tips Tricks Function

Run the application and the breakpoint will be hit only when the execution of the GetString() function starts.

Run Application

Figure 5: Run Application

Easy and helpful, isn't it? Happy coding!