check for sys/ptrace.h and only use ptrace() in e_start_main.c if it's present
ticket #1757 (3/3) SVN revision: 79139
This commit is contained in:
parent
15b668e01a
commit
4ae43fb422
|
@ -76,7 +76,7 @@ AC_CHECK_FUNCS(unsetenv)
|
||||||
|
|
||||||
efl_version="1.7.0"
|
efl_version="1.7.0"
|
||||||
|
|
||||||
AC_CHECK_HEADERS([sys/timerfd.h])
|
AC_CHECK_HEADERS([sys/timerfd.h sys/ptrace.h])
|
||||||
|
|
||||||
dnl AC_CHECK_HEADERS(X11/extensions/shape.h,, AC_MSG_ERROR([Cannot find X11/extensions/shape.h. Make sure your CFLAGS environment variable contains include lines for the location of this file]))
|
dnl AC_CHECK_HEADERS(X11/extensions/shape.h,, AC_MSG_ERROR([Cannot find X11/extensions/shape.h. Make sure your CFLAGS environment variable contains include lines for the location of this file]))
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,9 @@
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/utsname.h>
|
#include <sys/utsname.h>
|
||||||
#include <sys/ptrace.h>
|
#ifdef HAVE_SYS_PTRACE_H
|
||||||
|
# include <sys/ptrace.h>
|
||||||
|
#endif
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#ifdef HAVE_ALLOCA_H
|
#ifdef HAVE_ALLOCA_H
|
||||||
|
@ -414,9 +416,10 @@ main(int argc, char **argv)
|
||||||
return -1;
|
return -1;
|
||||||
else if (child == 0)
|
else if (child == 0)
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_SYS_PTRACE_H
|
||||||
/* in the child */
|
/* in the child */
|
||||||
ptrace(PT_TRACE_ME, 0, NULL, NULL);
|
ptrace(PT_TRACE_ME, 0, NULL, NULL);
|
||||||
|
#endif
|
||||||
execv(args[0], args);
|
execv(args[0], args);
|
||||||
return 0; /* We failed, 0 mean normal exit from E with no restart or crash so let exit */
|
return 0; /* We failed, 0 mean normal exit from E with no restart or crash so let exit */
|
||||||
}
|
}
|
||||||
|
@ -426,17 +429,17 @@ main(int argc, char **argv)
|
||||||
pid_t result;
|
pid_t result;
|
||||||
int status;
|
int status;
|
||||||
Eina_Bool done = EINA_FALSE;
|
Eina_Bool done = EINA_FALSE;
|
||||||
|
#ifdef HAVE_SYS_PTRACE_H
|
||||||
ptrace(PT_ATTACH, child, NULL, NULL);
|
ptrace(PT_ATTACH, child, NULL, NULL);
|
||||||
|
#endif
|
||||||
result = waitpid(child, &status, 0);
|
result = waitpid(child, &status, 0);
|
||||||
|
#ifdef HAVE_SYS_PTRACE_H
|
||||||
if (!stop_ptrace)
|
if (!stop_ptrace)
|
||||||
{
|
{
|
||||||
if (WIFSTOPPED(status))
|
if (WIFSTOPPED(status))
|
||||||
ptrace(PT_CONTINUE, child, NULL, NULL);
|
ptrace(PT_CONTINUE, child, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
while (!done)
|
while (!done)
|
||||||
{
|
{
|
||||||
Eina_Bool remember_sigill = EINA_FALSE;
|
Eina_Bool remember_sigill = EINA_FALSE;
|
||||||
|
@ -451,10 +454,12 @@ main(int argc, char **argv)
|
||||||
char buffer[4096];
|
char buffer[4096];
|
||||||
char *backtrace_str = NULL;
|
char *backtrace_str = NULL;
|
||||||
siginfo_t sig;
|
siginfo_t sig;
|
||||||
int r;
|
int r = 0;
|
||||||
int back;
|
int back;
|
||||||
|
|
||||||
|
#ifdef HAVE_SYS_PTRACE_H
|
||||||
r = ptrace(PTRACE_GETSIGINFO, child, NULL, &sig);
|
r = ptrace(PTRACE_GETSIGINFO, child, NULL, &sig);
|
||||||
|
#endif
|
||||||
back = r == 0 &&
|
back = r == 0 &&
|
||||||
sig.si_signo != SIGTRAP ? sig.si_signo : 0;
|
sig.si_signo != SIGTRAP ? sig.si_signo : 0;
|
||||||
|
|
||||||
|
@ -478,13 +483,15 @@ main(int argc, char **argv)
|
||||||
sig.si_signo != SIGBUS &&
|
sig.si_signo != SIGBUS &&
|
||||||
sig.si_signo != SIGABRT))
|
sig.si_signo != SIGABRT))
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_SYS_PTRACE_H
|
||||||
ptrace(PT_CONTINUE, child, NULL, back);
|
ptrace(PT_CONTINUE, child, NULL, back);
|
||||||
|
#endif
|
||||||
continue ;
|
continue ;
|
||||||
}
|
}
|
||||||
|
#ifdef HAVE_SYS_PTRACE_H
|
||||||
/* E17 should be in pause, we can detach */
|
/* E17 should be in pause, we can detach */
|
||||||
ptrace(PT_DETACH, child, NULL, back);
|
ptrace(PT_DETACH, child, NULL, back);
|
||||||
|
#endif
|
||||||
/* And call gdb if available */
|
/* And call gdb if available */
|
||||||
if (home)
|
if (home)
|
||||||
{
|
{
|
||||||
|
@ -545,7 +552,9 @@ main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
kill(child, SIGSTOP);
|
kill(child, SIGSTOP);
|
||||||
usleep(200000);
|
usleep(200000);
|
||||||
|
#ifdef HAVE_SYS_PTRACE_H
|
||||||
ptrace(PT_DETACH, child, NULL, NULL);
|
ptrace(PT_DETACH, child, NULL, NULL);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue