C++ Logo

sg15

Advanced search

Re: [SG15] breakpoint and is_debugger_present proposals.

From: Daniela Engert <dani_at_[hidden]>
Date: Tue, 4 Jan 2022 16:56:10 +0100
Thanks for expanding on that. I agree.

Am 04.01.2022 um 16:48 schrieb Ben Craig:
>
> A big use case is for environments that have breakpoint instructions,
> but don’t have a reliable way of detecting a debugger. Two examples
> I’ve worked with…
>
> 1. Sometimes, I have a kernel debugger attached to a Windows machine,
> and want a user space program to trigger a breakpoint. If the
> user space program were to query to see if a debugger were
> attached, it would return false, because there isn’t a user mode
> debugger attached. The user space breakpoint would still hit in
> kernel mode though.
> 2. On an embedded ARM processor, I have debugged things through a
> JTAG interface. The CPU and (lack of) OS don’t know that there is
> a JTAG debugger listening, but the JTAG interface will still stop
> on a BKPT instruction.
>
> A smaller use case is for runtime checked contract-like statements.
> If you don’t have a debugger attached, the breakpoint instructions
> usually terminate the process very quickly, without running much code
> at all (I think, it’s been a while since I’ve messed with this use
> case). This can be seen as a feature.
>
> *From:* SG15 <sg15-bounces_at_[hidden]> *On Behalf Of *Daniela
> Engert via SG15
> *Sent:* Tuesday, January 4, 2022 9:41 AM
> *To:* sg15_at_[hidden]
> *Cc:* Daniela Engert <dani_at_[hidden]>
> *Subject:* [EXTERNAL] Re: [SG15] breakpoint and is_debugger_present
> proposals.
>
> Ben, my imagination is probably too weak, but what is the usecase of
> an unconditional breakpoint that you have in mind?
>
> Looking at my usecases in the recent past, I can see two additional
> variations:
>
> 1) something like 'break_if(expression)'
> Like the proposed std::breakpoint but with an 'expression' that's
> convertible to 'bool' as an additional condition that's evaluated only
> when 'is_debugger_present()' evaluates to 'true'.
>
> 2) something like 'wait_and_break()'
>
> Wait until a debugger attaches and then break into it. An overload
> might take a chrono::duration to limit the wait portion.
>
> I've been using both in situations when the standard, built-in
> debugger features just didn't cut the mustard.
>
> Ciao
> Dani
>
> Am 04.01.2022 um 16:04 schrieb Ben Craig via SG15:
>
> IMO, we need a function that is an unconditional breakpoint,
> similar to what the various compile builtins already provide.
> This could be in addition to the conditional breakpoint. The
> conditional breakpoint can be built from the unconditional
> breakpoint + is_debugger_present, so we should provide the lower
> level building block.
>
> My personal preference is that the unconditional breakpoint gets
> the “good” name of std::breakpoint, but I can live with the
> conditional breakpoint getting the good name.
>
> *From:* SG15 <sg15-bounces_at_[hidden]>
> <mailto:sg15-bounces_at_[hidden]> *On Behalf Of *René
> Ferdinand Rivera Morell via SG15
> *Sent:* Monday, January 3, 2022 8:03 AM
> *To:* sg15_at_[hidden]
> *Cc:* René Ferdinand Rivera Morell <grafikrobot_at_[hidden]>
> <mailto:grafikrobot_at_[hidden]>
> *Subject:* [EXTERNAL] Re: [SG15] breakpoint and
> is_debugger_present proposals.
>
> On Mon, Jan 3, 2022 at 12:22 AM Daniela Engert via SG15
> <sg15_at_[hidden]> wrote:
>
> Am 03.01.2022 um 04:30 schrieb René Ferdinand Rivera Morell
> via SG15:
>
> I just posted for review two tooling related proposals:
>
> * https://wg21.link/P2514R0
> <https://urldefense.com/v3/__https:/wg21.link/P2514R0__;!!FbZ0ZwI3Qg!6_j0JRAKq4oEYMtTXV__u7fJx0Hrlkum5lKzDd1Z3Ru3cqYQENYJgBmF-F7x$>
> -- std::breakpoint
>
> * https://wg21.link/P2514R0
> <https://urldefense.com/v3/__https:/wg21.link/P2514R0__;!!FbZ0ZwI3Qg!6_j0JRAKq4oEYMtTXV__u7fJx0Hrlkum5lKzDd1Z3Ru3cqYQENYJgBmF-F7x$>
> -- std::is_debugger_present
>
> René, was this meant to be the same link?
>
> LOL, indeed.. It should be:
>
> * https://wg21.link/P2514R0
> <https://urldefense.com/v3/__https:/wg21.link/P2514R0__;!!FbZ0ZwI3Qg!6_j0JRAKq4oEYMtTXV__u7fJx0Hrlkum5lKzDd1Z3Ru3cqYQENYJgBmF-F7x$>
> -- std::breakpoint
>
> * https://wg21.link/P2515R0
> <https://urldefense.com/v3/__https:/wg21.link/P2515R0__;!!FbZ0ZwI3Qg!6_j0JRAKq4oEYMtTXV__u7fJx0Hrlkum5lKzDd1Z3Ru3cqYQENYJgCbDELGP$>
> -- std::is_debugger_present
>
> Thanks for noticing :-)
>
> --
>
> -- René Ferdinand Rivera Morell
> -- Don't Assume Anything -- No Supone Nada
> -- Robot Dreams - http://robot-dreams.net
> <https://urldefense.com/v3/__http:/robot-dreams.net/__;!!FbZ0ZwI3Qg!6_j0JRAKq4oEYMtTXV__u7fJx0Hrlkum5lKzDd1Z3Ru3cqYQENYJgMXy2NDm$>
>
> INTERNAL - NI CONFIDENTIAL
>
>
>
> _______________________________________________
>
> SG15 mailing list
>
> SG15_at_[hidden]
>
> https://lists.isocpp.org/mailman/listinfo.cgi/sg15 <https://urldefense.com/v3/__https:/lists.isocpp.org/mailman/listinfo.cgi/sg15__;!!FbZ0ZwI3Qg!7c9X93y0xiFpwZVizknDpEr69jpgs2lgMRNgs5WR9k1IjRGZYRMXFcgu4824$>
>
> --
> PGP/GPG: 2CCB 3ECB 0954 5CD3 B0DB 6AA0 BA03 56A1 2C4638C5
>
>
> INTERNAL - NI CONFIDENTIAL
>

-- 
PGP/GPG: 2CCB 3ECB 0954 5CD3 B0DB 6AA0 BA03 56A1 2C4638C5

Received on 2022-01-04 09:56:21