std::is_debugger_present(3)
π NAME π
std::is_debugger_present - std::is_debugger_present
okay bestie, welcome to std::is_debugger_present(3) from the C++ Standard Libary manual (yes, that spelling is literally in the header β keeping the facts exactly as they are). This page is about one function and she's lowkey iconic: she checks whether your program is running with a debugger present. π«Ά
β¨ Synopsis β¨
Defined in header <debugging>
bool is_debugger_present() noexcept; (since C++26)
Attempts to determine if the program is being executed with debugger present. Like, is somebody watching? π
By default, the behavior of this function is completely implementation-defined. A C++ program may provide the definition of this signature to replace the behavior of this function. So the default vibe is βyour implementation decidesβ, but you can provide your own definition of this exact signature and swap the behavior out. π
πΈ Return value πΈ
The default version returns true if, to the best of its knowledge, the program is executed under a debugger.
π¦ Notes π¦
The intent of this function is allowing:
- printing out extra output to help diagnose problems
- executing extra test code
- displaying an extra user interface to help in debugging
- etc.
This function standardizes many similar existing facilities:
under_debuggerfrom boost.testIsDebuggerPresent()from Win32 APIisDebuggerActivefrom Catch2IsDebuggerPresentfrom Unreal Engine- etc.
Feature-test macro deets, and yes we're keeping every value:
__cpp_lib_debuggingβ202311Lβ(C++26)β Debugging support library__cpp_lib_debuggingβ202403Lβ(C++26)β Replaceablestd::is_debugger_present
π Example π
This section is incomplete
Reason: no example
no example yet, bestie β the page literally says so. π
π See also π
breakpointβ pauses the running program when called(C++26)(function)breakpoint_if_debuggingβ callsstd::breakpointifstd::is_debugger_presentreturnstrue(C++26)(function)
π Category π
- Todo no example
source/version + date sign-off: http://cppreference.com, 2024.06.10, page std::is_debugger_present(3) β that's the footer, and we ate. πβ¨
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms