jpeg pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=3dc140abfb30b94eae3093fd565f2f111c03be04

commit 3dc140abfb30b94eae3093fd565f2f111c03be04
Author: Jean-Philippe Andre <jp.an...@samsung.com>
Date:   Thu Sep 28 10:25:18 2017 +0900

    eo_debug: Also print out the current backtrace
    
    We can't use EINA_LOG_BACKTRACE=1 for that as eo_lifecycle itself prints
    out ERR messages for its backtrace dump.
---
 src/lib/eo/eo.c | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c
index 1825b92d1b..5e75cf9d01 100644
--- a/src/lib/eo/eo.c
+++ b/src/lib/eo/eo.c
@@ -2813,6 +2813,7 @@ _eo_log_obj_report(const Eo_Id id, int log_level, const 
char *func_name, const c
 {
 #ifdef HAVE_BACKTRACE
    const Eo_Log_Obj_Entry *added, *deleted;
+   Eo_Log_Obj_Entry *current = NULL;
    int added_idx = -1;
    double now;
 
@@ -2850,6 +2851,31 @@ _eo_log_obj_report(const Eo_Id id, int log_level, const 
char *func_name, const c
 
    now = _eo_log_time_now();
 
+#ifdef HAVE_BACKTRACE
+   if ((_eo_log_objs_backtrace > 0) && deleted)
+     {
+        void **bt;
+        int size;
+
+        bt = alloca(sizeof(void *) * _eo_log_objs_backtrace);
+        size = backtrace(bt, _eo_log_objs_backtrace);
+        if (EINA_UNLIKELY(size < 1)) return;
+
+        current = calloc(1, sizeof(Eo_Log_Obj_Entry) + size * sizeof(void *));
+        if (EINA_UNLIKELY(!current)) return;
+
+        current->id = id;
+        current->timestamp = now;
+        current->obj = deleted->obj;
+        current->klass = deleted->klass;
+        current->ref_op = EO_REF_OP_NONE;
+        current->bt_size = size;
+        current->bt_hash = 0;
+        current->bt_hits = 1;
+        memcpy(current->bt, bt, size * sizeof(void *));
+     }
+#endif
+
    if (added)
      {
         _eo_log_obj_entry_show(added, log_level, func_name, file, line, now);
@@ -2872,6 +2898,14 @@ _eo_log_obj_report(const Eo_Id id, int log_level, const 
char *func_name, const c
                        (void *)id, now - deleted->timestamp);
      }
 
+   if (current)
+     {
+        eina_log_print(_eo_log_objs_dom, log_level, file, func_name, line,
+                       "obj_id=%p current use from:", (void *)id);
+        _eo_log_obj_entry_show(current, log_level, func_name, file, line, now);
+        free(current);
+     }
+
 #else
    (void)id;
    (void)log_level;

-- 


Reply via email to