From 16ae73470f07b0adbdf66d167c1dd8245596c9e9 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Mon, 2 Aug 2004 13:15:26 +0000 Subject: [PATCH] Tweak to remove another global variable from vg_include.h git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2547 --- coregrind/vg_include.h | 5 ++--- coregrind/vg_main.c | 17 +++++++++-------- coregrind/vg_signals.c | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/coregrind/vg_include.h b/coregrind/vg_include.h index d4f5ac0250..1467785093 100644 --- a/coregrind/vg_include.h +++ b/coregrind/vg_include.h @@ -1331,9 +1331,8 @@ extern UInt VG_(dispatch_ctr); 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 d314e267ec..1cd38d5976 100644 --- a/coregrind/vg_main.c +++ b/coregrind/vg_main.c @@ -151,10 +151,11 @@ Char** VG_(client_envp); /* 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 @@ int main(int argc, char **argv) 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 e5ec2d144f..5731a10cff 100644 --- a/coregrind/vg_signals.c +++ b/coregrind/vg_signals.c @@ -1795,9 +1795,9 @@ static void vg_default_action(const vki_ksiginfo_t *info, ThreadId tid) 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); } } -- 2.47.2