From 84cdb48df045cae55356b3d6156794c9e0343f54 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 11 May 2016 21:01:04 +0300 Subject: Add into catch reporting stack where exception happend. --- src/catch.hpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/catch.hpp') 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 #include +// stack +#ifndef ANDROID +#if defined __linux__ || defined __linux +#include +#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(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(); -- cgit v1.2.3-60-g2f50