e: detect when sysactions.conf doesn't let us run gdb.

SVN revision: 79731
This commit is contained in:
Cedric BAIL 2012-11-27 03:48:05 +00:00
parent 003fa1bfbd
commit 85b27ab7e3
2 changed files with 27 additions and 5 deletions

View File

@ -58,6 +58,7 @@ static int ret = 0, sig = 0;
static pid_t pid;
static Eina_Bool tainted = EINA_TRUE;
static const char *backtrace_str = NULL;
static int exit_gdb = 0;
int
main(int argc, char **argv)
@ -81,8 +82,12 @@ main(int argc, char **argv)
pid = atoi(argv[i]); // E's pid
else if (i == 3)
backtrace_str = argv[i];
else if (i == 4)
exit_gdb = atoi(argv[i]);
}
fprintf(stderr, "exit_gdb: %i\n", exit_gdb);
tmp = getenv("E17_TAINTED");
if (tmp && !strcmp(tmp, "NO"))
tainted = EINA_FALSE;
@ -540,7 +545,18 @@ _e_alert_draw_text(void)
if (!tainted)
{
if (backtrace_str)
if (exit_gdb)
{
snprintf(msg, sizeof(msg),
"This is not meant to happen and is likely a sign of \n"
"a bug in Enlightenment or the libraries it relies \n"
"on. We were not able to generate a backtrace, check \n"
"if your 'sysactions.conf' has an 'gdb' action line.\n"
"\n"
"Please compile latest svn E17 and EFL with\n"
"-g and -ggdb3 in your CFLAGS.\n");
}
else if (backtrace_str)
{
snprintf(msg, sizeof(msg),
"This is not meant to happen and is likely a sign of \n"
@ -559,8 +575,8 @@ _e_alert_draw_text(void)
"This is not meant to happen and is likely a sign of \n"
"a bug in Enlightenment or the libraries it relies \n"
"on. You can gdb attach to this process (%d) now \n"
"to try debug it or you could exit, or just hit \n"
"restart to try and get your desktop back the way \n"
"to try debug it or you could logout, or just hit \n"
"recover to try and get your desktop back the way \n"
"it was.\n"
"\n"
"Please compile latest svn E17 and EFL with\n"

View File

@ -248,6 +248,7 @@ main(int argc, char **argv)
Eina_Bool restart = EINA_TRUE;
#endif
/* Setup USR1 to detach from the child process and let it get gdb by advanced users */
action.sa_sigaction = _sigusr1;
action.sa_flags = SA_RESETHAND;
sigemptyset(&action.sa_mask);
@ -505,6 +506,7 @@ main(int argc, char **argv)
ptrace(PT_DETACH, child, NULL, back);
#endif
/* And call gdb if available */
r = 0;
if (home)
{
/* call e_sys gdb */
@ -523,15 +525,19 @@ main(int argc, char **argv)
home);
backtrace_str = strdup(buffer);
r = WEXITSTATUS(r);
}
/* call e_alert */
snprintf(buffer, 4096,
backtrace_str ? "%s/enlightenment/utils/enlightenment_alert %i %i %s" : "%s/enlightenment/utils/enlightenment_alert %i %i %s",
backtrace_str ?
"%s/enlightenment/utils/enlightenment_alert %i %i '%s' %i" :
"%s/enlightenment/utils/enlightenment_alert %i %i '%s' %i",
eina_prefix_lib_get(pfx),
sig.si_signo == SIGSEGV && remember_sigusr1 ? SIGILL : sig.si_signo,
child,
backtrace_str);
backtrace_str,
r);
r = system(buffer);
/* kill e */