Tweak to remove another global variable from vg_include.h


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2547 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/vg_include.h b/coregrind/vg_include.h
index d4f5ac0..1467785 100644
--- a/coregrind/vg_include.h
+++ b/coregrind/vg_include.h
@@ -1331,9 +1331,8 @@
 extern ThreadId VG_(last_run_tid);
 
 /* If we're doing the default action of a fatal signal */
-extern jmp_buf VG_(fatal_signal_jmpbuf);
-extern Bool    VG_(fatal_signal_set);		/* jmp_buf is valid */
-extern Int     VG_(fatal_sigNo);		/* the fatal signal */
+extern jmp_buf* VG_(fatal_signal_jmpbuf_ptr);
+extern Int      VG_(fatal_sigNo);		/* the fatal signal */
 
 /* --- Counters, for informational purposes only. --- */
 
diff --git a/coregrind/vg_main.c b/coregrind/vg_main.c
index d314e26..1cd38d5 100644
--- a/coregrind/vg_main.c
+++ b/coregrind/vg_main.c
@@ -151,10 +151,11 @@
 /* Our signal delivery stack. */
 UInt VG_(sigstack)[VG_SIGSTACK_SIZE_W];
 
-/* jmp_buf for fatal signals */
-Int	VG_(fatal_sigNo) = -1;
-Bool	VG_(fatal_signal_set) = False;
-jmp_buf VG_(fatal_signal_jmpbuf);
+/* jmp_buf for fatal signals;  VG_(fatal_signal_jmpbuf_ptr) is NULL until
+   the time is right that it can be used. */
+Int      VG_(fatal_sigNo) = -1;
+jmp_buf* VG_(fatal_signal_jmpbuf_ptr) = NULL;
+jmp_buf  fatal_signal_jmpbuf;
 
 /* Counts downwards in VG_(run_innerloop). */
 UInt VG_(dispatch_ctr);
@@ -2980,12 +2981,12 @@
    VGP_POPCC(VgpStartup);
    VGP_PUSHCC(VgpSched);
 
-   if (__builtin_setjmp(&VG_(fatal_signal_jmpbuf)) == 0) {
-      VG_(fatal_signal_set) = True;
+   VG_(fatal_signal_jmpbuf_ptr) = &fatal_signal_jmpbuf;
+   if (__builtin_setjmp(VG_(fatal_signal_jmpbuf_ptr)) == 0) {
       src = VG_(scheduler)( &exitcode );
-   } else
+   } else {
       src = VgSrc_FatalSig;
-
+   }
    VGP_POPCC(VgpSched);
 
 
diff --git a/coregrind/vg_signals.c b/coregrind/vg_signals.c
index e5ec2d1..5731a10 100644
--- a/coregrind/vg_signals.c
+++ b/coregrind/vg_signals.c
@@ -1795,9 +1795,9 @@
 	 VG_(setrlimit)(VKI_RLIMIT_CORE, &zero);
       }
 
-      if (VG_(fatal_signal_set)) {
+      if (NULL != VG_(fatal_signal_jmpbuf_ptr)) {
 	 VG_(fatal_sigNo) = sigNo;
-	 __builtin_longjmp(VG_(fatal_signal_jmpbuf), 1);
+	 __builtin_longjmp(*VG_(fatal_signal_jmpbuf_ptr), 1);
       }
    }