[PATCH i-g-t] igt: Make dependency on libunwind mandatory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



With Android support gone there is not much reason for keeping libunwind
dependency optional. This also deals (cheaply!) with ifdefs covering
huge portions of code, removing a placement minefield.

Cc: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxxxxxxxx>
Cc: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@xxxxxxxxx>
---
 configure.ac   | 12 ++----------
 lib/igt_core.c | 13 ++++---------
 meson.build    |  2 +-
 3 files changed, 7 insertions(+), 20 deletions(-)

diff --git a/configure.ac b/configure.ac
index 84c6e646..6908f742 100644
--- a/configure.ac
+++ b/configure.ac
@@ -124,8 +124,10 @@ PKG_CHECK_MODULES(DRM, [libdrm >= 2.4.82])
 PKG_CHECK_MODULES(PCIACCESS, [pciaccess >= 0.10])
 PKG_CHECK_MODULES(KMOD, [libkmod])
 PKG_CHECK_MODULES(PROCPS, [libprocps])
+PKG_CHECK_MODULES(LIBUNWIND, [libunwind])
 PKG_CHECK_MODULES(VALGRIND, [valgrind], [have_valgrind=yes], [have_valgrind=no])
 
+
 if test x$have_valgrind = xyes; then
 	AC_DEFINE(HAVE_VALGRIND, 1, [Enable valgrind annotation support.])
 fi
@@ -330,15 +332,6 @@ AM_CONDITIONAL(BUILD_SHADER_DEBUGGER, [test "x$BUILD_SHADER_DEBUGGER" != xno])
 AS_IF([test "x$BUILD_SHADER_DEBUGGER" != xno],
       [enable_debugger=yes], [enable_debugger=no])
 
-AC_ARG_WITH(libunwind,
-	    AS_HELP_STRING([--without-libunwind],
-			   [Build tests without libunwind support]),
-	    [], [with_libunwind=yes])
-if test "x$with_libunwind" = xyes; then
-	PKG_CHECK_MODULES(LIBUNWIND, libunwind, AC_DEFINE(HAVE_LIBUNWIND, 1, [libunwind support]),
-			  AC_MSG_ERROR([libunwind not found. Use --without-libunwind to disable libunwind support.]))
-fi
-
 # enable debug symbols
 AC_ARG_ENABLE(debug,
 	      AS_HELP_STRING([--disable-debug],
@@ -434,7 +427,6 @@ echo "       Build tests        : ${BUILD_TESTS}"
 echo "       Chamelium tests    : ${enable_chamelium}"
 echo "       Audio tests        : ${enable_audio}"
 echo "       Compile prime tests: ${NOUVEAU}"
-echo "       Print stack traces : ${with_libunwind}"
 echo "       Debug flags        : ${DEBUG_CFLAGS}"
 echo ""
 echo " • Tools:"
diff --git a/lib/igt_core.c b/lib/igt_core.c
index de9269b0..03fa6e4e 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -71,6 +71,9 @@
 #include "igt_sysfs.h"
 #include "igt_rc.h"
 
+#define UNW_LOCAL_ONLY
+#include <libunwind.h>
+
 #ifdef HAVE_LIBGEN_H
 #include <libgen.h>   /* for basename() on Solaris */
 #endif
@@ -1173,10 +1176,6 @@ static void write_stderr(const char *str)
 	__write_stderr(str, strlen(str));
 }
 
-#ifdef HAVE_LIBUNWIND
-#define UNW_LOCAL_ONLY
-#include <libunwind.h>
-
 static void print_backtrace(void)
 {
 	unw_cursor_t cursor;
@@ -1371,7 +1370,6 @@ static void print_backtrace_sig_safe(void)
 
 	}
 }
-#endif
 
 void __igt_fail_assert(const char *domain, const char *file, const int line,
 		       const char *func, const char *assertion,
@@ -1394,9 +1392,7 @@ void __igt_fail_assert(const char *domain, const char *file, const int line,
 		va_end(args);
 	}
 
-#ifdef HAVE_LIBUNWIND
 	print_backtrace();
-#endif
 
 	if (run_under_gdb())
 		abort();
@@ -1876,9 +1872,8 @@ static void fatal_sig_handler(int sig)
 				igt_exitcode = 128 + sig;
 
 			failed_one = true;
-#ifdef HAVE_LIBUNWIND
 			print_backtrace_sig_safe();
-#endif
+
 			if (in_subtest)
 				exit_subtest("CRASH");
 		}
diff --git a/meson.build b/meson.build
index 8e01b05d..a564893d 100644
--- a/meson.build
+++ b/meson.build
@@ -38,6 +38,7 @@ libdrm_amdgpu = dependency('libdrm_amdgpu', required : false)
 pciaccess = dependency('pciaccess', version : '>=0.10')
 libkmod = dependency('libkmod')
 libprocps = dependency('libprocps', required : true)
+libunwind = dependency('libunwind', required : true)
 
 valgrind = dependency('valgrind', required : false)
 if valgrind.found()
@@ -56,7 +57,6 @@ if glib.found()
 	config.set('HAVE_GLIB', 1)
 endif
 
-libunwind = dependency('libunwind')
 gsl = dependency('gsl', required : false)
 alsa = dependency('alsa', required : false)
 
-- 
2.13.6

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux