forked from enlightenment/efl
support mtrace in eina at runtime. easier now to enable via env vars.
SVN revision: 63498
This commit is contained in:
parent
c07415b8bd
commit
495f658861
|
@ -488,6 +488,9 @@ AC_SUBST([dlopen_libs])
|
||||||
|
|
||||||
EFL_CHECK_FNMATCH([], [AC_MSG_ERROR([Cannot find fnmatch()])])
|
EFL_CHECK_FNMATCH([], [AC_MSG_ERROR([Cannot find fnmatch()])])
|
||||||
|
|
||||||
|
AC_CHECK_HEADERS([mcheck.h], [AC_DEFINE([HAVE_MCHECK], [1], [Have mcheck.h])])
|
||||||
|
AC_CHECK_FUNCS([mtrace], [AC_DEFINE([HAVE_MTRACE], [1], [Have mtrace])])
|
||||||
|
|
||||||
# iconv library
|
# iconv library
|
||||||
have_iconv="no"
|
have_iconv="no"
|
||||||
AC_ARG_WITH([iconv-link],
|
AC_ARG_WITH([iconv-link],
|
||||||
|
|
|
@ -37,6 +37,16 @@
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_MCHECK
|
||||||
|
# ifdef HAVE_MTRACE
|
||||||
|
# define MT 1
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef MT
|
||||||
|
#include <mcheck.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "eina_lock.h"
|
#include "eina_lock.h"
|
||||||
#include "eina_config.h"
|
#include "eina_config.h"
|
||||||
#include "eina_private.h"
|
#include "eina_private.h"
|
||||||
|
@ -97,6 +107,10 @@ EAPI pthread_t _eina_main_loop;
|
||||||
static pid_t _eina_pid;
|
static pid_t _eina_pid;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef MT
|
||||||
|
static int _mt_enabled = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef EINA_HAVE_DEBUG_THREADS
|
#ifdef EINA_HAVE_DEBUG_THREADS
|
||||||
EAPI int _eina_threads_debug = 0;
|
EAPI int _eina_threads_debug = 0;
|
||||||
EAPI pthread_mutex_t _eina_tracking_lock;
|
EAPI pthread_mutex_t _eina_tracking_lock;
|
||||||
|
@ -213,6 +227,14 @@ eina_init(void)
|
||||||
if (EINA_LIKELY(_eina_main_count > 0))
|
if (EINA_LIKELY(_eina_main_count > 0))
|
||||||
return ++_eina_main_count;
|
return ++_eina_main_count;
|
||||||
|
|
||||||
|
#ifdef MT
|
||||||
|
if ((getenv("EINA_MTRACE")) && (getenv("MALLOC_TRACE")))
|
||||||
|
{
|
||||||
|
_mt_enabled = 1;
|
||||||
|
mtrace();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!eina_log_init())
|
if (!eina_log_init())
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Could not initialize eina logging system.\n");
|
fprintf(stderr, "Could not initialize eina logging system.\n");
|
||||||
|
@ -273,6 +295,13 @@ eina_shutdown(void)
|
||||||
#ifdef EINA_HAVE_DEBUG_THREADS
|
#ifdef EINA_HAVE_DEBUG_THREADS
|
||||||
pthread_mutex_destroy(&_eina_tracking_lock);
|
pthread_mutex_destroy(&_eina_tracking_lock);
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef MT
|
||||||
|
if (_mt_enabled)
|
||||||
|
{
|
||||||
|
muntrace();
|
||||||
|
_mt_enabled = 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return _eina_main_count;
|
return _eina_main_count;
|
||||||
|
|
Loading…
Reference in New Issue