|
From: <sv...@va...> - 2009-05-01 08:09:17
|
Author: njn
Date: 2009-05-01 09:08:54 +0100 (Fri, 01 May 2009)
New Revision: 9709
Log:
- Reenable async-sigs. It still doesn't pass.
- Rename some things in m_signals.c.
- Update and comment is_signal_from_kernel. Unfortunately it's broken on
Darwin because si_code is totally unreliable.
Modified:
branches/DARWIN/coregrind/m_signals.c
branches/DARWIN/none/tests/Makefile.am
Modified: branches/DARWIN/coregrind/m_signals.c
===================================================================
--- branches/DARWIN/coregrind/m_signals.c 2009-05-01 06:54:43 UTC (rev 9708)
+++ branches/DARWIN/coregrind/m_signals.c 2009-05-01 08:08:54 UTC (rev 9709)
@@ -1255,8 +1255,18 @@
// them.
return ( si_code > VKI_SI_USER ? True : False );
#elif defined(VGO_darwin)
- // On Darwin, SI_USER is 0x10001, values greater than that are from the
- // user, small positive integers are from the kernel.
+ // On Darwin 9.6.0, the si_code is completely unreliable. It should be the
+ // case that 0 means "user", and >0 means "kernel". But:
+ // - For SIGSEGV, it seems quite reliable.
+ // - For SIGBUS, it's always 2.
+ // - For SIGFPE, it's often 0, even for kernel ones (eg.
+ // div-by-integer-zero always gives zero).
+ // - For SIGILL, it's unclear.
+ // - For SIGTRAP, it's always 1.
+ // You can see the "NOTIMP" (not implemented) status of a number of the
+ // sub-cases in sys/signal.h. Since it's fairly hopeless, we just pretend
+ // like the problems don't exist. Hopefully future versions of Darwin will
+ // get closer to this ideal...
return ( si_code < VKI_SI_USER ? True : False );
#else
# error Unknown OS
@@ -1925,12 +1935,12 @@
}
static
-void sync_signalhandler_from_outside ( ThreadId tid,
+void sync_signalhandler_from_user ( ThreadId tid,
Int sigNo, vki_siginfo_t *info, struct vki_ucontext *uc )
{
ThreadId qtid;
- /* If some user-process sent us a sync signal (ie, they're not the result
+ /* If some user-process sent us a sync signal (ie. it's not the result
of a faulting instruction), then how we treat it depends on when it
arrives... */
@@ -2058,7 +2068,7 @@
}
static
-void sync_signalhandler_from_inside ( ThreadId tid,
+void sync_signalhandler_from_kernel ( ThreadId tid,
Int sigNo, vki_siginfo_t *info, struct vki_ucontext *uc )
{
/* Check to see if some part of Valgrind itself is interested in faults.
@@ -2150,7 +2160,7 @@
vki_siginfo_t *info, struct vki_ucontext *uc )
{
ThreadId tid = VG_(lwpid_to_vgtid)(VG_(gettid)());
- Bool from_outside;
+ Bool from_user;
if (0)
VG_(printf)("sync_sighandler(%d, %p, %p)\n", sigNo, info, uc);
@@ -2165,14 +2175,14 @@
info->si_code = sanitize_si_code(info->si_code);
- from_outside = !is_signal_from_kernel(info->si_code);
+ from_user = !is_signal_from_kernel(info->si_code);
if (VG_(clo_trace_signals)) {
VG_DMSG("sync signal handler: "
"signal=%d, si_code=%d, EIP=%#lx, eip=%#lx, from %s",
sigNo, info->si_code, VG_(get_IP)(tid),
VG_UCONTEXT_INSTR_PTR(uc),
- ( from_outside ? "outside" : "inside" ));
+ ( from_user ? "user" : "kernel" ));
}
vg_assert(sigNo >= 1 && sigNo <= VG_(max_signal));
@@ -2192,10 +2202,10 @@
(Why do we care?) If the signal is from the user rather than the
kernel, then treat it more like an async signal than a sync signal --
that is, merely queue it for later delivery. */
- if (from_outside) {
- sync_signalhandler_from_outside(tid, sigNo, info, uc);
+ if (from_user) {
+ sync_signalhandler_from_user(tid, sigNo, info, uc);
} else {
- sync_signalhandler_from_inside( tid, sigNo, info, uc);
+ sync_signalhandler_from_kernel( tid, sigNo, info, uc);
}
}
Modified: branches/DARWIN/none/tests/Makefile.am
===================================================================
--- branches/DARWIN/none/tests/Makefile.am 2009-05-01 06:54:43 UTC (rev 9708)
+++ branches/DARWIN/none/tests/Makefile.am 2009-05-01 08:08:54 UTC (rev 9709)
@@ -130,6 +130,7 @@
check_PROGRAMS = \
ansi args \
+ async-sigs \
bitfield1 \
bug129866 \
closeall coolo_strlen \
@@ -152,12 +153,6 @@
tls tls.so tls2.so vgprintf \
coolo_sigaction gxx304
-# DDD: async-sigs builds and runs under Valgrind, although it fails I think
-# it is disabled because it currently screw up other tests.
-if ! VGCONF_OS_IS_DARWIN
- check_PROGRAMS += \
- async-sigs
-endif
# DDD:
# - manythreads and thread-exits have lots of this:
# --61831:0:aspacem sync_check_mapping_callback: segment mismatch:
|