From: Jeremy Fitzhardinge Date: Mon, 10 Nov 2003 21:21:00 +0000 (+0000) Subject: Fix some (bone-headed) loose ends left by my last checkin. "make regtest" X-Git-Tag: svn/VALGRIND_2_1_0~72 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f15fa06f97ee817b5dcbd6f36297cb277fccd93d;p=thirdparty%2Fvalgrind.git Fix some (bone-headed) loose ends left by my last checkin. "make regtest" actually works this time. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2018 --- diff --git a/coregrind/vg_proxylwp.c b/coregrind/vg_proxylwp.c index 9fc470ad3e..aba9217490 100644 --- a/coregrind/vg_proxylwp.c +++ b/coregrind/vg_proxylwp.c @@ -371,22 +371,17 @@ static void proxy_fork_cleanup(ThreadId tid) tst->proxy = NULL; } - /* Create a proxy for calling thread - - We need to temporarily set the state back to Runnable for - proxy_create's benefit. + /* Create a proxy for calling thread. + + 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; - } + VG_(proxy_create)(tid); + VG_(proxy_setsigmask)(tid); } Int VG_(proxy_resfd)(void) @@ -442,7 +437,8 @@ void VG_(proxy_handlesig)(const vki_ksiginfo_t *siginfo, signal, or the syscall completed normally. In either case 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; } diff --git a/coregrind/vg_syscalls.c b/coregrind/vg_syscalls.c index 91a3db5b9c..cebcef7ae4 100644 --- a/coregrind/vg_syscalls.c +++ b/coregrind/vg_syscalls.c @@ -4435,7 +4435,10 @@ Bool VG_(pre_syscall) ( ThreadId tid ) anything - just pretend the syscall happened. */ 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 { /* run the syscall directly */ @@ -4452,10 +4455,8 @@ 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; }