|
From: <sv...@va...> - 2006-10-11 16:06:02
|
Author: sewardj
Date: 2006-10-11 17:05:59 +0100 (Wed, 11 Oct 2006)
New Revision: 6202
Log:
If someone has registered a fault (signal) catcher, try it first,
before messing around with the faults-in-the-stack-segment logic.
This makes the leack checker work on AIX 5.2.
Modified:
branches/AIX5/coregrind/m_signals.c
Modified: branches/AIX5/coregrind/m_signals.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
--- branches/AIX5/coregrind/m_signals.c 2006-10-11 16:04:24 UTC (rev 6201=
)
+++ branches/AIX5/coregrind/m_signals.c 2006-10-11 16:05:59 UTC (rev 6202=
)
@@ -1627,9 +1627,9 @@
SizeT udelta;
=20
/* Find the next Segment above addr */
- NSegment const*const seg
+ NSegment const* seg
=3D VG_(am_find_nsegment)(addr);
- NSegment const*const seg_next=20
+ NSegment const* seg_next=20
=3D seg ? VG_(am_next_nsegment)( (NSegment*)seg, True/*fwds*/ )
: NULL;
=20
@@ -1668,10 +1668,12 @@
return True;
}
=20
-static void (*fault_catcher)(Int sig, Addr addr);
+static void (*fault_catcher)(Int sig, Addr addr) =3D NULL;
=20
void VG_(set_fault_catcher)(void (*catcher)(Int, Addr))
{
+ if (0)
+ VG_(debugLog)(0, "signals", "set fault catcher to %p\n", catcher);
vg_assert2(NULL =3D=3D catcher || NULL =3D=3D fault_catcher,
"Fault catcher is already registered");
=20
@@ -1785,15 +1787,28 @@
}
vg_assert(sigNo >=3D 1 && sigNo <=3D VG_(max_signal));
=20
+ /* Check to see if someone is interested in faults. The fault
+ catcher should never be set whilst we're in generated code, so
+ check for that. AFAIK the only use of the catcher right now is
+ memcheck's leak detector.
+ */
+ if (fault_catcher) {
+ vg_assert(VG_(in_generated_code) =3D=3D False);
+
+ (*fault_catcher)(sigNo, (Addr)info->VKI_SIGINFO_si_addr);
+ /* If the catcher returns, then it didn't handle the fault,
+ so carry on panicing. */
+ }
+
/* Special fault-handling case. We can now get signals which can
act upon and immediately restart the faulting instruction.
*/
if (info->si_signo =3D=3D VKI_SIGSEGV) {
Addr fault =3D (Addr)info->VKI_SIGINFO_si_addr;
Addr esp =3D VG_(get_SP)(tid);
- NSegment const*const seg
+ NSegment const* seg
=3D VG_(am_find_nsegment)(fault);
- NSegment const*const seg_next=20
+ NSegment const* seg_next=20
=3D seg ? VG_(am_next_nsegment)( (NSegment*)seg, True/*fwds*/ )
: NULL;
=20
@@ -1856,14 +1871,6 @@
resume_scheduler(tid);
}
=20
- /* Check to see if someone is interested in faults. */
- if (fault_catcher) {
- (*fault_catcher)(sigNo, (Addr)info->VKI_SIGINFO_si_addr);
-
- /* If the catcher returns, then it didn't handle the fault,
- so carry on panicing. */
- }
-
/* If resume_scheduler returns or its our fault, it means we
don't have longjmp set up, implying that we weren't running
client code, and therefore it was actually generated by
|