From ddf5feba786cf0147c4db9720c96e9a5636573b0 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Mon, 1 Dec 2014 10:00:32 +0000 Subject: [PATCH] sna: Generate a backtrace on assertion failures Signed-off-by: Chris Wilson --- src/sna/xassert.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/sna/xassert.h b/src/sna/xassert.h index 7252ae82..1bcfd080 100644 --- a/src/sna/xassert.h +++ b/src/sna/xassert.h @@ -33,9 +33,15 @@ #ifndef NDEBUG #include #include "compiler.h" + +#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1,6,0,0,0) +#define xorg_backtrace() +#endif + #undef assert -#define assert(E) do { \ - if (unlikely(!(E))) FatalError("%s:%d assertion '%s' failed\n", __func__, __LINE__, #E); \ +#define assert(E) do if (unlikely(!(E))) { \ + xorg_backtrace(); \ + FatalError("%s:%d assertion '%s' failed\n", __func__, __LINE__, #E); \ } while (0) #endif