From d59c13a34d6d625adc4e770560b87cea75ff57e6 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Mon, 17 Aug 2020 20:08:23 +0200 Subject: [PATCH] Allow disabling pretty traces and remove dependency on libdw. --- CMakeLists.txt | 4 +++- src/Exception.hpp | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 77e6c18..9d4b1c5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,7 @@ option(WINDOWS "Whether the build target is Windows or not." OFF) option(SHARED "Whether we should build a shared library, instead of a static one." OFF) option(TESTS "Whether the test executable should be build as well." OFF) option(STATICC "Whether gcc and stdc++ should be linked statically to the library." OFF) +option(PRETTYTRACES "Whether full stacktraces should be included. Note that this adds a dependency to libdw." ON) # Set whether we want a static or shared library. set(LIBTYPE STATIC) @@ -47,8 +48,9 @@ if (WINDOWS) endif (WINDOWS) set(LINKS) -if (NOT WINDOWS) +if (NOT WINDOWS AND PRETTYTRACES) set(LINKS ${LINKS} -ldw) + ADD_DEFINITIONS(-DPRETTYTRACES=1) endif() # If we want to link the C and C++ library statically, link those as well. if (STATICC) diff --git a/src/Exception.hpp b/src/Exception.hpp index 5562f00..d77046e 100644 --- a/src/Exception.hpp +++ b/src/Exception.hpp @@ -6,7 +6,9 @@ #include #include #if !WINDOWS +#if PRETTYTRACES #define BACKWARD_HAS_DW 1 +#endif #include "../extern/backward.hpp" #endif @@ -53,6 +55,9 @@ namespace ArbUt { backward::ResolvedTrace trace = tr.resolve(_stack[i]); if (trace.source.filename.empty()) { AppendNoSourceStack(ss, trace, include_addr); + if (foundExceptionClass) { + framesAppended++; + } } else { AppendSourceStack(ss, trace.source, foundExceptionClass, snippetFactory); if (foundExceptionClass) {