[vlc-devel] commit: Avoid dlclose() only when valgrind is running ( Rémi Denis-Courmont )
git version control
git at videolan.org
Sat Jan 31 22:00:44 CET 2009
vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Sat Jan 31 23:00:10 2009 +0200| [997ae1dc88c24d009bbaa61a2dea27291aa6949c] | committer: Rémi Denis-Courmont
Avoid dlclose() only when valgrind is running
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=997ae1dc88c24d009bbaa61a2dea27291aa6949c
---
configure.ac | 6 +++++-
src/modules/os.c | 11 +++++++----
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/configure.ac b/configure.ac
index ae31615..0869ef8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1565,7 +1565,11 @@ AC_ARG_ENABLE(debug,
test "${enable_debug}" != "yes" && enable_debug="no"
AH_TEMPLATE(NDEBUG,
[Define to 1 if debug code should NOT be compiled])
-AS_IF([test "x${enable_debug}" = "xno"], [AC_DEFINE(NDEBUG)])
+AS_IF([test "x${enable_debug}" = "xno"], [
+ AC_DEFINE(NDEBUG)
+], [
+ AC_CHECK_HEADERS([valgrind/valgrind.h])
+])
dnl
dnl Allow runing as root (usefull for people runing on embedded platforms)
diff --git a/src/modules/os.c b/src/modules/os.c
index 4a89127..53368e4 100644
--- a/src/modules/os.c
+++ b/src/modules/os.c
@@ -65,6 +65,9 @@
# include <dl.h>
# endif
#endif
+#ifdef HAVE_VALGRIND_VALGRIND_H
+# include <valgrind/valgrind.h>
+#endif
/*****************************************************************************
* Local prototypes
@@ -274,11 +277,11 @@ void module_Unload( module_handle_t handle )
FreeLibrary( handle );
#elif defined(HAVE_DL_DLOPEN)
-# ifdef NDEBUG
- dlclose( handle );
-# else
- (void)handle;
+# ifdef HAVE_VALGRIND_VALGRIND_H
+ if( RUNNING_ON_VALGRIND > 0 )
+ return; /* do not dlclose() so that we get proper stack traces */
# endif
+ dlclose( handle );
#elif defined(HAVE_DL_SHL_LOAD)
shl_unload( handle );
More information about the vlc-devel
mailing list