aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/eo
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-09-28 10:25:18 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-09-28 12:30:36 +0900
commit3dc140abfb30b94eae3093fd565f2f111c03be04 (patch)
treeed212f85ba73f582910288a9d220c3328046d594 /src/lib/eo
parenteo_debug: Enable logging of all ref/unref (diff)
downloadefl-3dc140abfb30b94eae3093fd565f2f111c03be04.tar.gz
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.
Diffstat (limited to 'src/lib/eo')
-rw-r--r--src/lib/eo/eo.c34
1 files changed, 34 insertions, 0 deletions
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;