From a738f3c6cec1a3cd6ec8b79166dd3c0aaf467dec Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Mon, 18 Aug 2014 19:24:16 +0200 Subject: [PATCH] Added stacktrace in case of log recursion. --- winpr/libwinpr/utils/wlog/wlog.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/winpr/libwinpr/utils/wlog/wlog.c b/winpr/libwinpr/utils/wlog/wlog.c index c7616483b..0e1512827 100644 --- a/winpr/libwinpr/utils/wlog/wlog.c +++ b/winpr/libwinpr/utils/wlog/wlog.c @@ -26,6 +26,7 @@ #include #include +#include #include #if defined(ANDROID) @@ -64,15 +65,26 @@ static wLogFilter *g_Filters = NULL; static void log_recursion(const char *file, const char *fkt, int line) { - /* TODO: Stack trace here! */ + size_t used, i; + void *bt = winpr_backtrace(20); + char **msg = winpr_backtrace_symbols(bt, &used); + #if defined(ANDROID) const char *tag = WINPR_TAG("utils.wlog"); __android_log_print(ANDROID_LOG_FATAL, tag, "Recursion detected!!!"); __android_log_print(ANDROID_LOG_FATAL, tag, "Check %s [%s:%d]", fkt, file, line); + for (i=0; i