diff options
-rw-r--r-- | CMakeLists.txt | 8 | ||||
-rw-r--r-- | common/CMakeLists.txt | 1 | ||||
-rw-r--r-- | common/log.c | 5 |
3 files changed, 13 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 5cd9c67b..cabdc468 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
@@ -58,6 +58,14 @@ find_package(Pango) | |||
58 | find_package(GdkPixbuf) | 58 | find_package(GdkPixbuf) |
59 | find_package(PAM) | 59 | find_package(PAM) |
60 | 60 | ||
61 | find_package(Backtrace) | ||
62 | if(Backtrace_FOUND) | ||
63 | include_directories(${Backtrace_INCLUDE_DIRS}) | ||
64 | target_link_libraries(${Backtrace_LIBRARIES}) | ||
65 | add_definitions(-DSWAY_Backtrace_FOUND=1) | ||
66 | set(SWAY_Backtrace_HEADER "${Backtrace_HEADER}") | ||
67 | endif() | ||
68 | |||
61 | include(FeatureSummary) | 69 | include(FeatureSummary) |
62 | include(Manpage) | 70 | include(Manpage) |
63 | 71 | ||
diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index a40f096d..95617e15 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt | |||
@@ -1,4 +1,5 @@ | |||
1 | add_library(sway-common | 1 | add_library(sway-common |
2 | ${SWAY_Backtrace_HEADER} | ||
2 | ipc-client.c | 3 | ipc-client.c |
3 | list.c | 4 | list.c |
4 | log.c | 5 | log.c |
diff --git a/common/log.c b/common/log.c index 02aac4c1..f9242bf4 100644 --- a/common/log.c +++ b/common/log.c | |||
@@ -10,7 +10,6 @@ | |||
10 | #include <errno.h> | 10 | #include <errno.h> |
11 | #include <string.h> | 11 | #include <string.h> |
12 | #include <stringop.h> | 12 | #include <stringop.h> |
13 | #include <execinfo.h> | ||
14 | 13 | ||
15 | int colored = 1; | 14 | int colored = 1; |
16 | log_importance_t loglevel_default = L_ERROR; | 15 | log_importance_t loglevel_default = L_ERROR; |
@@ -137,6 +136,7 @@ bool _sway_assert(bool condition, const char* format, ...) { | |||
137 | } | 136 | } |
138 | 137 | ||
139 | void error_handler(int sig) { | 138 | void error_handler(int sig) { |
139 | #if SWAY_Backtrace_FOUND | ||
140 | int i; | 140 | int i; |
141 | int max_lines = 20; | 141 | int max_lines = 20; |
142 | void *array[max_lines]; | 142 | void *array[max_lines]; |
@@ -155,5 +155,8 @@ void error_handler(int sig) { | |||
155 | for (i = 0; (size_t)i < bt_len; i++) { | 155 | for (i = 0; (size_t)i < bt_len; i++) { |
156 | sway_log(L_ERROR, "Backtrace: %s", bt[i]); | 156 | sway_log(L_ERROR, "Backtrace: %s", bt[i]); |
157 | } | 157 | } |
158 | #else | ||
159 | sway_log(L_ERROR, "Error: Signal %d.", sig); | ||
160 | #endif | ||
158 | exit(1); | 161 | exit(1); |
159 | } | 162 | } |