diff options
author | Jeremy Katz <katzj@redhat.com> | 2005-12-20 20:23:25 +0000 |
---|---|---|
committer | Jeremy Katz <katzj@redhat.com> | 2005-12-20 20:23:25 +0000 |
commit | a703d87ae20c34a05029d37d7fdaf5f117a643ac (patch) | |
tree | a88101475f375749a84b60f3e2265fc12c3cf782 | |
parent | c601be0c36205a11964d91f67c5369c01af34360 (diff) | |
download | anaconda-a703d87ae20c34a05029d37d7fdaf5f117a643ac.tar.gz anaconda-a703d87ae20c34a05029d37d7fdaf5f117a643ac.tar.xz anaconda-a703d87ae20c34a05029d37d7fdaf5f117a643ac.zip |
2005-12-20 Jeremy Katz <katzj@redhat.com>
* loader2/loader.c: Give a stacktrace on SIGSEGV to make things
easier to debug.
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | loader2/loader.c | 24 |
2 files changed, 29 insertions, 0 deletions
@@ -1,3 +1,8 @@ +2005-12-20 Jeremy Katz <katzj@redhat.com> + + * loader2/loader.c: Give a stacktrace on SIGSEGV to make things + easier to debug. + 2005-12-20 Bill Nottingham <notting@redhat.com> * iutil.py (getPPCMachine): Be silent on non-ppc arches. diff --git a/loader2/loader.c b/loader2/loader.c index 098f99f0c..f722e5b01 100644 --- a/loader2/loader.c +++ b/loader2/loader.c @@ -24,6 +24,7 @@ #include <ctype.h> #include <errno.h> +#include <execinfo.h> #include <fcntl.h> #include <newt.h> #include <popt.h> @@ -1138,6 +1139,26 @@ static int hasGraphicalOverride() { return 0; } +static void loaderSegvHandler(int signum) { + void *array[10]; + size_t size; + char **strings; + size_t i; + + signal(SIGSEGV, SIG_DFL); /* back to default */ + + newtFinished(); + size = backtrace (array, 10); + strings = backtrace_symbols (array, size); + + printf ("loader received SIGSEGV!. Backtrace:\n"); + for (i = 0; i < size; i++) + printf ("%s\n", strings[i]); + + free (strings); + exit(1); +} + int main(int argc, char ** argv) { int flags = LOADER_FLAGS_SELINUX | LOADER_FLAGS_NOFB; struct stat sb; @@ -1175,6 +1196,9 @@ int main(int argc, char ** argv) { { 0, 0, 0, 0, 0, 0, 0 } }; + /* set up signal handler */ + signal(SIGSEGV, loaderSegvHandler); + /* Make sure sort order is right. */ setenv ("LC_COLLATE", "C", 1); |