|
From: Nicholas N. <nj...@ca...> - 2004-06-22 14:18:51
|
CVS commit by nethercote:
Convert VG_(exitcode), a global variable, into a local variable.
M +1 -6 vg_include.h 1.196
M +4 -8 vg_main.c 1.161
M +3 -3 vg_scheduler.c 1.152
--- valgrind/coregrind/vg_include.h #1.195:1.196
@@ -981,5 +981,5 @@ typedef
/* The scheduler. */
-extern VgSchedReturnCode VG_(scheduler) ( void );
+extern VgSchedReturnCode VG_(scheduler) ( Int* exit_code );
extern void VG_(scheduler_init) ( void );
@@ -1475,9 +1475,4 @@ extern UInt VG_(dispatch_ctr);
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);
--- valgrind/coregrind/vg_main.c #1.160:1.161
@@ -180,9 +180,4 @@ ThreadId VG_(last_run_tid) = 0;
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;
-
/*====================================================================*/
@@ -2634,4 +2629,5 @@ int main(int argc, char **argv)
UInt * client_auxv;
VgSchedReturnCode src;
+ Int exitcode = 0;
vki_rlimit zero = { 0, 0 };
@@ -2977,5 +2973,5 @@ 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;
@@ -3004,5 +3000,5 @@ int main(int argc, char **argv)
VG_(show_all_errors)();
- SK_(fini)( VG_(exitcode) );
+ SK_(fini)( exitcode );
VG_(do_sanity_checks)( True /*include expensive checks*/ );
@@ -3046,5 +3042,5 @@ int main(int argc, char **argv)
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");
--- valgrind/coregrind/vg_scheduler.c #1.151:1.152
@@ -877,5 +877,5 @@ void idle ( void )
* The specified number of basic blocks has gone by.
*/
-VgSchedReturnCode VG_(scheduler) ( void )
+VgSchedReturnCode VG_(scheduler) ( Int* exitcode )
{
ThreadId tid, tid_next;
@@ -957,5 +957,5 @@ 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;
}
@@ -1109,5 +1109,5 @@ 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
|