This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch v-0.27
in repository enlightenment.

View the commit online.

commit 4299e436529d4065cc8ae609e4189d56ec4982b7
Author: Carsten Haitzler <ras...@rasterman.com>
AuthorDate: Sun Mar 2 13:40:03 2025 +0000

    e start - bring back valgrind option
    
    it's been gone a while - brign it back - it just logs. it won't do
    interactive gdb.
---
 src/bin/e_start_main.c | 46 ++++++++++++++++++++++++++++++++++++----------
 src/bin/e_watchdog.c   | 31 +++++++++++++++++--------------
 2 files changed, 53 insertions(+), 24 deletions(-)

diff --git a/src/bin/e_start_main.c b/src/bin/e_start_main.c
index 502fbab23..96c292dff 100644
--- a/src/bin/e_start_main.c
+++ b/src/bin/e_start_main.c
@@ -368,7 +368,7 @@ _e_start_stdout_err_redir(const char *home)
 }
 
 static int
-_e_start_child(const char *home, char **args, Eina_Bool really_know)
+_e_start_child(const char *home, char **args, Eina_Bool really_know, Eina_Bool trace)
 {
    // have e process die with parent enlightenment_start
 #ifdef HAVE_PRCTL
@@ -378,7 +378,7 @@ _e_start_child(const char *home, char **args, Eina_Bool really_know)
    procctl(P_PID, 0, PROC_PDEATHSIG_CTL, &sig);
 #endif
    _e_start_stdout_err_redir(home);
-   _e_ptrace_traceme(really_know);
+   if (trace) _e_ptrace_traceme(really_know);
    execv(args[0], args);
    // We failed, 0 means normal exit from E with no restart or crash so
    // let's exit
@@ -527,6 +527,7 @@ main(int argc, char **argv)
    struct sigaction action;
    pid_t child = -1;
    Eina_Bool restart = EINA_TRUE;
+   Eina_Bool vgd = EINA_FALSE;
    unsigned int provided_eina_version, required_eina_version;
 
    unsetenv("NOTIFY_SOCKET");
@@ -665,6 +666,11 @@ main(int argc, char **argv)
           {
              really_know = EINA_TRUE;
           }
+        else if (!strcmp(argv[i], "-valgrind"))
+          {
+             vgd = EINA_TRUE;
+             putenv("E_NO_WATCHDOG=1");
+          }
      }
 
    bindir = eina_prefix_bin_get(pfx);
@@ -694,13 +700,33 @@ main(int argc, char **argv)
      }
 
    /* run e directly now */
-   myasprintf(&buf, "%s/enlightenment", eina_prefix_bin_get(pfx));
+  myasprintf(&buf, "%s/enlightenment", eina_prefix_bin_get(pfx));
+   if (vgd)
+     {
+       args = alloca((argc + 11) * sizeof(char *));
+       args[0] = "/usr/bin/valgrind";
+       args[1] = "--tool=memcheck";
+       args[2] = "--num-callers=256";
+       args[3] = "--show-reachable=no";
+       args[4] = "--read-var-info=yes";
+       args[5] = "--leak-check=no";
+       args[6] = "--undef-value-errors=yes";
+       args[7] = "--track-origins=yes";
+       args[8] = "--redzone-size=512";
+       args[9] = "--freelist-vol=100000000";
+       args[10] = buf;
+       copy_args(&args[11], argv + 1, argc - 1);
+       argc += 10;
+       args[argc] = NULL;
+     }
+   else
+     {
+       args = alloca((argc + 1) * sizeof(char *));
+       args[0] = buf;
+       copy_args(&args[1], argv + 1, argc - 1);
+       args[argc] = NULL;
+     }
 
-   args = alloca((argc + 1) * sizeof(char *));
-   printf("Enlightenment: Command: %s\n", buf);
-   args[0] = buf;
-   copy_args(&args[1], argv + 1, argc - 1);
-   args[argc] = NULL;
 
    /* Now looping until */
    while (restart)
@@ -722,14 +748,14 @@ main(int argc, char **argv)
           }
         else if (child == 0)
           { // we are in the child fork - so exec
-             ret = _e_start_child(home, args, really_know);
+             ret = _e_start_child(home, args, really_know, !vgd);
              break;
           }
 
         putenv("E_RESTART_OK=");
         /* in the parent - ptrace attach and continue */
         putenv("E_RESTART=1");
-        _e_ptrace_attach(child, &status, really_know);
+        if (!vgd) _e_ptrace_attach(child, &status, really_know);
 
         /* now loop until done */
 not_done:
diff --git a/src/bin/e_watchdog.c b/src/bin/e_watchdog.c
index c1a7f8b1b..f1b27bf94 100644
--- a/src/bin/e_watchdog.c
+++ b/src/bin/e_watchdog.c
@@ -38,20 +38,23 @@ _cb_watchdog_thread_pingpong(void *data EINA_UNUSED, Ecore_Thread *thread)
                   char buf[PATH_MAX];
 
                   printf("WD: Enlightenment main loop hung. No response to ping for 10sec\n");
-                  // do hard-exit as cleanup isnt doable
-                  e_user_dir_concat_static(buf, "/watchdog-crash");
-                  // if ~/.e/e/watchdog-crash then crash (segv)
-                  if (ecore_file_exists(buf))
-                    {
-                       printf("WD: Forcing a SEGV crash to get a backtracxe - see ~/.e-crashdump.txt\n");
-                       kill(getpid(), SIGSEGV);
-                    }
-                  // otherwise just restart so user can march on
-                  else
-                    {
-                       printf("WD: Exiting E allowing it to be restarted to un-block\n");
-                       _exit(121);
-                    }
+                  if (!getenv("E_NO_WATCHDOG"))
+                   {
+                     // do hard-exit as cleanup isnt doable
+                     e_user_dir_concat_static(buf, "/watchdog-crash");
+                     // if ~/.e/e/watchdog-crash then crash (segv)
+                     if (ecore_file_exists(buf))
+                       {
+                         printf("WD: Forcing a SEGV crash to get a backtracxe - see ~/.e-crashdump.txt\n");
+                         kill(getpid(), SIGSEGV);
+                       }
+                     // otherwise just restart so user can march on
+                     else
+                       {
+                         printf("WD: Exiting E allowing it to be restarted to un-block\n");
+                         _exit(121);
+                       }
+                   }
                }
              // wait another 10 sec before pinging
              sleep(10);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to