mirror of
https://github.com/bkaradzic/bx.git
synced 2026-02-21 14:23:03 +01:00
Initial commit.
This commit is contained in:
31
include/bx/debug.h
Normal file
31
include/bx/debug.h
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright 2010-2012 Branimir Karadzic. All rights reserved.
|
||||
* License: http://www.opensource.org/licenses/BSD-2-Clause
|
||||
*/
|
||||
|
||||
#ifndef __BX_DEBUG_H__
|
||||
#define __BX_DEBUG_H__
|
||||
|
||||
#include "bx.h"
|
||||
|
||||
namespace bx
|
||||
{
|
||||
inline void debugBreak()
|
||||
{
|
||||
#if BX_COMPILER_MSVC
|
||||
__debugbreak();
|
||||
#elif BX_CPU_ARM
|
||||
asm("bkpt 0");
|
||||
#elif !BX_PLATFORM_NACL && BX_CPU_X86 && (BX_COMPILER_GCC || BX_COMPILER_CLANG)
|
||||
// NaCl doesn't like int 3:
|
||||
// NativeClient: NaCl module load failed: Validation failure. File violates Native Client safety rules.
|
||||
__asm__ ("int $3");
|
||||
#else // cross platform implementation
|
||||
int* int3 = (int*)3L;
|
||||
*int3 = 3;
|
||||
#endif // BX
|
||||
}
|
||||
|
||||
} // namespace bx
|
||||
|
||||
#endif // __BX_DEBUG_H__
|
||||
Reference in New Issue
Block a user