From 68897f04bd60624fb57d1bd5add4ca7aed1d5e50 Mon Sep 17 00:00:00 2001 From: Stefan Boberg Date: Fri, 17 Sep 2021 15:39:49 +0200 Subject: Added IsDebuggerPresent() query function to query whether a debugger is currently attached to the running process --- zencore/include/zencore/zencore.h | 2 +- zencore/zencore.cpp | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/zencore/include/zencore/zencore.h b/zencore/include/zencore/zencore.h index da17e61e3..14f915e76 100644 --- a/zencore/include/zencore/zencore.h +++ b/zencore/include/zencore/zencore.h @@ -155,7 +155,7 @@ namespace zen { ZENCORE_API bool IsPointerToStack(const void* ptr); // Query if pointer is within the stack of the currently executing thread ZENCORE_API bool IsApplicationExitRequested(); ZENCORE_API void RequestApplicationExit(int ExitCode); - +ZENCORE_API bool IsDebuggerPresent(); ZENCORE_API void zencore_forcelinktests(); } diff --git a/zencore/zencore.cpp b/zencore/zencore.cpp index 5899f014d..bb457ed0a 100644 --- a/zencore/zencore.cpp +++ b/zencore/zencore.cpp @@ -30,6 +30,8 @@ namespace zen { +////////////////////////////////////////////////////////////////////////// + bool IsPointerToStack(const void* ptr) { @@ -55,6 +57,18 @@ IsPointerToStack(const void* ptr) #endif } +bool +IsDebuggerPresent() +{ +#if ZEN_PLATFORM_WINDOWS + return ::IsDebuggerPresent(); +#else + return false; +#endif +} + +////////////////////////////////////////////////////////////////////////// + AssertException::AssertException(const char* Msg) : m_Msg(Msg) { } -- cgit v1.2.3