[comp.unix.programmer] finding address that caused SEGV

jack@dali.gatech.edu (12/07/90)

	Hi.  I'm writing a program that uses dynamically loaded
code.  One of the things i want it to do is be able to recover
from errors caused by the loaded code.  I have a simple routine that
that uses setjmp/longjmp to recover when a SEGV occurs.  What i'm
looking for is code that will allow me to determine what routine
caused the SEGV or other error signal, so that the error can be
logged and the code unloaded.  Preferably a canned routine that
understands signal handlers.  If anyone has a routine that returns
the values of the registers in a array, that might do instead.  I'm
using a SparcStation running sunOS 4.0.3.  The dynamic loader code
is dld by Wilson Ho (i think) available from GNU.

	I've looked at the kvm calls for reading the process space
and the call kvm_getu returns, among other things, the register values.
However, i haven't been able to get them working.  I'm not sure i'm
calling them right.  Anyway, if anyone knows of code that would allow
me to do this, i would greatly appreciate pointer to it.  Reply by
mail, preferably.  I'll summarize if there is interest.  Thanks.

	tom