summaryrefslogtreecommitdiff
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
parentfd271ba0c8f28dfa410d4d6177ed0b002d971ea3 (diff)
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)
81 else if (i == 2) 81 else if (i == 2)
82 pid = atoi(argv[i]); // E's pid 82 pid = atoi(argv[i]); // E's pid
83 else if (i == 3) 83 else if (i == 3)
84 backtrace_str = argv[i];
85 else if (i == 4)
86 exit_gdb = atoi(argv[i]); 84 exit_gdb = atoi(argv[i]);
85 else if (i == 4)
86 backtrace_str = argv[i];
87 } 87 }
88 88
89 fprintf(stderr, "exit_gdb: %i\n", exit_gdb); 89 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)
563#endif 563#endif
564 /* And call gdb if available */ 564 /* And call gdb if available */
565 r = 0; 565 r = 0;
566
566 if (home) 567 if (home)
567 { 568 {
569 struct stat st;
570
568 /* call e_sys gdb */ 571 /* call e_sys gdb */
569 snprintf(buffer, sizeof(buffer), 572 snprintf(buffer, sizeof(buffer),
570 "gdb " 573 "gdb "
@@ -585,20 +588,24 @@ main(int argc, char **argv)
585 "%s/.e-crashdump.txt", 588 "%s/.e-crashdump.txt",
586 home); 589 home);
587 590
588 backtrace_str = strdup(buffer); 591 /* Check the file was correctly generated (may fail on crappy kernel with ptrace
592 diable). In which case a manual : echo 0 > /proc/sys/kernel/yama/ptrace_scope
593 as root is necessary. */
594 if (!stat(buffer, &st))
595 backtrace_str = strdup(buffer);
589 r = WEXITSTATUS(r); 596 r = WEXITSTATUS(r);
590 } 597 }
591 598
592 /* call e_alert */ 599 /* call e_alert */
593 snprintf(buffer, 4096, 600 snprintf(buffer, 4096,
594 backtrace_str ? 601 backtrace_str ?
595 "%s/enlightenment/utils/enlightenment_alert %i %i '%s' %i" : 602 "%s/enlightenment/utils/enlightenment_alert %i %i %i '%s'" :
596 "%s/enlightenment/utils/enlightenment_alert %i %i '%s' %i", 603 "%s/enlightenment/utils/enlightenment_alert %i %i %i",
597 eina_prefix_lib_get(pfx), 604 eina_prefix_lib_get(pfx),
598 sig.si_signo == SIGSEGV && remember_sigusr1 ? SIGILL : sig.si_signo, 605 sig.si_signo == SIGSEGV && remember_sigusr1 ? SIGILL : sig.si_signo,
599 child, 606 child,
600 backtrace_str, 607 r,
601 r); 608 backtrace_str);
602 r = system(buffer); 609 r = system(buffer);
603 610
604 /* kill e */ 611 /* kill e */