mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-11 18:06:13 +00:00
lib: Make igt_assert() abort under gdb
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
398be7d573
commit
2a37b1d78e
@ -894,12 +894,23 @@ void igt_fail(int exitcode)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool run_under_gdb(void)
|
||||||
|
{
|
||||||
|
char buf[1024];
|
||||||
|
|
||||||
|
sprintf(buf, "/proc/%d/exe", getppid());
|
||||||
|
return (readlink (buf, buf, sizeof (buf)) != -1 &&
|
||||||
|
strncmp (basename (buf), "gdb", 3) == 0);
|
||||||
|
}
|
||||||
|
|
||||||
void __igt_fail_assert(int exitcode, const char *file,
|
void __igt_fail_assert(int exitcode, const char *file,
|
||||||
const int line, const char *func, const char *assertion)
|
const int line, const char *func, const char *assertion)
|
||||||
{
|
{
|
||||||
printf("Test assertion failure function %s, file %s:%i:\n"
|
printf("Test assertion failure function %s, file %s:%i:\n"
|
||||||
"Failed assertion: %s\n",
|
"Failed assertion: %s\n",
|
||||||
func, file, line, assertion);
|
func, file, line, assertion);
|
||||||
|
if (run_under_gdb())
|
||||||
|
abort();
|
||||||
igt_fail(exitcode);
|
igt_fail(exitcode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user