From: Nicholas Nethercote Date: Fri, 13 May 2005 22:09:26 +0000 (+0000) Subject: VGA_(terminate) doesn't need to be exported. X-Git-Tag: svn/VALGRIND_3_0_0~620 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ea42fb2dff612950efce59d975eb033cefb655c7;p=thirdparty%2Fvalgrind.git VGA_(terminate) doesn't need to be exported. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3698 --- diff --git a/coregrind/core.h b/coregrind/core.h index 8c6d2ca999..feca949afc 100644 --- a/coregrind/core.h +++ b/coregrind/core.h @@ -886,9 +886,6 @@ void VGA_(main_thread_wrapper)(ThreadId tid) __attribute__ ((__noreturn__)); // Return how many bytes of a thread's Valgrind stack are unused SSizeT VGA_(stack_unused)(ThreadId tid); -// Terminate the process. Does not return. -void VGA_(terminate)(ThreadId tid, VgSchedReturnCode src) __attribute__((__noreturn__)); - // wait until all other threads are dead extern void VGA_(reap_threads)(ThreadId self); diff --git a/coregrind/linux/core_os.c b/coregrind/linux/core_os.c index c5d990d5e5..93a1661191 100644 --- a/coregrind/linux/core_os.c +++ b/coregrind/linux/core_os.c @@ -45,6 +45,33 @@ void VGA_(os_state_init)(ThreadState *tst) VGA_(os_state_clear)(tst); } +static void terminate(ThreadId tid, VgSchedReturnCode src) +{ + vg_assert(tid == VG_(master_tid)); + vg_assert(VG_(count_living_threads)() == 0); + + //-------------------------------------------------------------- + // Exit, according to the scheduler's return code + //-------------------------------------------------------------- + switch (src) { + case VgSrc_ExitSyscall: /* the normal way out */ + VG_(exit)( VG_(threads)[VG_(master_tid)].os_state.exitcode ); + /* NOT ALIVE HERE! */ + VG_(core_panic)("entered the afterlife in main() -- ExitSyscall"); + break; /* what the hell :) */ + + case VgSrc_FatalSig: + /* We were killed by a fatal signal, so replicate the effect */ + vg_assert(VG_(threads)[VG_(master_tid)].os_state.fatalsig != 0); + VG_(kill_self)(VG_(threads)[VG_(master_tid)].os_state.fatalsig); + VG_(core_panic)("main(): signal was supposed to be fatal"); + break; + + default: + VG_(core_panic)("main(): unexpected scheduler return code"); + } +} + /* Run a thread from beginning to end. Does not return. */ void VGA_(thread_wrapper)(Word /*ThreadId*/ tidW) { @@ -78,34 +105,7 @@ void VGA_(thread_wrapper)(Word /*ThreadId*/ tidW) if (tid == VG_(master_tid)) { VG_(shutdown_actions)(tid); - VGA_(terminate)(tid, ret); - } -} - -void VGA_(terminate)(ThreadId tid, VgSchedReturnCode src) -{ - vg_assert(tid == VG_(master_tid)); - vg_assert(VG_(count_living_threads)() == 0); - - //-------------------------------------------------------------- - // Exit, according to the scheduler's return code - //-------------------------------------------------------------- - switch (src) { - case VgSrc_ExitSyscall: /* the normal way out */ - VG_(exit)( VG_(threads)[VG_(master_tid)].os_state.exitcode ); - /* NOT ALIVE HERE! */ - VG_(core_panic)("entered the afterlife in main() -- ExitSyscall"); - break; /* what the hell :) */ - - case VgSrc_FatalSig: - /* We were killed by a fatal signal, so replicate the effect */ - vg_assert(VG_(threads)[VG_(master_tid)].os_state.fatalsig != 0); - VG_(kill_self)(VG_(threads)[VG_(master_tid)].os_state.fatalsig); - VG_(core_panic)("main(): signal was supposed to be fatal"); - break; - - default: - VG_(core_panic)("main(): unexpected scheduler return code"); + terminate(tid, ret); } }