summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Zaoui <daniel.zaoui@samsung.com>2015-11-01 15:05:09 +0200
committerDaniel Zaoui <daniel.zaoui@samsung.com>2015-11-12 08:43:26 +0200
commit13fb7e4b2377cb23385c1c50d78527e130da0ecd (patch)
treec8e2dd2c30a3b90d38eccc2dc5df971e150a3424
parent779b834c8d4a7ffbbd4c60d46397c0ed78e0715d (diff)
Debug: add the objects list supportdevs/jackdanielz/edebug
-rw-r--r--src/lib/elm_main.c83
1 files changed, 83 insertions, 0 deletions
diff --git a/src/lib/elm_main.c b/src/lib/elm_main.c
index 9ad2e8df5..3b656fd93 100644
--- a/src/lib/elm_main.c
+++ b/src/lib/elm_main.c
@@ -75,6 +75,8 @@ static int _elm_policies[ELM_POLICY_LAST];
75static Ecore_Event_Handler *_elm_exit_handler = NULL; 75static Ecore_Event_Handler *_elm_exit_handler = NULL;
76static Eina_Bool quicklaunch_on = 0; 76static Eina_Bool quicklaunch_on = 0;
77 77
78static uint32_t _debug_objs_list_op = EINA_DEBUG_OPCODE_INVALID;
79
78static Eina_Bool 80static Eina_Bool
79_elm_signal_exit(void *data EINA_UNUSED, 81_elm_signal_exit(void *data EINA_UNUSED,
80 int ev_type EINA_UNUSED, 82 int ev_type EINA_UNUSED,
@@ -300,6 +302,85 @@ static Eina_Bool _sys_lang_changed(void *data EINA_UNUSED, int type EINA_UNUSED,
300 return ECORE_CALLBACK_PASS_ON; 302 return ECORE_CALLBACK_PASS_ON;
301} 303}
302 304
305static Eina_Bool
306_debug_list_req_cb(Eina_Debug_Client *src, void *buffer EINA_UNUSED, int size EINA_UNUSED)
307{
308 Eo_Class *kl_id = NULL;
309#if 0
310 if (size > 0)
311 {
312 char *req_classname = buffer;
313 unsigned int i;
314 for (i = 0; i < _eo_classes_last_id && !kl_id; i++)
315 {
316 if (!strcmp(_eo_classes[i]->desc->name, req_classname))
317 kl_id = _eo_class_id_get(_eo_classes[i]);
318 }
319 }
320#endif
321 const Eina_List *objs = eo_debug_objects_list_get(), *itr;
322 Eo *obj;
323 unsigned int strings_size = 0;
324 unsigned int objs_count = 0;
325
326 EINA_LIST_FOREACH(objs, itr, obj)
327 {
328 if (!kl_id || eo_isa(obj, kl_id))
329 {
330 strings_size += strlen(eo_class_name_get(obj)) + 1;
331 objs_count++;
332 }
333 }
334
335 unsigned int resp_size = 2 * objs_count * sizeof(uint64_t) + strings_size;
336 unsigned char *buf = alloca(resp_size);
337 unsigned int size_curr = 0;
338
339 EINA_LIST_FOREACH(objs, itr, obj)
340 {
341 if (!kl_id || eo_isa(obj, kl_id))
342 {
343 const char *kl_name = eo_class_name_get(obj);
344 Eo *parent = NULL;
345 memcpy(buf + size_curr, &obj, sizeof(uint64_t));
346 size_curr += sizeof(uint64_t);
347 do
348 {
349 if (elm_widget_is(obj)) parent = elm_widget_parent_get(obj);
350 if (!parent && eo_isa(obj, EVAS_OBJECT_CLASS))
351 {
352 parent = evas_object_data_get(obj, "elm-parent");
353 if (!parent) parent = evas_object_smart_parent_get(obj);
354 }
355 if (!parent) parent = eo_do_ret(obj, parent, eo_parent_get());
356 }
357 while (parent && kl_id && !eo_isa(parent, kl_id));
358 memcpy(buf + size_curr, &parent, sizeof(uint64_t));
359 size_curr += sizeof(uint64_t);
360 unsigned int len = strlen(kl_name) + 1;
361 memcpy(buf + size_curr, kl_name, len);
362 size_curr += len;
363 }
364 }
365
366 eina_debug_session_send(src, _debug_objs_list_op, buf, resp_size);
367
368 return EINA_TRUE;
369}
370
371static const Eina_Debug_Opcode _debug_ops[] =
372{
373 {"Elementary/objects_list", &_debug_objs_list_op, &_debug_list_req_cb},
374 {NULL, NULL, NULL}
375};
376
377static Eina_Bool
378_debug_init()
379{
380 eina_debug_opcodes_register(NULL, _debug_ops, NULL);
381 return EINA_TRUE;
382}
383
303EAPI int 384EAPI int
304elm_init(int argc, 385elm_init(int argc,
305 char **argv) 386 char **argv)
@@ -316,6 +397,8 @@ elm_init(int argc,
316 if (_elm_config->atspi_mode != ELM_ATSPI_MODE_OFF) 397 if (_elm_config->atspi_mode != ELM_ATSPI_MODE_OFF)
317 _elm_atspi_bridge_init(); 398 _elm_atspi_bridge_init();
318 399
400 _debug_init();
401
319 return _elm_init_count; 402 return _elm_init_count;
320} 403}
321 404