aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2011-11-17 10:19:50 +0000
committerCarsten Haitzler <raster@rasterman.com>2011-11-17 10:19:50 +0000
commitcef3afa35586eda13b57c8905b9accafb93d6d01 (patch)
tree832ee894c6b515b727e8a529baad7a54a71b7225 /src
parenteverything/gadget: fix segv (diff)
downloadenlightenment-cef3afa35586eda13b57c8905b9accafb93d6d01.tar.gz
support mtrack... my new little memory tracker so i can finally live
track down leaks and other badnesses. SVN revision: 65335
Diffstat (limited to 'src')
-rw-r--r--src/bin/e_alert.c2
-rw-r--r--src/bin/e_ipc.c2
-rw-r--r--src/bin/e_main.c4
-rw-r--r--src/bin/e_start_main.c33
4 files changed, 40 insertions, 1 deletions
diff --git a/src/bin/e_alert.c b/src/bin/e_alert.c
index 01274d85b..15a41588e 100644
--- a/src/bin/e_alert.c
+++ b/src/bin/e_alert.c
@@ -73,6 +73,8 @@ e_alert_show(int sig)
}
restart_e:
+ if (getenv("E_START_MTRACK"))
+ e_util_env_set("MTRACK", "track");
ecore_app_restart();
}
diff --git a/src/bin/e_ipc.c b/src/bin/e_ipc.c
index d5c985aea..07a3c74cf 100644
--- a/src/bin/e_ipc.c
+++ b/src/bin/e_ipc.c
@@ -207,6 +207,8 @@ _e_ipc_cb_client_data(void *data __UNUSED__, int type __UNUSED__, void *event)
switch (e->minor)
{
case E_ALERT_OP_RESTART:
+ if (getenv("E_START_MTRACK"))
+ e_util_env_set("MTRACK", "track");
ecore_app_restart();
break;
case E_ALERT_OP_EXIT:
diff --git a/src/bin/e_main.c b/src/bin/e_main.c
index a5d75bc28..2bf6efb57 100644
--- a/src/bin/e_main.c
+++ b/src/bin/e_main.c
@@ -182,6 +182,8 @@ main(int argc, char **argv)
snprintf(buff, sizeof(buff), "%1.1f", tstart);
e_util_env_set("E_START_TIME", buff);
+ if (getenv("E_START_MTRACK"))
+ e_util_env_set("MTRACK", NULL);
TS("Eina Init");
if (!eina_init())
{
@@ -969,6 +971,8 @@ main(int argc, char **argv)
if (restart)
{
e_util_env_set("E_RESTART_OK", "1");
+ if (getenv("E_START_MTRACK"))
+ e_util_env_set("MTRACK", "track");
ecore_app_restart();
}
diff --git a/src/bin/e_start_main.c b/src/bin/e_start_main.c
index b0a290029..c5991bd34 100644
--- a/src/bin/e_start_main.c
+++ b/src/bin/e_start_main.c
@@ -351,9 +351,40 @@ main(int argc, char **argv)
}
done:
+ /* mtrack memory tracker support */
+ p = getenv("HOME");
+ if (p)
+ {
+ FILE *f;
+
+ /* if you have ~/.e-mtrack, then the tracker will be enabled
+ * using the content of this file as the path to the mtrack.so
+ * shared object that is the mtrack preload */
+ snprintf(buf, sizeof(buf), "%s/.e-mtrack", p);
+ f = fopen(buf, "r");
+ if (f)
+ {
+ if (fgets(buf, sizeof(buf), f))
+ {
+ int len = strlen(buf);
+ if ((len > 1) && (buf[len - 1] == '\n'))
+ {
+ buf[len - 1] = 0;
+ len--;
+ }
+ env_set("LD_PRELOAD", buf);
+ env_set("MTRACK", "track");
+ env_set("E_START_MTRACK", "track");
+ snprintf(buf, sizeof(buf), "%s/.e-mtrack.log", p);
+ env_set("MTRACK_TRACE_FILE", buf);
+ }
+ fclose(f);
+ }
+ }
+
/* try dbus-launch */
snprintf(buf, sizeof(buf), "%s/enlightenment", eina_prefix_bin_get(pfx));
-
+
args = alloca((argc + 2 + VALGRIND_MAX_ARGS) * sizeof(char *));
if ((!getenv("DBUS_SESSION_BUS_ADDRESS")) &&
(!getenv("DBUS_LAUNCHD_SESSION_BUS_SOCKET")))