Re: Signal callstack question

Jamie Lokier (lkd@tantalophile.demon.co.uk)
Wed, 1 Dec 1999 00:05:08 +0100


Jim Nance wrote:
> Hello All,
> I am writting a little profiling tool which uses a timer to signal my
> process, and then, in the signal handler it walks the call stack to see
> where it is. My problem is that if I have a call stack like this:
>
> main() -> f1() -> f2() -> f3()
>
> and I get a signal while I am in f3(), when I walk the call stack it looks
> like this:
>
> main() -> f1() -> f2() -> __restore -> signalHandler()
>
> Since this is a profiler, it would really be nice to know that I am in the
> f3() function, but I can not figure out how to get this information. I took
> a look at __restore and it is a little bit of code that calls the sigrestore()
> system call. I assume that sigrestore() cleans up and puts f3() back onto
> the call stack. Does anyone know how I can figure out the name of the
> function that was executing when I caught the signal? The best I can come
> up with is to go back to f2() and try to disassemble the function call
> instruction, but I dont really like that approach (particularly since I don't
> know intel assembly).
>
> Incidently, if a program longjmp()s out of a signal handler, and thus never
> calls sigrestore(), does this break anything (like queued signal delivery)?
>
> Thanks,
>
> Jim
>
> Please read the FAQ at http://www.tux.org/lkml/
>
> ------------------------------

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/