ecore: improve ecore_timer_dump.
authorcedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 18 May 2011 09:12:07 +0000 (09:12 +0000)
committercedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 18 May 2011 09:12:07 +0000 (09:12 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/ecore@59491 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

configure.ac
src/lib/ecore/ecore_timer.c

index 07fa7cb..4f7c15e 100644 (file)
@@ -345,13 +345,16 @@ fi
 AC_SUBST(pkgconfig_requires_private)
 
 ### Checks for some build time option
+have_backtrace="no"
+AC_CHECK_FUNCS([backtrace], [have_backtrace="yes"], [])
+
 want_ecore_timer_dump="yes"
 
 AC_ARG_ENABLE([ecore-timer-dump],
    [AC_HELP_STRING([--disable-ecore-timer-dump], [disable tracking of timer allocation. @<:@default=enable@:>@])],
    [want_ecore_timer_dump=$enableval], [])
 
-if test "x$want_ecore_timer_dump" = "xyes"; then
+if test "x$want_ecore_timer_dump" = "xyes" -a "x$have_backtrace" = "xyes"; then
    AC_DEFINE(WANT_ECORE_TIMER_DUMP, [1], [Want Ecore_Timer dump infrastructure])
 fi
 
index dadcf40..d8d57d3 100644 (file)
@@ -377,11 +377,9 @@ ecore_timer_dump(void)
    EINA_LIST_FREE(tmp, tm)
      {
         char **strings;
-        int nptrs;
         int j;
 
-        nptrs = backtrace((void**) tm->timer_bt, ECORE_TIMER_DEBUG_BT_NUM);
-        strings = backtrace_symbols((void**) tm->timer_bt, nptrs);
+        strings = backtrace_symbols((void**) tm->timer_bt, tm->timer_bt_num);
         if (strings == NULL)
           continue ;
 
@@ -390,7 +388,7 @@ ecore_timer_dump(void)
           eina_strbuf_append(result, "FROZEN\n");
         if (tm->delete_me)
           eina_strbuf_append(result, "DELETED\n");
-        for (j = 0; j < nptrs; j++)
+        for (j = 0; j < tm->timer_bt_num; j++)
           eina_strbuf_append_printf(result, "%s\n", strings[j]);
 
         free(strings);