I am strongly in favour of this feature. It has been implemented cross-platform in the
JUCE framework, where it has proven to be very useful in practice. It is used in JUCE’s jassert macro, which triggers a breakpoint whenever an assertion fails, if (and only if) we are running a debug build and a debugger is attached:
This has always worked well for me on all the relevant platforms.
juce_isRunningUnderDebugger() (equivalent of std::is_debugger_present) is implemented as follows:
I hope this is useful.