From c124712cface453ca6d106cdc0bf0680c556fa66 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 11 May 2016 18:34:21 +0300 Subject: Extend checkutils functions. --- src/utils/checkutils.cpp | 47 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 34 insertions(+), 13 deletions(-) (limited to 'src/utils/checkutils.cpp') diff --git a/src/utils/checkutils.cpp b/src/utils/checkutils.cpp index 275c4e447..661e3efa2 100644 --- a/src/utils/checkutils.cpp +++ b/src/utils/checkutils.cpp @@ -32,33 +32,54 @@ #include "debug.h" -void reportStack(const char *const file, - const unsigned int line, - const char *const func, - const char *const name, - const char *const text) +void reportAssertStack(const char *const file, + const unsigned int line, + const char *const func, + const char *const name, + const char *const text) { + logger->log("--- Assert: %s --------------------------------------------", + name); + logger->assertLog("%s:%u: '%s' in function `%s'", + file, + line, + text, + func); #ifndef ANDROID #if defined __linux__ || defined __linux - void *array[15]; - int size; - char **strings; - int i; + reportStack(); #endif // defined __linux__ || defined __linux #endif // ANDROID +} +void reportLogStack(const char *const file, + const unsigned int line, + const char *const func, + const char *const name, + const char *const text) +{ logger->log("--- Assert: %s --------------------------------------------", name); - logger->assertLog("%s:%u: '%s' in function `%s'", + logger->log("%s:%u: '%s' in function `%s'", file, line, text, func); #ifndef ANDROID #if defined __linux__ || defined __linux - size = static_cast(backtrace(array, 15)); - strings = backtrace_symbols(array, size); - for (i = 0; i < size; i++) + reportStack(); +#endif // defined __linux__ || defined __linux +#endif // ANDROID +} + +void reportStack() +{ +#ifndef ANDROID +#if defined __linux__ || defined __linux + void *array[15]; + const int size = static_cast(backtrace(array, 15)); + char **strings = backtrace_symbols(array, size); + for (int i = 0; i < size; i++) logger->log1(strings[i]); free(strings); #endif // defined __linux__ || defined __linux -- cgit v1.2.3-70-g09d2