Re: single stepping into signals handlers
Re: single stepping into signals handlers
- Subject: Re: single stepping into signals handlers
- From: Tristan Gingold <email@hidden>
- Date: Fri, 16 Oct 2009 10:42:50 +0200
On Oct 15, 2009, at 11:34 PM, Terry Lambert wrote:
On Oct 15, 2009, at 6:33 AM, Tristan Gingold wrote:
Hi,
(not sure that this is the best list, feel free to redirect)
currently Darwin clears RFLAGS.TF when a signal is delivered. As a
consequence it is not possible to
signal step through a signal handler.
Is there a way to do this ? If not, could this behaviour be
changed ?
Signals are delivered by saving the old thread state structure,
consing up a new one with the %eip/%rip pointing at the signal
trampoline in user space, setting the actual saved thread state for
user space in the thread state structure, and then resuming as if
coming back from a trap handler. The only thing it has in common
with the original thread is that it's temporarily borrowing its
existance instead of cons'ing up a new thread.
If you want to single step into a signal handler, place a breakpoint
at the trampoline entry address, or if it's enough for you, at the
handler addres, and single step from there.
Good idea.
I assume from your email address that you're actually interested in
this because you want to deal with exception unwinding in ADA.
Treating signals as if they were the same things as exceptions is
not likel to be a very fruitful exercise for you. If I'm mistaken,
then perhaps you'd explain a little bit about what you're trying to
do?
Not related. I was trying to write a tool that stop a thread when it
modifies a large variable.
Anyway, I also have a question about exception unwinding and signal
handlers.
Our Ada compiler is able to detect stack overflow and to generate an
exception in such case. This is in fact
required by the Ada language and we do that on all our platforms.
The good news with darwin is that the signal trampoline has unwind
table for the trampolines. So we don't
have to handle this particular case contrary to most others OSes.
However for the stack checking feature, we use the alternate stack to
handle SIGSEGV/SIGBUS. So far so good,
but when the handler throw the exception, it doesn't reset the
SS_ONSTACK flag.
The only way to make this possible is to use the undocumented
sigreturn API. Do you have any advices ?
Thanks,
Tristan.
_______________________________________________
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