From 00dbbed2a13f50db28a10cd843b04ac6c42e4af9 Mon Sep 17 00:00:00 2001 From: Julian Seward Date: Sun, 14 Apr 2002 02:46:33 +0000 Subject: [PATCH] Minor cleanups: * when a thread exits, mark its stack as noaccess * print VgTs_Sleeping status correctly git-svn-id: svn://svn.valgrind.org/valgrind/trunk@63 --- coregrind/vg_scheduler.c | 10 +++++++++- vg_scheduler.c | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/coregrind/vg_scheduler.c b/coregrind/vg_scheduler.c index cb7d5a943c..695f086eff 100644 --- a/coregrind/vg_scheduler.c +++ b/coregrind/vg_scheduler.c @@ -54,7 +54,8 @@ suitable for use by anyone at all! specified and they are interrupted by a signal. nanosleep just pretends signals don't exist -- should be fixed. -- when a thread is done mark its stack as noaccess +- Read/write syscall starts: don't crap out when the initial + nonblocking read/write returns an error. - 0xDEADBEEF syscall errors ... fix. @@ -140,6 +141,7 @@ void pp_sched_status ( void ) case VgTs_WaitJoiner: VG_(printf)("WaitJoiner(%d)\n", vg_threads[i].joiner); break; case VgTs_WaitJoinee: VG_(printf)("WaitJoinee\n"); break; + case VgTs_Sleeping: VG_(printf)("Sleeping\n"); break; default: VG_(printf)("???"); break; } } @@ -1260,6 +1262,9 @@ void handle_pthread_return ( ThreadId tid, void* retval ) vg_threads[jnr].m_edx = 0; /* success */ vg_threads[jnr].status = VgTs_Runnable; vg_threads[tid].status = VgTs_Empty; /* bye! */ + if (VG_(clo_instrument) && tid != 0) + VGM_(make_noaccess)( vg_threads[tid].stack_base, + vg_threads[tid].stack_size ); if (VG_(clo_trace_sched)) { VG_(sprintf)(msg_buf, "root fn returns, to find a waiting pthread_join(%d)", tid); @@ -1319,6 +1324,9 @@ void do_pthread_join ( ThreadId tid, ThreadId jee, void** thread_return ) *thread_return = vg_threads[jee].retval; vg_threads[tid].status = VgTs_Runnable; vg_threads[jee].status = VgTs_Empty; /* bye! */ + if (VG_(clo_instrument) && jee != 0) + VGM_(make_noaccess)( vg_threads[jee].stack_base, + vg_threads[jee].stack_size ); if (VG_(clo_trace_sched)) { VG_(sprintf)(msg_buf, "someone called pthread_join() on me; bye!"); diff --git a/vg_scheduler.c b/vg_scheduler.c index cb7d5a943c..695f086eff 100644 --- a/vg_scheduler.c +++ b/vg_scheduler.c @@ -54,7 +54,8 @@ suitable for use by anyone at all! specified and they are interrupted by a signal. nanosleep just pretends signals don't exist -- should be fixed. -- when a thread is done mark its stack as noaccess +- Read/write syscall starts: don't crap out when the initial + nonblocking read/write returns an error. - 0xDEADBEEF syscall errors ... fix. @@ -140,6 +141,7 @@ void pp_sched_status ( void ) case VgTs_WaitJoiner: VG_(printf)("WaitJoiner(%d)\n", vg_threads[i].joiner); break; case VgTs_WaitJoinee: VG_(printf)("WaitJoinee\n"); break; + case VgTs_Sleeping: VG_(printf)("Sleeping\n"); break; default: VG_(printf)("???"); break; } } @@ -1260,6 +1262,9 @@ void handle_pthread_return ( ThreadId tid, void* retval ) vg_threads[jnr].m_edx = 0; /* success */ vg_threads[jnr].status = VgTs_Runnable; vg_threads[tid].status = VgTs_Empty; /* bye! */ + if (VG_(clo_instrument) && tid != 0) + VGM_(make_noaccess)( vg_threads[tid].stack_base, + vg_threads[tid].stack_size ); if (VG_(clo_trace_sched)) { VG_(sprintf)(msg_buf, "root fn returns, to find a waiting pthread_join(%d)", tid); @@ -1319,6 +1324,9 @@ void do_pthread_join ( ThreadId tid, ThreadId jee, void** thread_return ) *thread_return = vg_threads[jee].retval; vg_threads[tid].status = VgTs_Runnable; vg_threads[jee].status = VgTs_Empty; /* bye! */ + if (VG_(clo_instrument) && jee != 0) + VGM_(make_noaccess)( vg_threads[jee].stack_base, + vg_threads[jee].stack_size ); if (VG_(clo_trace_sched)) { VG_(sprintf)(msg_buf, "someone called pthread_join() on me; bye!"); -- 2.47.2