From 55cf02221f0654a3f48888f3b13766b671a120f0 Mon Sep 17 00:00:00 2001 From: Katerina Barone-Adesi Date: Tue, 12 Mar 2013 10:23:52 +0100 Subject: utils: Use fprintf to print the assertion and generate a backtrace This is changing the semantic of the assert. The regression tests now either need to check the stderr result, the exit status or print a message when all tests are completed. This is not that bad as the osmo_generate_backtrace is printing to the stdout right now. --- include/osmocom/core/utils.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/osmocom/core/utils.h b/include/osmocom/core/utils.h index 8f7bee31..f8e6fc96 100644 --- a/include/osmocom/core/utils.h +++ b/include/osmocom/core/utils.h @@ -53,7 +53,8 @@ do { \ #define OSMO_ASSERT(exp) \ if (!(exp)) { \ - printf("Assert failed %s %s:%d\n", #exp, __FILE__, __LINE__); \ + fprintf(stderr, "Assert failed %s %s:%d\n", #exp, __FILE__, __LINE__); \ + osmo_generate_backtrace(); \ abort(); \ } -- cgit v1.2.3 [cgit] Unable to lock slot /tmp/cgit/19000000.lock: No such file or directory (2)