Re: INT3 not calling SIGTRAP handler?
Re: INT3 not calling SIGTRAP handler?
- Subject: Re: INT3 not calling SIGTRAP handler?
- From: Eric Albert <email@hidden>
- Date: Sun, 12 Mar 2006 23:43:20 -0800
On Mar 12, 2006, at 11:25 PM, Cyrus Harmon wrote:
This may sound a bit sketchy, as it only happens somewhat
sporadically, but when it happens, bad things happen. I'm working on
an x86 port of a compiler that makes heavy use of trapping in it's
runtime environment and things basically seem to work pretty well at
this point. My problem is that every now and then, I try to trap with
an x86 INT3 (opcode CC) and our SIGTRAP handler takes a look at the
byte following the CC, gets the appropriate "arguments" by looking at
the instruction data just after the EIP, fixes up the EIP to skip over
these arguments and goes on its merry way. This all works well enough,
except when it doesn't, which is to say that occasionally it seems
that I just walk across the INT3 without the SIGTRAP handler being
called, and get a SEGV when the CPU tries to execute the instruction
immediately following the INT3, which was supposed to be skipped over
by the code that fixes up the EIP in the signal handler.
Yes, this is all a bit messy, but the frustrating part is that most of
the time this works. Is anyone else seeing instances where INT3 traps
aren't being called?
I don't think we have any bug reports on this. It'd be great to have
one with a reproducible test case, even if it's along the lines of
"this shows up about 10% of the time with this test".
Any suggestions on where to look in the Darwin sources to see if
there's anything amiss? This works fine on Darwin/ppc and, FWIW,
{freebsd,linux}/x86 and mostly works on Darwin/x86, but this one thing
is causing some rather major problems. Any suggestions or advice on
dealing with this would be greatly appreciated.
You'd need the kernel source, which I'm afraid isn't available yet for
the Intel releases of Mac OS X. You could look at the older Darwin/x86
kernel sources, but enough has changed since then that it wouldn't be
helpful.
-Eric
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden