From e97ccf53cd0c93ff76b5b0c993918348e721e03b Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 13 Nov 2012 07:46:02 +0000 Subject: [PATCH] by popular (overwhelming) demand, -i-really-know-what-i-am-doing-and-accept-full-responsibility-for-it now prevents enlightenment_start from ptracing, which allows gdb attaching once more SVN revision: 79202 --- src/bin/e_start_main.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/bin/e_start_main.c b/src/bin/e_start_main.c index bf71460c0..847c0d441 100644 --- a/src/bin/e_start_main.c +++ b/src/bin/e_start_main.c @@ -417,8 +417,9 @@ main(int argc, char **argv) else if (child == 0) { #ifdef HAVE_SYS_PTRACE_H - /* in the child */ - ptrace(PT_TRACE_ME, 0, NULL, NULL); + if (!really_know) + /* in the child */ + ptrace(PT_TRACE_ME, 0, NULL, NULL); #endif execv(args[0], args); return 0; /* We failed, 0 mean normal exit from E with no restart or crash so let exit */ @@ -431,11 +432,12 @@ main(int argc, char **argv) int status; Eina_Bool done = EINA_FALSE; #ifdef HAVE_SYS_PTRACE_H - ptrace(PT_ATTACH, child, NULL, NULL); + if (!really_know) + ptrace(PT_ATTACH, child, NULL, NULL); #endif result = waitpid(child, &status, 0); #ifdef HAVE_SYS_PTRACE_H - if (!stop_ptrace) + if ((!really_know) && (!stop_ptrace)) { if (WIFSTOPPED(status)) ptrace(PT_CONTINUE, child, NULL, NULL); @@ -459,7 +461,8 @@ main(int argc, char **argv) int back; #ifdef HAVE_SYS_PTRACE_H - r = ptrace(PTRACE_GETSIGINFO, child, NULL, &sig); + if (!really_know) + r = ptrace(PTRACE_GETSIGINFO, child, NULL, &sig); #endif back = r == 0 && sig.si_signo != SIGTRAP ? sig.si_signo : 0; @@ -485,13 +488,15 @@ main(int argc, char **argv) sig.si_signo != SIGABRT)) { #ifdef HAVE_SYS_PTRACE_H - ptrace(PT_CONTINUE, child, NULL, back); + if (!really_know) + ptrace(PT_CONTINUE, child, NULL, back); #endif continue ; } #ifdef HAVE_SYS_PTRACE_H - /* E17 should be in pause, we can detach */ - ptrace(PT_DETACH, child, NULL, back); + if (!really_know) + /* E17 should be in pause, we can detach */ + ptrace(PT_DETACH, child, NULL, back); #endif /* And call gdb if available */ if (home) @@ -554,7 +559,8 @@ main(int argc, char **argv) kill(child, SIGSTOP); usleep(200000); #ifdef HAVE_SYS_PTRACE_H - ptrace(PT_DETACH, child, NULL, NULL); + if (!really_know) + ptrace(PT_DETACH, child, NULL, NULL); #endif } }