|
From: <sv...@va...> - 2005-06-12 17:26:32
|
Author: njn
Date: 2005-06-12 18:26:29 +0100 (Sun, 12 Jun 2005)
New Revision: 3900
Log:
Moved the last two functions out of linux/core_os.c, and removed it.
Removed:
trunk/coregrind/linux/
Modified:
trunk/configure.in
trunk/coregrind/Makefile.am
trunk/coregrind/core.h
trunk/coregrind/m_main.c
trunk/coregrind/m_scheduler/priv_sema.h
trunk/coregrind/m_syscalls/priv_syscalls-linux.h
trunk/coregrind/m_syscalls/syscalls-amd64-linux.c
trunk/coregrind/m_syscalls/syscalls-generic.c
trunk/coregrind/m_syscalls/syscalls-linux.c
trunk/coregrind/m_syscalls/syscalls-x86-linux.c
trunk/coregrind/pub_core_syscalls.h
Modified: trunk/configure.in
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/configure.in 2005-06-12 16:43:33 UTC (rev 3899)
+++ trunk/configure.in 2005-06-12 17:26:29 UTC (rev 3900)
@@ -433,7 +433,6 @@
coregrind/amd64/Makefile
coregrind/arm/Makefile
coregrind/x86/Makefile
- coregrind/linux/Makefile
addrcheck/Makefile
addrcheck/tests/Makefile
addrcheck/docs/Makefile
Modified: trunk/coregrind/Makefile.am
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/Makefile.am 2005-06-12 16:43:33 UTC (rev 3899)
+++ trunk/coregrind/Makefile.am 2005-06-12 17:26:29 UTC (rev 3900)
@@ -15,11 +15,11 @@
## But when doing 'make dist', we are interested in every arch/OS/platfo=
rm.
## That's what DIST_SUBDIRS specifies.
SUBDIRS =3D \
- $(VG_ARCH) $(VG_OS) \
+ $(VG_ARCH) \
$(MODULES) .
=20
DIST_SUBDIRS =3D \
- $(VG_ARCH_ALL) $(VG_OS_ALL) \
+ $(VG_ARCH_ALL) \
$(MODULES) .
=20
AM_CPPFLAGS +=3D -DVG_LIBDIR=3D"\"$(valdir)"\" \
@@ -129,7 +129,6 @@
m_sigframe/libsigframe.a \
m_syscalls/libsyscalls.a \
${VG_ARCH}/libarch.a \
- ${VG_OS}/libos.a \
@VEX_DIR@/libvex.a
=20
## These ones must be linked in with the --whole-archive flag, because t=
hey
Modified: trunk/coregrind/core.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/core.h 2005-06-12 16:43:33 UTC (rev 3899)
+++ trunk/coregrind/core.h 2005-06-12 17:26:29 UTC (rev 3900)
@@ -157,12 +157,6 @@
Addr esp_at_startup,
/*MOD*/ ThreadArchState* arch );
=20
-// Run a thread from beginning to end.=20
-extern VgSchedReturnCode VGO_(thread_wrapper)(Word /*ThreadId*/ tid);
-
-// wait until all other threads are dead
-extern void VGA_(reap_threads)(ThreadId self);
-
// For attaching the debugger
extern Int VGA_(ptrace_setregs_from_tst) ( Int pid, ThreadArchState* ar=
ch );
=20
Modified: trunk/coregrind/m_main.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_main.c 2005-06-12 16:43:33 UTC (rev 3899)
+++ trunk/coregrind/m_main.c 2005-06-12 17:26:29 UTC (rev 3900)
@@ -2867,7 +2867,7 @@
vg_assert(VG_(is_running_thread)(tid));
=20
// Wait for all other threads to exit.
- VGA_(reap_threads)(tid);
+ VG_(reap_threads)(tid);
=20
VG_(clo_model_pthreads) =3D False;
=20
@@ -2931,7 +2931,7 @@
sys_exit, do likewise; if the (last) thread stopped due to a fatal
signal, terminate the entire system with that same fatal signal. *=
/
VG_(debugLog)(1, "core_os",=20
- "VGO_(terminate_NORETURN)(tid=3D%lld)\n", (ULong)tid=
);
+ "VG_(terminate_NORETURN)(tid=3D%lld)\n", (ULong)tid)=
;
=20
vg_assert(VG_(count_living_threads)() =3D=3D 0);
=20
Modified: trunk/coregrind/m_scheduler/priv_sema.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_scheduler/priv_sema.h 2005-06-12 16:43:33 UTC (rev =
3899)
+++ trunk/coregrind/m_scheduler/priv_sema.h 2005-06-12 17:26:29 UTC (rev =
3900)
@@ -39,8 +39,7 @@
} vg_sema_t;
=20
// Nb: this may be OS-specific, but let's not factor it out until we
-// implement an OS port for which this isn't ok. Then we can rename the=
m
-// VGO_(sema_init)(), etc.
+// implement an OS port for which this isn't ok.
void VG_(sema_init) ( vg_sema_t *sema );
void VG_(sema_deinit) ( vg_sema_t *sema );
void VG_(sema_down) ( vg_sema_t *sema );
Modified: trunk/coregrind/m_syscalls/priv_syscalls-linux.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_syscalls/priv_syscalls-linux.h 2005-06-12 16:43:33 =
UTC (rev 3899)
+++ trunk/coregrind/m_syscalls/priv_syscalls-linux.h 2005-06-12 17:26:29 =
UTC (rev 3900)
@@ -33,6 +33,9 @@
=20
/* requires #include "priv_types_n_macros.h" */
=20
+// Run a thread from beginning to end.=20
+extern VgSchedReturnCode VG_(thread_wrapper)(Word /*ThreadId*/ tid);
+
DECL_TEMPLATE(linux, sys_exit_group);
=20
DECL_TEMPLATE(linux, sys_mount);
Modified: trunk/coregrind/m_syscalls/syscalls-amd64-linux.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_syscalls/syscalls-amd64-linux.c 2005-06-12 16:43:33=
UTC (rev 3899)
+++ trunk/coregrind/m_syscalls/syscalls-amd64-linux.c 2005-06-12 17:26:29=
UTC (rev 3900)
@@ -133,15 +133,15 @@
=20
VG_(debugLog)(1, "syscalls-amd64-linux",=20
"run_a_thread_NORETURN(tid=3D%lld): "
- "VGO_(thread_wrapper) called\n",
+ "VG_(thread_wrapper) called\n",
(ULong)tidW);
=20
/* Run the thread all the way through. */
- VgSchedReturnCode src =3D VGO_(thread_wrapper)(tid); =20
+ VgSchedReturnCode src =3D VG_(thread_wrapper)(tid); =20
=20
VG_(debugLog)(1, "syscalls-amd64-linux",=20
"run_a_thread_NORETURN(tid=3D%lld): "
- "VGO_(thread_wrapper) done\n",
+ "VG_(thread_wrapper) done\n",
(ULong)tidW);
=20
Int c =3D VG_(count_living_threads)();
Modified: trunk/coregrind/m_syscalls/syscalls-generic.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_syscalls/syscalls-generic.c 2005-06-12 16:43:33 UTC=
(rev 3899)
+++ trunk/coregrind/m_syscalls/syscalls-generic.c 2005-06-12 17:26:29 UTC=
(rev 3900)
@@ -2250,6 +2250,24 @@
}
}
=20
+static Bool i_am_the_only_thread ( void )
+{
+ Int c =3D VG_(count_living_threads)();
+ vg_assert(c >=3D 1); /* stay sane */
+ return c =3D=3D 1;
+}
+
+/* Wait until all other threads disappear. */
+void VG_(reap_threads)(ThreadId self)
+{
+ while (!i_am_the_only_thread()) {
+ /* Let other thread(s) run */
+ VG_(vg_yield)();
+ VG_(poll_signals)(self);
+ }
+ vg_assert(i_am_the_only_thread());
+}
+
// XXX: prototype here seemingly doesn't match the prototype for i386-li=
nux,
// but it seems to work nonetheless...
PRE(sys_execve)
@@ -2299,7 +2317,7 @@
this. (Really, nuke them all, since the new process will make
its own new thread.) */
VG_(nuke_all_threads_except)( tid, VgSrc_ExitSyscall );
- VGA_(reap_threads)(tid);
+ VG_(reap_threads)(tid);
=20
{ // Remove the valgrind-specific stuff from the environment so the
// child doesn't get vg_inject.so, vgpreload.so, etc. This is
Modified: trunk/coregrind/m_syscalls/syscalls-linux.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_syscalls/syscalls-linux.c 2005-06-12 16:43:33 UTC (=
rev 3899)
+++ trunk/coregrind/m_syscalls/syscalls-linux.c 2005-06-12 17:26:29 UTC (=
rev 3900)
@@ -30,10 +30,12 @@
=20
#include "core.h"
#include "pub_core_aspacemgr.h"
+#include "pub_core_debuglog.h"
#include "pub_core_libcbase.h"
#include "pub_core_libcassert.h"
#include "pub_core_libcfile.h"
#include "pub_core_libcprint.h"
+#include "pub_core_libcproc.h"
#include "pub_core_mallocfree.h"
#include "pub_core_tooliface.h"
#include "pub_core_options.h"
@@ -43,6 +45,51 @@
#include "priv_syscalls-generic.h"
#include "priv_syscalls-linux.h"
=20
+// Run a thread from beginning to end and return the thread's
+// scheduler-return-code.
+VgSchedReturnCode VG_(thread_wrapper)(Word /*ThreadId*/ tidW)
+{
+ VG_(debugLog)(1, "core_os",=20
+ "VG_(thread_wrapper)(tid=3D%lld): entry\n",=20
+ (ULong)tidW);
+
+ VgSchedReturnCode ret;
+ ThreadId tid =3D (ThreadId)tidW;
+ ThreadState* tst =3D VG_(get_ThreadState)(tid);
+
+ vg_assert(tst->status =3D=3D VgTs_Init);
+
+ /* make sure we get the CPU lock before doing anything significant */
+ VG_(set_running)(tid);
+
+ if (0)
+ VG_(printf)("thread tid %d started: stack =3D %p\n",
+ tid, &tid);
+
+ VG_TRACK ( post_thread_create, tst->os_state.parent, tid );
+
+ tst->os_state.lwpid =3D VG_(gettid)();
+ tst->os_state.threadgroup =3D VG_(getpid)();
+
+ /* Thread created with all signals blocked; scheduler will set the
+ appropriate mask */
+
+ ret =3D VG_(scheduler)(tid);
+
+ vg_assert(VG_(is_exiting)(tid));
+ =20
+ vg_assert(tst->status =3D=3D VgTs_Runnable);
+ vg_assert(VG_(is_running_thread)(tid));
+
+ VG_(debugLog)(1, "core_os",=20
+ "VG_(thread_wrapper)(tid=3D%lld): done\n",=20
+ (ULong)tidW);
+
+ /* Return to caller, still holding the lock. */
+ return ret;
+}
+
+
/* ---------------------------------------------------------------------
PRE/POST wrappers for arch-generic, Linux-specific syscalls
------------------------------------------------------------------ */
Modified: trunk/coregrind/m_syscalls/syscalls-x86-linux.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_syscalls/syscalls-x86-linux.c 2005-06-12 16:43:33 U=
TC (rev 3899)
+++ trunk/coregrind/m_syscalls/syscalls-x86-linux.c 2005-06-12 17:26:29 U=
TC (rev 3900)
@@ -139,15 +139,15 @@
=20
VG_(debugLog)(1, "syscalls-x86-linux",=20
"run_a_thread_NORETURN(tid=3D%lld): "
- "VGO_(thread_wrapper) called\n",
+ "VG_(thread_wrapper) called\n",
(ULong)tidW);
=20
/* Run the thread all the way through. */
- VgSchedReturnCode src =3D VGO_(thread_wrapper)(tid); =20
+ VgSchedReturnCode src =3D VG_(thread_wrapper)(tid); =20
=20
VG_(debugLog)(1, "syscalls-x86-linux",=20
"run_a_thread_NORETURN(tid=3D%lld): "
- "VGO_(thread_wrapper) done\n",
+ "VG_(thread_wrapper) done\n",
(ULong)tidW);
=20
Int c =3D VG_(count_living_threads)();
Modified: trunk/coregrind/pub_core_syscalls.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/pub_core_syscalls.h 2005-06-12 16:43:33 UTC (rev 3899=
)
+++ trunk/coregrind/pub_core_syscalls.h 2005-06-12 17:26:29 UTC (rev 3900=
)
@@ -62,6 +62,9 @@
Bool restart
);
=20
+// Wait until all other threads are dead
+extern void VG_(reap_threads)(ThreadId self);
+
// Release resources held by this thread
extern void VGP_(cleanup_thread) ( ThreadArchState* );
=20
|