C++ Logo

sg15

Advanced search

Re: [SG15] breakpoint and is_debugger_present proposals.

From: Jonathan Wakely <cxx_at_[hidden]>
Date: Tue, 4 Jan 2022 16:52:00 +0000
On Tue, 4 Jan 2022 at 15:48, Ben Craig via SG15 <sg15_at_[hidden]>
wrote:

> A big use case is for environments that have breakpoint instructions, but
> don’t have a reliable way of detecting a debugger.
>

Yes, the problem is that 'return false;' is a valid implementation of
std::is_debugger_present(), and so the "if the program is currently running
under a debugger" check that std::breakpoint() performs is allowed to
always fail, meaning that std::breakpoint() has no effects. If the check
isn't performed (because it can't be), an unconditional breakpoint can
still have effects.

Received on 2022-01-04 10:52:56