|
From: Jeremy F. <je...@go...> - 2003-11-10 21:21:53
|
CVS commit by fitzhardinge:
Fix some (bone-headed) loose ends left by my last checkin. "make regtest"
actually works this time.
M +11 -15 vg_proxylwp.c 1.4
M +6 -5 vg_syscalls.c 1.55
--- valgrind/coregrind/vg_proxylwp.c #1.3:1.4
@@ -372,20 +372,15 @@ static void proxy_fork_cleanup(ThreadId
}
- /* Create a proxy for calling thread
+ /* Create a proxy for calling thread.
- We need to temporarily set the state back to Runnable for
- proxy_create's benefit.
+ Since fork() is non-blocking, the thread status should already
+ be Runnable.
*/
+ vg_assert(VG_(is_valid_tid)(tid));
+ vg_assert(VG_(threads)[tid].proxy == NULL);
+ vg_assert(VG_(threads)[tid].status == VgTs_Runnable);
- {
- ThreadState *tst = VG_(get_ThreadState)(tid);
-
- vg_assert(tst->proxy == NULL);
- vg_assert(tst->status == VgTs_WaitSys);
- tst->status = VgTs_Runnable;
VG_(proxy_create)(tid);
VG_(proxy_setsigmask)(tid);
- tst->status = VgTs_WaitSys;
- }
}
@@ -443,5 +438,6 @@ void VG_(proxy_handlesig)(const vki_ksig
eax contains the correct syscall return value, and the new
state is effectively PXS_SysDone. */
- vg_assert(px->state == PXS_RunSyscall || px->state == PXS_SysDone);
+ vg_assert(px->state == PXS_RunSyscall ||
+ px->state == PXS_SysDone);
px->state = PXS_SysDone;
px->tst->m_eax = eax;
--- valgrind/coregrind/vg_syscalls.c #1.54:1.55
@@ -4436,5 +4436,8 @@ Bool VG_(pre_syscall) ( ThreadId tid )
syscall_done = True;
} else if (sys->may_block) {
- /* issue to worker */
+ /* Issue to worker. If we're waiting on the syscall because
+ it's in the hands of the ProxyLWP, then set the thread
+ state to WaitSys. */
+ tst->status = VgTs_WaitSys;
VG_(sys_issue)(tid);
} else {
@@ -4453,8 +4456,6 @@ Bool VG_(pre_syscall) ( ThreadId tid )
VGP_POPCC(VgpCoreSysWrap);
- /* If we're waiting on the syscall because it's in the hands of the
- ProxyLWP, then set the thread state to WaitSys. */
- if (!syscall_done)
- tst->status = VgTs_WaitSys;
+ vg_assert(( syscall_done && tst->status == VgTs_Runnable) ||
+ (!syscall_done && tst->status == VgTs_WaitSys ));
return syscall_done;
|