carb::extras::isDebuggerAttached

Defined in carb/extras/Debugging.h

inline bool carb::extras::isDebuggerAttached(void)

Checks if a debugger is attached to the calling process.

Remark

This checks if a debugger is currently attached to the calling process. This will query the current state of the debugger so that a process can disable some debug- only checks at runtime if the debugger is ever detached. If a debugger is attached to a running process, this will start returning true again.

Note

On Linux and related platforms, the debugger check is a relatively expensive operation. To avoid unnecessary overhead explicitly checking this state each time, the last successfully queried state will be cached for a short period. Future calls within this period will simply return the cached state instead of querying again.

Returns

true if a user-mode debugger is currently attached to the calling process.

Returns

false if the calling process does not have a debugger attached.