aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32/alError.c
diff options
context:
space:
mode:
Diffstat (limited to 'OpenAL32/alError.c')
-rw-r--r--OpenAL32/alError.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/OpenAL32/alError.c b/OpenAL32/alError.c
index 29d06027..8b95423b 100644
--- a/OpenAL32/alError.c
+++ b/OpenAL32/alError.c
@@ -20,10 +20,14 @@
#include "config.h"
+#include <signal.h>
+
#include "alMain.h"
#include "AL/alc.h"
#include "alError.h"
+ALboolean TrapALError = AL_FALSE;
+
AL_API ALenum AL_APIENTRY alGetError(void)
{
ALCcontext *Context;
@@ -41,5 +45,18 @@ AL_API ALenum AL_APIENTRY alGetError(void)
ALvoid alSetError(ALCcontext *Context, ALenum errorCode)
{
+ if(TrapALError)
+ {
+#ifdef _WIN32
+ /* Safely catch a breakpoint exception that wasn't caught by a debugger */
+ __try {
+ DebugBreak();
+ } __except((GetExceptionCode()==EXCEPTION_BREAKPOINT) ?
+ EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) {
+ }
+#elif defined(SIGTRAP)
+ kill(getpid(), SIGTRAP);
+#endif
+ }
CompExchangeInt(&Context->LastError, AL_NO_ERROR, errorCode);
}