summaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-11-23 11:20:29 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-11-26 18:47:15 +0200
commit442f516c6215aa0bbdeec4c7f2d6c406521a92fd (patch)
tree35bf85ad9be50efcbef9dd049b29ebbd5c9785dd /meson.build
parenta1225b838f1f4cf4544455abf72dddcbd6372490 (diff)
libcamera: Print backtrace on fatal errors
When a fatal error occurs the program aborts, and all the logger provides is the location of the line that caused the error. Extend this with a full backtrace to help debugging. The backtrace is generated using the backtrace() call, a GNU extension to the C library. It is available in glibc and uClibc but not in musl. Test for availability of the function to condition compilation of the backtrace printing. Implementing backtrace support with musl is an exercise left to the reader if desired. The LogOutput class is extended to support writing string messages directly to the output. Strings written directly will be considered as LogDebug messages when written to the Syslog. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build4
1 files changed, 4 insertions, 0 deletions
diff --git a/meson.build b/meson.build
index 0a222ba9..63448858 100644
--- a/meson.build
+++ b/meson.build
@@ -26,6 +26,10 @@ libcamera_version = libcamera_git_version.split('+')[0]
cc = meson.get_compiler('c')
config_h = configuration_data()
+if cc.has_header_symbol('execinfo.h', 'backtrace')
+ config_h.set('HAVE_BACKTRACE', 1)
+endif
+
if cc.has_header_symbol('stdlib.h', 'secure_getenv', prefix : '#define _GNU_SOURCE')
config_h.set('HAVE_SECURE_GETENV', 1)
endif