Convert VG_(exitcode), a global variable, into a local variable.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2436
This commit is contained in:
Nicholas Nethercote 2004-06-22 14:18:42 +00:00
parent e55637b2b6
commit 17afdbd107
3 changed files with 8 additions and 17 deletions

View File

@ -980,7 +980,7 @@ typedef
/* The scheduler. */
extern VgSchedReturnCode VG_(scheduler) ( void );
extern VgSchedReturnCode VG_(scheduler) ( Int* exit_code );
extern void VG_(scheduler_init) ( void );
@ -1474,11 +1474,6 @@ extern UInt VG_(dispatch_ctr);
/* This is the ThreadId of the last thread the scheduler ran. */
extern ThreadId VG_(last_run_tid);
/* This is the argument to __NR_exit() supplied by the first thread to
call that syscall. We eventually pass that to __NR_exit() for
real. */
extern Int VG_(exitcode);
/* 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 */

View File

@ -179,11 +179,6 @@ ThreadId VG_(last_run_tid) = 0;
descriptor or a socket descriptor. */
Bool VG_(logging_to_filedes) = True;
/* This is the argument to __NR_exit() supplied by the first thread to
call that syscall. We eventually pass that to __NR_exit() for
real. */
Int VG_(exitcode) = 0;
/*====================================================================*/
/*=== Counters, for profiling purposes only ===*/
@ -2633,6 +2628,7 @@ int main(int argc, char **argv)
Addr esp_at_startup; /* client's %esp at the point we gained control. */
UInt * client_auxv;
VgSchedReturnCode src;
Int exitcode = 0;
vki_rlimit zero = { 0, 0 };
//============================================================
@ -2976,7 +2972,7 @@ int main(int argc, char **argv)
if (__builtin_setjmp(&VG_(fatal_signal_jmpbuf)) == 0) {
VG_(fatal_signal_set) = True;
src = VG_(scheduler)();
src = VG_(scheduler)( &exitcode );
} else
src = VgSrc_FatalSig;
@ -3003,7 +2999,7 @@ int main(int argc, char **argv)
if (VG_(needs).core_errors || VG_(needs).skin_errors)
VG_(show_all_errors)();
SK_(fini)( VG_(exitcode) );
SK_(fini)( exitcode );
VG_(do_sanity_checks)( True /*include expensive checks*/ );
@ -3045,7 +3041,7 @@ int main(int argc, char **argv)
/* The thread's %EBX at the time it did __NR_exit() will hold
the arg to __NR_exit(), so we just do __NR_exit() with
that arg. */
VG_(exit)( VG_(exitcode) );
VG_(exit)( exitcode );
/* NOT ALIVE HERE! */
VG_(core_panic)("entered the afterlife in main() -- ExitSyscall");
break; /* what the hell :) */

View File

@ -876,7 +876,7 @@ void idle ( void )
* One thread asks to shutdown Valgrind
* The specified number of basic blocks has gone by.
*/
VgSchedReturnCode VG_(scheduler) ( void )
VgSchedReturnCode VG_(scheduler) ( Int* exitcode )
{
ThreadId tid, tid_next;
UInt trc;
@ -956,7 +956,7 @@ VgSchedReturnCode VG_(scheduler) ( void )
/* All threads have exited - pretend someone called exit() */
if (n_waiting_for_reaper == n_exists) {
VG_(exitcode) = 0; /* ? */
*exitcode = 0; /* ? */
return VgSrc_ExitSyscall;
}
@ -1108,7 +1108,7 @@ VgSchedReturnCode VG_(scheduler) ( void )
) {
/* If __NR_exit, remember the supplied argument. */
VG_(exitcode) = VG_(threads)[tid].m_ebx; /* syscall arg1 */
*exitcode = VG_(threads)[tid].m_ebx; /* syscall arg1 */
/* Only run __libc_freeres if the tool says it's ok and
it hasn't been overridden with --run-libc-freeres=no