summaryrefslogtreecommitdiff
path: root/src/utils/checkutils.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-05-11 18:34:21 +0300
committerAndrei Karas <akaras@inbox.ru>2016-05-11 18:45:43 +0300
commitc124712cface453ca6d106cdc0bf0680c556fa66 (patch)
treef76f262a61376aa512238d5a097a6b2131dc1059 /src/utils/checkutils.cpp
parent47a1aa9870c5187b1f5417bae8485e20e08f962d (diff)
downloadplus-c124712cface453ca6d106cdc0bf0680c556fa66.tar.gz
plus-c124712cface453ca6d106cdc0bf0680c556fa66.tar.bz2
plus-c124712cface453ca6d106cdc0bf0680c556fa66.tar.xz
plus-c124712cface453ca6d106cdc0bf0680c556fa66.zip
Extend checkutils functions.
Diffstat (limited to 'src/utils/checkutils.cpp')
-rw-r--r--src/utils/checkutils.cpp47
1 files changed, 34 insertions, 13 deletions
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<int>(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<int>(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