aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@samsung.com>2013-12-19 16:39:46 +0900
committerCedric BAIL <cedric.bail@samsung.com>2013-12-19 16:39:46 +0900
commit147f088efae2885c52d6f4a71bdac9f9945f7138 (patch)
tree3af6cbafe6529923d75e5f2f77e640981c0a6f58 /src
parentgdb: don't forget to turn on file logging to get anything useful. (diff)
downloadenlightenment-147f088efae2885c52d6f4a71bdac9f9945f7138.tar.gz
gdb: detect that the file was generated properly.
This is a workaround kernel that prevent ptrace to another process.
Diffstat (limited to 'src')
-rw-r--r--src/bin/e_alert_main.c4
-rw-r--r--src/bin/e_start_main.c17
2 files changed, 14 insertions, 7 deletions
diff --git a/src/bin/e_alert_main.c b/src/bin/e_alert_main.c
index 5cd18904d..1513a91fb 100644
--- a/src/bin/e_alert_main.c
+++ b/src/bin/e_alert_main.c
@@ -81,9 +81,9 @@ main(int argc, char **argv)
else if (i == 2)
pid = atoi(argv[i]); // E's pid
else if (i == 3)
- backtrace_str = argv[i];
- else if (i == 4)
exit_gdb = atoi(argv[i]);
+ else if (i == 4)
+ backtrace_str = argv[i];
}
fprintf(stderr, "exit_gdb: %i\n", exit_gdb);
diff --git a/src/bin/e_start_main.c b/src/bin/e_start_main.c
index 7b0c8c37c..fa28cc825 100644
--- a/src/bin/e_start_main.c
+++ b/src/bin/e_start_main.c
@@ -563,8 +563,11 @@ main(int argc, char **argv)
#endif
/* And call gdb if available */
r = 0;
+
if (home)
{
+ struct stat st;
+
/* call e_sys gdb */
snprintf(buffer, sizeof(buffer),
"gdb "
@@ -585,20 +588,24 @@ main(int argc, char **argv)
"%s/.e-crashdump.txt",
home);
- backtrace_str = strdup(buffer);
+ /* Check the file was correctly generated (may fail on crappy kernel with ptrace
+ diable). In which case a manual : echo 0 > /proc/sys/kernel/yama/ptrace_scope
+ as root is necessary. */
+ if (!stat(buffer, &st))
+ backtrace_str = strdup(buffer);
r = WEXITSTATUS(r);
}
/* call e_alert */
snprintf(buffer, 4096,
backtrace_str ?
- "%s/enlightenment/utils/enlightenment_alert %i %i '%s' %i" :
- "%s/enlightenment/utils/enlightenment_alert %i %i '%s' %i",
+ "%s/enlightenment/utils/enlightenment_alert %i %i %i '%s'" :
+ "%s/enlightenment/utils/enlightenment_alert %i %i %i",
eina_prefix_lib_get(pfx),
sig.si_signo == SIGSEGV && remember_sigusr1 ? SIGILL : sig.si_signo,
child,
- backtrace_str,
- r);
+ r,
+ backtrace_str);
r = system(buffer);
/* kill e */