Call raise for DebuggerBreak() in non-debug mode on OS X and define import for Plat_DebugString() on Linux and OS X.

This changes come from the 2013 SDK but they also seem to match Dota 2 code on these platforms.
This commit is contained in:
Scott Ehlert 2014-03-04 15:09:50 -06:00
parent 82969bfa84
commit 0058f609e5

View File

@ -661,7 +661,11 @@ typedef unsigned int uint;
#elif COMPILER_MSVCX360
#define DebuggerBreak() DebugBreak()
#elif COMPILER_GCC
#if defined( PLATFORM_CYGWIN ) || defined( PLATFORM_POSIX )
#if defined( PLATFORM_OSX )
// On OSX, SIGTRAP doesn't really stop the thread cold when debugging.
// So if being debugged, use INT3 which is precise.
#define DebuggerBreak() { if ( Plat_IsInDebugSession() ) { __asm ( "int $3" ); } else { raise(SIGTRAP); } }
#elif defined( PLATFORM_CYGWIN ) || defined( PLATFORM_POSIX )
#define DebuggerBreak() __asm__( "int $0x3;")
#else
#define DebuggerBreak() asm( "int3" )
@ -696,14 +700,14 @@ typedef unsigned int uint;
//-----------------------------------------------------------------------------
// Returns true if debugger attached, false otherwise
//-----------------------------------------------------------------------------
#if defined( PLATFORM_WINDOWS )
#if defined( PLATFORM_WINDOWS ) || defined( PLATFORM_LINUX ) || defined( PLATFORM_OSX )
PLATFORM_INTERFACE bool Plat_IsInDebugSession();
PLATFORM_INTERFACE void Plat_DebugString( const tchar * );
#else
inline bool Plat_IsInDebugSession() { return false; }
#define Plat_DebugString(s) ((void)0)
#endif
PLATFORM_INTERFACE bool Plat_IsInDebugSession();
#define DebuggerBreakIfDebugging() if ( !Plat_IsInDebugSession() ) ; else DebuggerBreak()
@ -746,6 +750,7 @@ PLATFORM_INTERFACE void Plat_MessageBox( const char *pTitle, const tchar *pMessa
#include <alloca.h>
#include <unistd.h> // get unlink
#include <signal.h>
#include <errno.h>
#endif // PLATFORM_POSIX