[PATCH i-g-t v7 09/14] lib/igt_core: Implement conditional backtrace support using HAVE_LIBUNWIND

Jeevaka Prabu Badrappan jeevaka.badrappan at intel.com
Fri May 16 17:11:48 UTC 2025


Add a log message indicating "backtrace not implemented" in the
print_backtrace function and return when HAVE_LIBUNWIND is not defined.

Signed-off-by: Jeevaka Prabu Badrappan <jeevaka.badrappan at intel.com>
---
 lib/igt_core.c | 4 ++++
 meson.build    | 3 +++
 2 files changed, 7 insertions(+)

diff --git a/lib/igt_core.c b/lib/igt_core.c
index 1d7402cb7..097a556c9 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -383,6 +383,9 @@ static int _igt_dynamic_tests_executed = -1;
 
 static void print_backtrace(void)
 {
+#ifndef HAVE_LIBUNWIND
+	igt_info("backtrace not implemented\n");
+#else
 	unw_cursor_t cursor;
 	unw_context_t uc;
 	int stack_num = 0;
@@ -440,6 +443,7 @@ static void print_backtrace(void)
 
 	if (dwfl)
 		dwfl_end(dwfl);
+#endif
 }
 
 __attribute__((format(printf, 2, 3)))
diff --git a/meson.build b/meson.build
index 6a580bd7e..b88098234 100644
--- a/meson.build
+++ b/meson.build
@@ -147,6 +147,9 @@ else
 endif
 
 libunwind = dependency('libunwind', required : get_option('libunwind'))
+if libunwind.found()
+	config.set('HAVE_LIBUNWIND', 1)
+endif
 build_info += 'With libunwind: @0@'.format(libunwind.found())
 
 libdw = dependency('libdw', required : true)
-- 
2.49.0



More information about the igt-dev mailing list