How to create core through program at the time of crash by handling signals?

I am in process of writing a library which can make any application of my product capable of creating core in the application's log folder with a product friendly core file name programatically. In my library I am registering for certain signals e.g. SIGILL, SIGFPE, SIGBUS, SIGSEGV, SIGSYS, SIGABRT and in the handler routine of my signal I am forking gcore to create dump of the current process.

I am able to successfully create the core in this manner if any application which uses my library runs a faulty code e.g. Illegal Memory Access (Segmentation Violation) etc. However the core created in this manner does not take me to the faulty code location and displays the Signal Handler routine stack.

On windows this can be done through registering handler by calling SetUnhandledExceptionFilter. When OS calls the handler in case of any unhandled exception it also passes _EXCEPTION_POINTERS which is used for dump creation. The dump created in this manner contains the correct information of faulty code.

Through AIX signal handling I am only getting signal number in the handler routine. How can create correct core in the given situation on AIX programatically. Forking gcore is not working here as correct core is not getting generated. If any sample program is available then that would be great.

I am using AIX 6.1

Bumping up posts or double posting is not permitted in these forums.

Please read the rules, which you agreed to when you registered, if you have not already done so.

You may receive an infraction for this. If so, don't worry, just try to follow the rules more carefully. The infraction will expire in the near future

Thank You.

The UNIX and Linux Forums.