summaryrefslogtreecommitdiff
path: root/src/utils/checkutils.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-03-08 23:00:29 +0300
committerAndrei Karas <akaras@inbox.ru>2017-03-08 23:03:29 +0300
commit0b26c83fd6c485b6686244a41647324fcf1a1843 (patch)
treed8fe2e447d46287cc0d9e71cc96d5c677ae1eddb /src/utils/checkutils.cpp
parent308ce845d53c6544f9577982eef26cd252ec2f79 (diff)
downloadmv-0b26c83fd6c485b6686244a41647324fcf1a1843.tar.gz
mv-0b26c83fd6c485b6686244a41647324fcf1a1843.tar.bz2
mv-0b26c83fd6c485b6686244a41647324fcf1a1843.tar.xz
mv-0b26c83fd6c485b6686244a41647324fcf1a1843.zip
Enable stack generation if target platform support this.
Diffstat (limited to 'src/utils/checkutils.cpp')
-rw-r--r--src/utils/checkutils.cpp24
1 files changed, 8 insertions, 16 deletions
diff --git a/src/utils/checkutils.cpp b/src/utils/checkutils.cpp
index 10214f0eb..8e72dbf7d 100644
--- a/src/utils/checkutils.cpp
+++ b/src/utils/checkutils.cpp
@@ -24,11 +24,9 @@
#include "logger.h"
-#ifndef ANDROID
-#if defined __linux__ || defined __linux
+#ifdef HAVE_EXECINFO
#include <execinfo.h>
-#endif // defined __linux__ || defined __linux
-#endif // ANDROID
+#endif // HAVE_EXECINFO
#include "debug.h"
@@ -45,11 +43,9 @@ void reportAssertStack(const char *const file,
line,
text,
func);
-#ifndef ANDROID
-#if defined __linux__ || defined __linux
+#ifdef HAVE_EXECINFO
reportStack();
-#endif // defined __linux__ || defined __linux
-#endif // ANDROID
+#endif // HAVE_EXECINFO
}
void reportLogStack(const char *const file,
@@ -60,25 +56,21 @@ void reportLogStack(const char *const file,
file,
line,
func);
-#ifndef ANDROID
-#if defined __linux__ || defined __linux
+#ifdef HAVE_EXECINFO
reportStack();
-#endif // defined __linux__ || defined __linux
-#endif // ANDROID
+#endif // HAVE_EXECINFO
}
void reportStack()
{
-#ifndef ANDROID
-#if defined __linux__ || defined __linux
+#ifdef HAVE_EXECINFO
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
-#endif // ANDROID
+#endif // HAVE_EXECINFO
}
#endif // ENABLE_ASSERTS