From c5ff02958806ea5a672dcc9371602a6c090c6758 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 26 May 2015 01:07:08 +0300 Subject: Dump stack in nullpo*/Assert* function. Also enable in configure linker flag -rdynamic. --- src/common/nullpo.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src') diff --git a/src/common/nullpo.c b/src/common/nullpo.c index e61d52257..97b206835 100644 --- a/src/common/nullpo.c +++ b/src/common/nullpo.c @@ -8,7 +8,11 @@ #include #include +#include #include +#ifdef __GNUC__ +#include +#endif #include "../common/showmsg.h" @@ -24,6 +28,12 @@ struct nullpo_interface nullpo_s; * @param title Message title to display (i.e. failed assertion or nullpo info) */ void assert_report(const char *file, int line, const char *func, const char *targetname, const char *title) { +#ifdef __GNUC__ + void *array[10]; + int size; + char **strings; + int i; +#endif if (file == NULL) file = "??"; @@ -32,6 +42,13 @@ void assert_report(const char *file, int line, const char *func, const char *tar ShowError("--- %s --------------------------------------------\n", title); ShowError("%s:%d: '%s' in function `%s'\n", file, line, targetname, func); +#ifdef __GNUC__ + size = backtrace (array, 10); + strings = backtrace_symbols (array, size); + for (i = 0; i < size; i++) + ShowError("%s\n", strings[i]); + free (strings); +#endif ShowError("--- end %s ----------------------------------------\n", title); } -- cgit v1.2.3-60-g2f50