std::is_debugger_present
Defined in header <debugging> | ||
|---|---|---|
bool is_debugger_present() noexcept; | (since C++26) |
Attempts to determine if the program is being executed with debugger present.
This function is replaceable.
Return value
The default version returns an implementation-defined value, which usually represents whether 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.
| Feature-test macro | Value | Std | Feature |
|---|---|---|---|
__cpp_lib_debugging | 202311L | (C++26) | Debugging support library |
202403L | (C++26) | Replaceable std::is_debugger_present |
Example
See also
|
(C++26) | pauses the running program when called (function) |
|
(C++26) | calls std::breakpoint if std::is_debugger_present returns true (function) |
External links
is_debugger_present standardizes many similar existing facilities, e.g.:
| 1. |
under_debugger from boost.test |
| 2. |
IsDebuggerPresent() from Win32 API |
| 3. |
isDebuggerActive from Catch2 |
| 4. |
IsDebuggerPresent from Unreal Engine |
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/cpp/utility/is_debugger_present