save crash image when sigPWR or sigHUP arrives
authorClaus Gittinger <cg@exept.de>
Tue, 08 May 2001 16:35:12 +0200
changeset 5856 6d3df9ad361e
parent 5855 dead3acb2abf
child 5857 75c7b5074add
save crash image when sigPWR or sigHUP arrives
Object.st
--- a/Object.st	Tue May 08 16:20:47 2001 +0200
+++ b/Object.st	Tue May 08 16:35:12 2001 +0200
@@ -4495,7 +4495,7 @@
     "
      special case - since SIGPIPE has an ST-signal associated
     "
-    (signalNumber == 13) ifTrue:[
+    (signalNumber == 13 "OperatingSystem sigPIPE") ifTrue:[
         "SIGPIPE - write on a pipe with no one to read"
 
         ^ PipeStream brokenPipeSignal raise.
@@ -4515,6 +4515,15 @@
     ].
 
     "
+     special case - SIGPWR/SIGHUP: write a crash image
+    "
+    ((signalNumber == 30 "OperatingSystem sigPWR") 
+    or:[signalNumber == 1 "OperatingSystem sigHUP"]) ifTrue:[
+        ObjectMemory snapShotOn:'crash.img'.
+        ^ self.
+    ].
+
+    "
      ... otherwise , bring up a box asking for what to do ...
     "
     name := OperatingSystem nameForSignal:signalNumber.
@@ -4603,8 +4612,9 @@
         ^ self
     ].
 
-    titles := #('dump core' 'exit ST/X').
+    titles := #('save crash image' 'dump core' 'exit ST/X').
     actions := Array 
+                 with:[ObjectMemory snapShotOn:'crash.img']
                  with:[Smalltalk fatalAbort]
                  with:[Smalltalk exit].
 
@@ -4633,9 +4643,7 @@
         actions := actions , (Array with:[action := #ignore]).
     ].
 
-    box := OptionBox 
-                title:title
-                numberOfOptions:actions size.
+    box := OptionBox title:title numberOfOptions:actions size.
     ignorable ifTrue:[
         box defaultButtonIndex:(actions size)
     ].
@@ -8309,6 +8317,6 @@
 !Object class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Object.st,v 1.356 2001-03-09 10:47:16 martin Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Object.st,v 1.357 2001-05-08 14:35:12 cg Exp $'
 ! !
 Object initialize!