summaryrefslogtreecommitdiff
path: root/src/utils/checkutils.cpp
diff options
context:
space:
mode:
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