Re: Signals (SIGVTALARM) and the current function...

From: George (greerga@CIRCLEMUD.ORG)
Date: 05/29/98


On Fri, 29 May 1998, Chris Jacobson wrote:

>Is there a way to find out what function the program was in when a signal
>is trapped, and then log the name (using Linux) ?  I want to find out
>what function was being executed when checkpointing() kills the program.
>(fortunately I don't think I have any infinite loops, but I want it to
>have the necessary info, JIC.)

If you have glibc 2 (libc5 doesn't seem to have it), there is a structure
called 'sigcontext' that will save the 'eip' that the program was currently
at. Then in gdb, to see the code at that address:

list *0x[address]

I don't know of a way to automate that, and actually, don't see any
functions in the header to actually use sigcontext. But it's there.  If you
find out more, let me know.

--
George Greer, greerga@circlemud.org | Genius may have its limitations, but
http://patches.van.ml.org/          | stupidity is not thus handicapped.
http://www.van.ml.org/CircleMUD/    |                  -- Elbert Hubbard


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST