summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Lehman <dlehman@redhat.com>2008-12-08 11:59:46 -0600
committerDavid Lehman <dlehman@redhat.com>2008-12-08 12:03:19 -0600
commit15d8a4bc5247079bf486939b093ebac15992f83b (patch)
tree8b536fa05334038d56d61d0507d86dfe811e6d9f
parent64b793a0136323ea2bb8e1d58628d454cd59724c (diff)
downloadanaconda-15d8a4bc5247079bf486939b093ebac15992f83b.tar.gz
anaconda-15d8a4bc5247079bf486939b093ebac15992f83b.tar.xz
anaconda-15d8a4bc5247079bf486939b093ebac15992f83b.zip
Write anacdump.txt upon receipt of SIGUSR2 (from clumens).
This is the patch Chris posted, modified to use inspect.stack to generate the traceback.
-rwxr-xr-xanaconda14
-rw-r--r--exception.py5
2 files changed, 17 insertions, 2 deletions
diff --git a/anaconda b/anaconda
index ade122dc6..624c19ca1 100755
--- a/anaconda
+++ b/anaconda
@@ -502,6 +502,15 @@ class Anaconda:
# *sigh* we still need to be able to write this out
self.xdriver = None
+ def dumpState(self):
+ from exception import AnacondaExceptionDump
+ from inspect import stack as _stack
+ # Skip the frames for dumpState and the signal handler.
+ stack = _stack()[2:]
+ stack.reverse()
+ exn = AnacondaExceptionDump(None, None, stack)
+ exn.write(anaconda)
+
def writeXdriver(self, instPath="/"):
# this should go away at some point, but until it does, we
# need to keep it around. it could go into instdata but this
@@ -609,7 +618,7 @@ if __name__ == "__main__":
# this handles setting up updates for pypackages to minimize the set needed
setupPythonUpdates()
- import signal, traceback, string, isys, iutil, time
+ import signal, string, isys, iutil, time
from exception import handleException
import dispatch
import warnings
@@ -632,6 +641,9 @@ if __name__ == "__main__":
signal.signal(signal.SIGINT, signal.SIG_DFL)
signal.signal(signal.SIGSEGV, isys.handleSegv)
+ # add our own additional signal handlers
+ signal.signal(signal.SIGUSR2, lambda signum, frame: anaconda.dumpState())
+
setupEnvironment()
# we need to do this really early so we make sure its done before rpm
diff --git a/exception.py b/exception.py
index 28c0afb38..a53e60edb 100644
--- a/exception.py
+++ b/exception.py
@@ -71,7 +71,10 @@ class AnacondaExceptionDump:
lst.reverse()
lst.insert(0, "anaconda %s exception report\n" % os.getenv("ANACONDAVERSION"))
lst.insert(1, 'Traceback (most recent call first):\n')
- lst.extend(traceback.format_exception_only(self.type, self.value))
+
+ if self.type is not None and self.value is not None:
+ lst.extend(traceback.format_exception_only(self.type, self.value))
+
return joinfields(lst, "")
def format_stack(self):