Stroika Library 3.0d16
 
Loading...
Searching...
No Matches
Debugger.h
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2025. All rights reserved
3 */
4#ifndef _Stroika_Foundation_Debug_Debugger_h_
5#define _Stroika_Foundation_Debug_Debugger_h_ 1
6
7#include "Stroika/Foundation/StroikaPreComp.h"
8
9#include <optional>
10
11#include "Stroika/Foundation/Common/Common.h"
12
13namespace Stroika::Foundation::Debug {
14
15 /**
16 * There is no perfect cross-platform way to check this. But this function tries, and returns true/false if it
17 * has a good guess and nullopt if it has no idea.
18 *
19 * \see https://en.cppreference.com/w/cpp/utility/is_debugger_present
20 */
21 optional<bool> IsThisProcessBeingDebugged ();
22
23 /**
24 * Try to drop into the debugger, if IsThisProcessBeingDebugged () returns true.
25 *
26 * \note - highly imperfect, may false positive/negative, especially debugging on quirks of your platform/OS.
27 */
28 void DropIntoDebuggerIfPresent ();
29
30}
31
32#endif /*_Stroika_Foundation_Debug_Debugger_h_*/