summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/libcamera/base/backtrace.h34
-rw-r--r--include/libcamera/base/meson.build1
2 files changed, 35 insertions, 0 deletions
diff --git a/include/libcamera/base/backtrace.h b/include/libcamera/base/backtrace.h
new file mode 100644
index 00000000..aefc76de
--- /dev/null
+++ b/include/libcamera/base/backtrace.h
@@ -0,0 +1,34 @@
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+/*
+ * Copyright (C) 2021, Ideas on Board Oy
+ *
+ * backtrace.h - Call stack backtraces
+ */
+#ifndef __LIBCAMERA_BASE_BACKTRACE_H__
+#define __LIBCAMERA_BASE_BACKTRACE_H__
+
+#include <string>
+#include <vector>
+
+#include <libcamera/base/private.h>
+
+#include <libcamera/base/class.h>
+
+namespace libcamera {
+
+class Backtrace
+{
+public:
+ Backtrace();
+
+ std::string toString(unsigned int skipLevels = 0) const;
+
+private:
+ LIBCAMERA_DISABLE_COPY(Backtrace)
+
+ std::vector<void *> backtrace_;
+};
+
+} /* namespace libcamera */
+
+#endif /* __LIBCAMERA_BASE_BACKTRACE_H__ */
diff --git a/include/libcamera/base/meson.build b/include/libcamera/base/meson.build
index 9feb4b93..525aba9d 100644
--- a/include/libcamera/base/meson.build
+++ b/include/libcamera/base/meson.build
@@ -3,6 +3,7 @@
libcamera_base_include_dir = libcamera_include_dir / 'base'
libcamera_base_headers = files([
+ 'backtrace.h',
'bound_method.h',
'class.h',
'event_dispatcher.h',