From 3b5d2b7da06c32b15d2a524f84974081b233da50 Mon Sep 17 00:00:00 2001 From: Timo Kokkonen Date: Tue, 7 Dec 2010 21:57:00 +0200 Subject: [PATCH] quadtree.c: Print line number when trap is caught This helps debugging Signed-off-by: Timo Kokkonen --- quadtree.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/quadtree.c b/quadtree.c index 80b285a..79039c6 100644 --- a/quadtree.c +++ b/quadtree.c @@ -9,12 +9,18 @@ #define debug 0 #endif -static void trap(void) +static void _trap(int line) { - if (debug) + if (debug) { + printf("Trapped from line %d, use debugger to get backtrace\n", + line); + fflush(stdout); exit(1); + } } +#define trap() _trap(__LINE__) + static int quadtree_compare_coord(const struct vector *a, const struct vector *b) { -- 2.45.0