mirror of
				https://github.com/tiagovignatti/intel-gpu-tools.git
				synced 2025-11-04 03:58:27 +00:00 
			
		
		
		
	Add default debug flags for tests
Include debugging symbols in tests by default to improve stack traces and also set the compiler optimisation level to improve the debugging experience. Signed-off-by: Thomas Wood <thomas.wood@intel.com>
This commit is contained in:
		
							parent
							
								
									277ca2b992
								
							
						
					
					
						commit
						76dad7f414
					
				
							
								
								
									
										14
									
								
								configure.ac
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								configure.ac
									
									
									
									
									
								
							@ -196,6 +196,19 @@ if test "x$with_libunwind" = xyes; then
 | 
			
		||||
			  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],
 | 
			
		||||
			     [Build tests without debug symbols]),
 | 
			
		||||
	      [], [enable_debug=yes])
 | 
			
		||||
 | 
			
		||||
if test "x$enable_debug" = xyes; then
 | 
			
		||||
	AS_COMPILER_FLAG([-g3], [DEBUG_CFLAGS="-g3"], [DEBUG_CFLAGS="-g"])
 | 
			
		||||
	AS_COMPILER_FLAG([-Og], [DEBUG_CFLAGS+=" -Og -Wno-maybe-uninitialized"], # disable maybe-uninitialized due to false positives
 | 
			
		||||
			 [DEBUG_CFLAGS+=" -O0"])
 | 
			
		||||
	AC_SUBST([DEBUG_CFLAGS])
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# -----------------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
# To build multithread code, gcc uses -pthread, Solaris Studio cc uses -mt
 | 
			
		||||
@ -253,6 +266,7 @@ echo " • Tests:"
 | 
			
		||||
echo "       Build tests        : ${BUILD_TESTS}"
 | 
			
		||||
echo "       Compile prime tests: ${NOUVEAU}"
 | 
			
		||||
echo "       Print stack traces : ${with_libunwind}"
 | 
			
		||||
echo "       Debug flags        : ${DEBUG_CFLAGS}"
 | 
			
		||||
echo ""
 | 
			
		||||
echo " • Tools:"
 | 
			
		||||
echo "       Assembler          : ${enable_assembler}"
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										62
									
								
								m4/as-compiler-flag.m4
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										62
									
								
								m4/as-compiler-flag.m4
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,62 @@
 | 
			
		||||
dnl as-compiler-flag.m4 0.1.0
 | 
			
		||||
 | 
			
		||||
dnl autostars m4 macro for detection of compiler flags
 | 
			
		||||
 | 
			
		||||
dnl David Schleef <ds@schleef.org>
 | 
			
		||||
 | 
			
		||||
dnl $Id: as-compiler-flag.m4,v 1.1 2005/12/15 23:35:19 ds Exp $
 | 
			
		||||
 | 
			
		||||
dnl AS_COMPILER_FLAG(CFLAGS, ACTION-IF-ACCEPTED, [ACTION-IF-NOT-ACCEPTED])
 | 
			
		||||
dnl Tries to compile with the given CFLAGS.
 | 
			
		||||
dnl Runs ACTION-IF-ACCEPTED if the compiler can compile with the flags,
 | 
			
		||||
dnl and ACTION-IF-NOT-ACCEPTED otherwise.
 | 
			
		||||
 | 
			
		||||
AC_DEFUN([AS_COMPILER_FLAG],
 | 
			
		||||
[
 | 
			
		||||
  AC_MSG_CHECKING([to see if compiler understands $1])
 | 
			
		||||
 | 
			
		||||
  save_CFLAGS="$CFLAGS"
 | 
			
		||||
  CFLAGS="$CFLAGS $1"
 | 
			
		||||
 | 
			
		||||
  AC_TRY_COMPILE([ ], [], [flag_ok=yes], [flag_ok=no])
 | 
			
		||||
  CFLAGS="$save_CFLAGS"
 | 
			
		||||
 | 
			
		||||
  if test "X$flag_ok" = Xyes ; then
 | 
			
		||||
    m4_ifvaln([$2],[$2])
 | 
			
		||||
    true
 | 
			
		||||
  else
 | 
			
		||||
    m4_ifvaln([$3],[$3])
 | 
			
		||||
    true
 | 
			
		||||
  fi
 | 
			
		||||
  AC_MSG_RESULT([$flag_ok])
 | 
			
		||||
])
 | 
			
		||||
 | 
			
		||||
dnl AS_COMPILER_FLAGS(VAR, FLAGS)
 | 
			
		||||
dnl Tries to compile with the given CFLAGS.
 | 
			
		||||
 | 
			
		||||
AC_DEFUN([AS_COMPILER_FLAGS],
 | 
			
		||||
[
 | 
			
		||||
  list=$2
 | 
			
		||||
  flags_supported=""
 | 
			
		||||
  flags_unsupported=""
 | 
			
		||||
  AC_MSG_CHECKING([for supported compiler flags])
 | 
			
		||||
  for each in $list
 | 
			
		||||
  do
 | 
			
		||||
    save_CFLAGS="$CFLAGS"
 | 
			
		||||
    CFLAGS="$CFLAGS $each"
 | 
			
		||||
    AC_TRY_COMPILE([ ], [], [flag_ok=yes], [flag_ok=no])
 | 
			
		||||
    CFLAGS="$save_CFLAGS"
 | 
			
		||||
 | 
			
		||||
    if test "X$flag_ok" = Xyes ; then
 | 
			
		||||
      flags_supported="$flags_supported $each"
 | 
			
		||||
    else
 | 
			
		||||
      flags_unsupported="$flags_unsupported $each"
 | 
			
		||||
    fi
 | 
			
		||||
  done
 | 
			
		||||
  AC_MSG_RESULT([$flags_supported])
 | 
			
		||||
  if test "X$flags_unsupported" != X ; then
 | 
			
		||||
    AC_MSG_WARN([unsupported compiler flags: $flags_unsupported])
 | 
			
		||||
  fi
 | 
			
		||||
  $1="$$1 $flags_supported"
 | 
			
		||||
])
 | 
			
		||||
 | 
			
		||||
@ -32,7 +32,7 @@ EXTRA_DIST = $(TESTS_scripts) $(TESTS_scripts_M) $(scripts) $(IMAGES) $(common_f
 | 
			
		||||
 | 
			
		||||
CLEANFILES = $(EXTRA_PROGRAMS) single-tests.txt multi-tests.txt
 | 
			
		||||
 | 
			
		||||
AM_CFLAGS = $(DRM_CFLAGS) $(CWARNFLAGS) \
 | 
			
		||||
AM_CFLAGS = $(DRM_CFLAGS) $(CWARNFLAGS) $(DEBUG_CFLAGS)\
 | 
			
		||||
	-I$(srcdir)/.. \
 | 
			
		||||
	-I$(srcdir)/../lib \
 | 
			
		||||
	-include "$(srcdir)/../lib/check-ndebug.h" \
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user