diff options
author | Peter Jones <pjones@redhat.com> | 2006-02-23 20:00:21 +0000 |
---|---|---|
committer | Peter Jones <pjones@redhat.com> | 2006-02-23 20:00:21 +0000 |
commit | aaf6e50ad77c950de9d53a12f7090422cda5d9d1 (patch) | |
tree | ae50edbdd3b124eb9240c76b64cbe912ecf892b8 /isys/isys.c | |
parent | 4ca5fc180ccc79adb8d0376ad720e5e3a1b60f35 (diff) | |
download | anaconda-aaf6e50ad77c950de9d53a12f7090422cda5d9d1.tar.gz anaconda-aaf6e50ad77c950de9d53a12f7090422cda5d9d1.tar.xz anaconda-aaf6e50ad77c950de9d53a12f7090422cda5d9d1.zip |
- add segv handler that dumps backtraces
Diffstat (limited to 'isys/isys.c')
-rw-r--r-- | isys/isys.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/isys/isys.c b/isys/isys.c index ebd415089..32a9ad6d4 100644 --- a/isys/isys.c +++ b/isys/isys.c @@ -43,6 +43,9 @@ #include <linux/major.h> #include <linux/raid/md_u.h> #include <linux/raid/md_p.h> +#include <signal.h> +#include <execinfo.h> + #include "imount.h" #include "isys.h" @@ -115,6 +118,7 @@ static PyObject * doResetFileContext(PyObject * s, PyObject * args); static PyObject * isWireless(PyObject * s, PyObject * args); static PyObject * doProbeBiosDisks(PyObject * s, PyObject * args); static PyObject * doGetBiosDisk(PyObject * s, PyObject * args); +static PyObject * doSegvHandler(PyObject *s, PyObject *args); static PyMethodDef isysModuleMethods[] = { { "ejectcdrom", (PyCFunction) doEjectCdrom, METH_VARARGS, NULL }, @@ -173,6 +177,7 @@ static PyMethodDef isysModuleMethods[] = { { "isWireless", (PyCFunction) isWireless, METH_VARARGS, NULL }, { "biosDiskProbe", (PyCFunction) doProbeBiosDisks, METH_VARARGS,NULL}, { "getbiosdisk",(PyCFunction) doGetBiosDisk, METH_VARARGS,NULL}, + { "handleSegv", (PyCFunction) doSegvHandler, METH_VARARGS, NULL }, { NULL, NULL, 0, NULL } } ; @@ -1430,3 +1435,22 @@ static PyObject * doGetBiosDisk(PyObject * s, PyObject * args) { return Py_BuildValue("s", diskname); } + +static PyObject * doSegvHandler(PyObject *s, PyObject *args) { + void *array[20]; + size_t size; + char **strings; + size_t i; + + signal(SIGSEGV, SIG_DFL); /* back to default */ + + size = backtrace (array, 20); + strings = backtrace_symbols (array, size); + + printf ("Anaconda received SIGSEGV!. Backtrace:\n"); + for (i = 0; i < size; i++) + printf ("%s\n", strings[i]); + + free (strings); + exit(1); +} |