Allow disabling pretty traces and remove dependency on libdw.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2020-08-17 20:08:23 +02:00
parent 37b1e16b34
commit d59c13a34d
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
2 changed files with 8 additions and 1 deletions

View File

@ -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)

View File

@ -6,7 +6,9 @@
#include <string>
#include <utility>
#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) {