1. Revision History
1.1. Revision 0
Initial Release 🎉
Setting breakpoints inside of a debugger can be difficult and confusing for newcomers to C++. Rather than having to learn C++, they have to learn a special syntax just to place a breakpoint in the exact spot they want, or rely on the interface of an IDE. At the end of the day, a simple programmer just wants to place a breakpoint so that their program stops when under the watchful eye of a debugger.
This paper proposes a new function,
, that causes a program to
stop or "break" execution when it is being debugged.
The goal of the
function is to "break" when being debugged
but to act as though it is a no-op when it is executing normally. This might
seem difficult in practice, but nearly every platform and various debuggers
supports something to this effect. However, some platforms have caveats that
make implementing this "break when being debugged" behavior hard to implement
function is intended to go into the
4.1. Couldn’t this be implemented via contracts?
Possibly. However, a
function gives more fine grained control
than "break on all contract violations".
4.2. How does this work with the upcoming stacktrace API?
It is not intended to interoperate with the stacktrace API at this time. Both
the stacktrace API and
are essentially orthogonal in their
focus and use. Whereas the former is for getting more information in the event
of an error,
is intended to help programmers inspect the
current state of a program at a breakpoint.
Wording is relative to [N4762]