gallium: Use debug_get_bool_option for controlling assert failure behaviour.
Add GALLIUM_ABORT_ON_ASSERT=no to C:\gallium.cfg instead.
This commit is contained in:
@@ -200,6 +200,8 @@ debug_get_bool_option(const char *name, boolean dfault)
|
||||
|
||||
if(str == NULL)
|
||||
result = dfault;
|
||||
else if(!strcmp(str, "n"))
|
||||
result = FALSE;
|
||||
else if(!strcmp(str, "no"))
|
||||
result = FALSE;
|
||||
else if(!strcmp(str, "0"))
|
||||
@@ -251,57 +253,16 @@ debug_get_flags_option(const char *name,
|
||||
}
|
||||
|
||||
|
||||
#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(void)
|
||||
{
|
||||
if (!mapped_config_file)
|
||||
{
|
||||
/* Open an 8 byte file for configuration data. */
|
||||
mapped_config_file = EngMapFile(L"\\??\\c:\\gaDebug.cfg", 8, &debug_config_file);
|
||||
}
|
||||
|
||||
/* A value of "0" (ascii) in the configuration file will clear the
|
||||
* first 8 bits in the test byte.
|
||||
*
|
||||
* A value of "1" (ascii) in the configuration file will set the
|
||||
* first bit in the test byte.
|
||||
*
|
||||
* A value of "2" (ascii) in the configuration file will set the
|
||||
* second bit in the test byte.
|
||||
*
|
||||
* Currently the only interesting values are 0 and 1, which clear
|
||||
* and set abort-on-assert behaviour respectively.
|
||||
*/
|
||||
return ((((char *)mapped_config_file)[0]) - 0x30) & eAssertAbortEn;
|
||||
}
|
||||
#else /* WIN32 */
|
||||
static unsigned abort_en(void)
|
||||
{
|
||||
return !GETENV("GALLIUM_ABORT_ON_ASSERT");
|
||||
}
|
||||
#endif
|
||||
|
||||
void _debug_assert_fail(const char *expr,
|
||||
const char *file,
|
||||
unsigned line,
|
||||
const char *function)
|
||||
{
|
||||
_debug_printf("%s:%u:%s: Assertion `%s' failed.\n", file, line, function, expr);
|
||||
if (abort_en())
|
||||
{
|
||||
if (debug_get_bool_option("GALLIUM_ABORT_ON_ASSERT", TRUE))
|
||||
debug_break();
|
||||
} else
|
||||
{
|
||||
else
|
||||
_debug_printf("continuing...\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user