From a728f3289ba00bd618d692c97c51128f14ead1de Mon Sep 17 00:00:00 2001 From: Baldur Karlsson Date: Mon, 28 Jul 2014 12:17:34 +0100 Subject: [PATCH] move RDCBREAK() OS-implementation from inline function to macro * It's a little messier as it's easier for the os-specific header to not define it and get confusing errors, but that's a one-time problem and having an extra function in a callstack and not showing source at the point of the RDCBREAK is annoying every time. --- renderdoc/common/common.h | 2 +- renderdoc/os/linux_specific.h | 2 ++ renderdoc/os/win32_specific.h | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/renderdoc/common/common.h b/renderdoc/common/common.h index b65850987..7f0e8c79f 100644 --- a/renderdoc/common/common.h +++ b/renderdoc/common/common.h @@ -94,7 +94,7 @@ bool FindDiffRange(void *a, void *b, size_t bufSize, size_t &diffStart, size_t & #define RDCDUMP() do { OSUtility::ForceCrash(); } while(0) #if !defined(RELEASE) || defined(FORCE_DEBUGBREAK) -#define RDCBREAK() do { if(OSUtility::DebuggerPresent()) OSUtility::DebugBreak(); else RDCDUMP(); } while(0) +#define RDCBREAK() do { if(OSUtility::DebuggerPresent()) OS_DEBUG_BREAK(); else RDCDUMP(); } while(0) #else #define RDCBREAK() do { } while(0) #endif diff --git a/renderdoc/os/linux_specific.h b/renderdoc/os/linux_specific.h index 2d6a6cf38..266d07f46 100644 --- a/renderdoc/os/linux_specific.h +++ b/renderdoc/os/linux_specific.h @@ -32,6 +32,8 @@ #define __PRETTY_FUNCTION_SIGNATURE__ __PRETTY_FUNCTION__ +#define OS_DEBUG_BREAK() raise(SIGTRAP) + #define GetEmbeddedResource(filename) string( CONCAT(CONCAT(_binary_, filename), _start) , CONCAT(CONCAT(_binary_, filename), _end) ) namespace OSUtility diff --git a/renderdoc/os/win32_specific.h b/renderdoc/os/win32_specific.h index e73ee57b6..4300aa8f8 100644 --- a/renderdoc/os/win32_specific.h +++ b/renderdoc/os/win32_specific.h @@ -30,6 +30,8 @@ #define __PRETTY_FUNCTION_SIGNATURE__ __FUNCSIG__ +#define OS_DEBUG_BREAK() __debugbreak() + #define GetEmbeddedResource(filename) GetEmbeddedResourceWin32( CONCAT(RESOURCE_, filename) ) string GetEmbeddedResourceWin32(int resource);