diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2014-12-01 10:00:32 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2014-12-01 10:00:32 +0000 |
commit | ddf5feba786cf0147c4db9720c96e9a5636573b0 (patch) | |
tree | c9725f56607d249b7a18bba4b40c8ce2a6818419 /src | |
parent | e12ec452a99396f76138a5961c8195e22ca12ac1 (diff) |
sna: Generate a backtrace on assertion failures
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src')
-rw-r--r-- | src/sna/xassert.h | 10 |
1 files 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 <os.h> #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 |