This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: call a function even a program terminate abnormally


Hi Yubin,

> I am wondering whether it is possible to invoke a function when a program
> terminate abnormally (e.g., segfault).

you could install a signal handler for SIGSEGV using signal() (2),
but please be aware of all the pitfalls.

When your process receives SIGSEGV, you probably have some
memory corruption ongoing and you don't know if the data structure
holding your lock is still valid.

Best Regards,

Patrick




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]