From: Sung-Jin Park Date: Tue, 22 Sep 2020 08:12:55 +0000 (+0900) Subject: e_info_server/client: add mtrace option X-Git-Tag: submit/tizen/20200923.234521~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6d984cf5a70c90e1603ed424030f691dcde72564;p=platform%2Fupstream%2Fenlightenment.git e_info_server/client: add mtrace option Change-Id: Ie642ca21c31c7f16bd8cab423133bc26186933c5 Signed-off-by: Sung-Jin Park --- diff --git a/src/bin/e_info_client.c b/src/bin/e_info_client.c index b8887be5bf..5810e36892 100644 --- a/src/bin/e_info_client.c +++ b/src/bin/e_info_client.c @@ -6144,6 +6144,35 @@ usage: printf("Usage: %s", USAGE_FILTER); } +static void +_e_info_client_proc_mtrace(int argc, char **argv) +{ + int enable = 0; + + if (argc == 3) + { + if ((argv[2][0] != '0' && argv[2][0] != '1')) + { + printf("Error: invalid argument\n"); + return; + } + + enable = atoi(argv[2]); + if (!_e_info_client_eldbus_message_with_args("mtrace", NULL, "i", enable)) + { + printf("_e_info_client_proc_mtrace fail (enable:%d)\n", enable); + return; + } + } + else + { + printf("Error: invalid argument\n"); + return; + } + + return; +} + static void _e_info_client_proc_gcov(int argc, char **argv) { @@ -6486,6 +6515,12 @@ static ProcInfo procs_to_execute[] = "Dump stack information by allocations", _e_info_client_memchecker }, + { + "mtrace", + "[enable: 1, disable: 0]", + "enable/disable mtrace", + _e_info_client_proc_mtrace + }, { "magnifier", NULL, diff --git a/src/bin/e_info_server.c b/src/bin/e_info_server.c index 55b46c32dc..fe77b8c8b6 100644 --- a/src/bin/e_info_server.c +++ b/src/bin/e_info_server.c @@ -6942,6 +6942,32 @@ reply: return reply; } +static Eldbus_Message * +_e_info_server_cb_mtrace(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg) +{ + Eldbus_Message *reply = eldbus_message_method_return_new(msg); + int enable; + + if (!eldbus_message_arguments_get(msg, "i", &enable)) + { + ERR("Error getting argument for enabling mtrace."); + return reply; + } + + if (enable) + { + mtrace(); + INF("mtrace enable=%d", enable); + } + else + { + muntrace(); + INF("mtrace enable=0"); + } + + return reply; +} + static Eldbus_Message * _e_info_server_cb_gcov(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg) { @@ -7036,6 +7062,7 @@ static const Eldbus_Method methods[] = { { "buffer_flush", ELDBUS_ARGS({"it", "option"}), ELDBUS_ARGS({"s", "buffer_flush status"}), _e_info_server_cb_buffer_flush, 0}, { "deiconify_approve", ELDBUS_ARGS({"it", "option"}), ELDBUS_ARGS({"s", "deiconify_approve status"}), _e_info_server_cb_deiconify_approve, 0}, { "key_repeat", ELDBUS_ARGS({"sii", "option"}), NULL, _e_info_server_cb_key_repeat, 0}, + { "mtrace", ELDBUS_ARGS({"i", "enable"}), NULL, _e_info_server_cb_mtrace, 0}, { "dump_memchecker", NULL, NULL, _e_info_server_cb_memchecker, 0}, { "magnifier", ELDBUS_ARGS({"i", "magnifier"}), NULL, e_info_server_cb_magnifier, 0}, { "input_region", ELDBUS_ARGS({"siiii", "options"}), ELDBUS_ARGS({"a(iiii)", "path"}), _e_info_server_cb_input_region, 0}, @@ -7167,6 +7194,14 @@ _e_info_server_cb_dbus_init_done(void *data, int type, void *event) EINTERN int e_info_server_init(void) { + char *s; + s = e_util_env_get("MALLOC_TRACE"); + + if (s) + E_FREE(s); + else + e_util_env_set("MALLOC_TRACE", "/tmp/e20_mtrace"); + e_info_server.edbus_conn = NULL; e_info_server.edbus_conn_type = ELDBUS_CONNECTION_TYPE_SYSTEM; e_info_server.dbus_init_done_handler = NULL;