summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
authorJosé Fonseca <jrfonseca@tungstengraphics.com>2008-03-12 15:01:18 +0000
committerJosé Fonseca <jrfonseca@tungstengraphics.com>2008-03-12 15:02:50 +0000
commita2ea51ed828d8b503492a7b42ac937d2642ac4f1 (patch)
tree7041a10531998a0ffd7075fc1ef8b14f91c4fcf5 /src/gallium/auxiliary
parent70ae7f09c739465242b0c6255196dae1de9dd8d3 (diff)
gallium: Change assert behavior on runtime (Mark Mueller).
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r--src/gallium/auxiliary/util/p_debug.c38
1 files changed, 36 insertions, 2 deletions
diff --git a/src/gallium/auxiliary/util/p_debug.c b/src/gallium/auxiliary/util/p_debug.c
index 04e55dd91d..09cabdae25 100644
--- a/src/gallium/auxiliary/util/p_debug.c
+++ b/src/gallium/auxiliary/util/p_debug.c
@@ -36,8 +36,9 @@
#include <stdlib.h>
#endif
-#include "pipe/p_debug.h"
#include "pipe/p_compiler.h"
+#include "pipe/p_util.h"
+#include "pipe/p_debug.h"
#ifdef WIN32
@@ -97,11 +98,44 @@ static INLINE void debug_break(void)
#endif
}
+#if defined(WIN32)
+ULONG_PTR debug_config_file = 0;
+void *mapped_config_file = 0;
+
+enum {
+ eAssertAbortEn = 0x1,
+};
+
+/* Check for aborts enabled. */
+static unsigned abort_en()
+{
+ if (!mapped_config_file)
+ {
+ /* Open an 8 byte file for configuration data. */
+ mapped_config_file = EngMapFile(L"\\??\\c:\\gaDebug.cfg", 8, &debug_config_file);
+ }
+ /* An value of "0" (ascii) in the configuration file will clear the first 8 bits in the test byte. */
+ /* An value of "1" (ascii) in the configuration file will set the first bit in the test byte. */
+ /* An value of "2" (ascii) in the configuration file will set the second bit in the test byte. */
+ return ((((char *)mapped_config_file)[0]) - 0x30) & eAssertAbortEn;
+}
+#else /* WIN32 */
+static unsigned abort_en()
+{
+ return !GETENV("GALLIUM_ABORT_ON_ASSERT");
+}
+#endif
void debug_assert_fail(const char *expr, const char *file, unsigned line)
{
debug_printf("%s:%i: Assertion `%s' failed.\n", file, line, expr);
- debug_break();
+ if (abort_en())
+ {
+ debug_break();
+ } else
+ {
+ debug_printf("continuing...\n");
+ }
}