C++ Logo

sg15

Advanced search

Re: [SG15] breakpoint and is_debugger_present proposals.

From: Jonathan Wakely <cxx_at_[hidden]>
Date: Mon, 10 Jan 2022 18:25:25 +0000
On Wed, 5 Jan 2022 at 12:11, Ben Boeckel <ben.boeckel_at_[hidden]> wrote:

> On Wed, Jan 05, 2022 at 08:10:08 +0000, Jonathan Wakely via SG15 wrote:
> > Maybe give it a default argument too. The difficulty then is whether it
> > should default to true or false, and whether true should mean conditional
> > or unconditional.
>
> Why are we limited to `bool`? Why not something like:
>
> ```
> enum class breakport_condition {
> always,
> when_debugged, // best effort
> never, // to allow for more complicated conditional logic leading up
> to the call
> };
> ```
>
> The discussion of the default is then down to just `always` or
> `when_debugged`, no?
>
>
Yup.
It's rather verbose with an enum:
std::breakpoint(std::breakpoint_condition::when_debugged);
But definitely unambiguous.

Received on 2022-01-10 18:25:36