summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-05-11 21:01:04 +0300
committerAndrei Karas <akaras@inbox.ru>2016-05-11 21:01:04 +0300
commit84cdb48df045cae55356b3d6156794c9e0343f54 (patch)
tree9c7f729bcd3120a3e2e855563e68f3e3a130ccb3
parentdbcbc901992ec3a54ec3a1730029b25d94d679b1 (diff)
downloadplus-84cdb48df045cae55356b3d6156794c9e0343f54.tar.gz
plus-84cdb48df045cae55356b3d6156794c9e0343f54.tar.bz2
plus-84cdb48df045cae55356b3d6156794c9e0343f54.tar.xz
plus-84cdb48df045cae55356b3d6156794c9e0343f54.zip
Add into catch reporting stack where exception happend.
-rw-r--r--src/catch.hpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/catch.hpp b/src/catch.hpp
index 46d065fbb..a5563d7a7 100644
--- a/src/catch.hpp
+++ b/src/catch.hpp
@@ -75,6 +75,14 @@
#include <stdexcept>
#include <algorithm>
+// stack
+#ifndef ANDROID
+#if defined __linux__ || defined __linux
+#include <execinfo.h>
+#endif // defined __linux__ || defined __linux
+#endif // ANDROID
+// stack
+
// #included from: catch_compiler_capabilities.h
#define TWOBLUECUBES_CATCH_COMPILER_CAPABILITIES_HPP_INCLUDED
@@ -6064,6 +6072,21 @@ namespace Catch {
ResultBuilder resultBuilder = makeUnexpectedResultBuilder();
resultBuilder.setResultType( ResultWas::FatalErrorCondition );
resultBuilder << message;
+// stack
+#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++)
+ resultBuilder << strings[i];
+ free(strings);
+ }
+#endif // defined __linux__ || defined __linux
+#endif // ANDROID
+// stack
+
resultBuilder.captureExpression();
handleUnfinishedSections();