aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32
diff options
context:
space:
mode:
Diffstat (limited to 'OpenAL32')
-rw-r--r--OpenAL32/Include/alError.h2
-rw-r--r--OpenAL32/alError.c17
2 files changed, 19 insertions, 0 deletions
diff --git a/OpenAL32/Include/alError.h b/OpenAL32/Include/alError.h
index 7976e50f..f3a9c12d 100644
--- a/OpenAL32/Include/alError.h
+++ b/OpenAL32/Include/alError.h
@@ -8,6 +8,8 @@
extern "C" {
#endif
+extern ALboolean TrapALError;
+
ALvoid alSetError(ALCcontext *Context, ALenum errorCode);
#ifdef __cplusplus
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);
}