CLion 2017.1 Help

Types of Breakpoints

Introduction

Breakpoints are a simple but very important debugging instrument which allows you to suspend a program upon reaching a certain breakpoint, and examine the behavior of the program and its components at that point. A breakpoint is defined by one or more conditions that determine when a program's execution should be interrupted. These conditions depend on the breakpoint type and configuration.

CLion lets you create breakpoints of several types. Each breakpoint type supported by CLion addresses different debugging needs and has its own individual settings.

If a file with breakpoints has been modified externally, for example, updated from a version control repository, or changed in an external editor, so that line numbers are changed, then the breakpoints will be moved accordingly. Note that CLion should be running at the moment of such modification; otherwise, such changes will pass unnoticed.

Line breakpoint

These breakpoints are assigned to lines of source code and are used to target a particular section for debugging.

Line breakpoints are triggered when the program reaches the specified line of source code, before it is executed. The line of code that contains a set breakpoint, is marked with a red stripe; once such line of code is reached, the marking stripe changes to blue.

Temporary line breakpoint is a subset of the line breakpoint. The only difference is that the breakpoint of that type is immediately removed when hit.

Exception breakpoint

CLion provides exception breakpoints for C/C++ and JavaScript.

Exception breakpoints are triggered when the specified exception is thrown or caught, depending on settings. Unlike the line breakpoints, which require specific source references, exception breakpoints apply globally to the exception condition, rather than to a particular code reference.

Symbolic breakpoint

Symbolic breakpoints stop program execution when a specific function or method starts executing. Symbolic breakpoint can be triggered within a specific module (modules) only or within all modules, as required. Refer to Adding Symbolic Breakpoint for details.