mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-05 01:20:42 +00:00
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:
@@ -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__)
|
||||
|
||||
@@ -464,7 +464,6 @@ void Shutdown();
|
||||
namespace OSUtility
|
||||
{
|
||||
inline void ForceCrash();
|
||||
inline void DebugBreak();
|
||||
bool DebuggerPresent();
|
||||
enum
|
||||
{
|
||||
|
||||
@@ -82,10 +82,6 @@ inline void ForceCrash()
|
||||
{
|
||||
__builtin_trap();
|
||||
}
|
||||
inline void DebugBreak()
|
||||
{
|
||||
raise(SIGTRAP);
|
||||
}
|
||||
bool DebuggerPresent();
|
||||
};
|
||||
|
||||
|
||||
@@ -49,10 +49,6 @@ inline void ForceCrash()
|
||||
{
|
||||
*((int *)NULL) = 0;
|
||||
}
|
||||
inline void DebugBreak()
|
||||
{
|
||||
__debugbreak();
|
||||
}
|
||||
inline bool DebuggerPresent()
|
||||
{
|
||||
return ::IsDebuggerPresent() == TRUE;
|
||||
|
||||
Reference in New Issue
Block a user