Use inline asm for debugbreak on linux to remove stack frames

* raise() adds several stack frames in debug builds, and even an inline function
  will too, regardless of always_inline status.
This commit is contained in:
baldurk
2022-06-15 17:13:56 +01:00
parent f6ac09c4e1
commit 4d8fdf4e31
4 changed files with 13 additions and 9 deletions
+13
View File
@@ -42,11 +42,24 @@
#include <signal.h>
#define __PRETTY_FUNCTION_SIGNATURE__ __PRETTY_FUNCTION__
#if ENABLED(RDOC_SWITCH)
#include <stdlib.h>
#define OS_DEBUG_BREAK() abort()
#elif ENABLED(RDOC_LINUX)
#define OS_DEBUG_BREAK() \
do \
{ \
__asm__ volatile("int $0x03"); \
} while((void)0, 0)
#else
#define OS_DEBUG_BREAK() raise(SIGTRAP)
#endif
#if defined(__clang__)
-1
View File
@@ -464,7 +464,6 @@ void Shutdown();
namespace OSUtility
{
inline void ForceCrash();
inline void DebugBreak();
bool DebuggerPresent();
enum
{
-4
View File
@@ -82,10 +82,6 @@ inline void ForceCrash()
{
__builtin_trap();
}
inline void DebugBreak()
{
raise(SIGTRAP);
}
bool DebuggerPresent();
};
-4
View File
@@ -49,10 +49,6 @@ inline void ForceCrash()
{
*((int *)NULL) = 0;
}
inline void DebugBreak()
{
__debugbreak();
}
inline bool DebuggerPresent()
{
return ::IsDebuggerPresent() == TRUE;