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


 
Thread Tools Search this Thread
Operating Systems AIX How to create core through program at the time of crash by handling signals?
Prev   Next
# 1  
Old 12-05-2012
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
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Handling Signals in System Calls

What will happen if signal comes while a system call is being executed? How it will be handled? (1 Reply)
Discussion started by: rupeshkp728
1 Replies

2. Solaris

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... (5 Replies)
Discussion started by: rajeev_ks
5 Replies

3. UNIX for Dummies Questions & Answers

handling signals without race conditions

Greetings, I am writing a small program in C on UNIX, in which I am using (POSIX reliable) signals. 1. Suppose I have a signal : SIGX, and the corresponding signal handler : sigx_handler. It is possible to receive SIGX in my process, and, while executing sigx_handler, to receive again... (0 Replies)
Discussion started by: aigoia
0 Replies

4. Programming

Please help:program hang stuck there signal handling on POSIX Message Queue UNIX C programming

in a single main() function,so need signal handling. Use Posix Message Queue IPC mechanism , can ignore the priority and other linked list message,to implement the scenario: client:Knock Knock server:who's there client: Eric Server:Eric,Welcome. client:exit all process terminated ... (1 Reply)
Discussion started by: ouou
1 Replies

5. Programming

Memory Fault (core dumped) in ttpy program

I´m writing this program in QNX , I`m kinda new to UNIX and programing in general, and when I try to run it it gives me the Memory Fault error. Can anyone help? #include <stdio.h> #include <fcntl.h> void main(void) {int a,ter; char buf; printf("a="); scanf("%d",a); ter=open... (6 Replies)
Discussion started by: GiganteAsesino
6 Replies

6. Programming

detached thread is causing program crash

Hi All, I have scenario where my callback function data_update() can be called anytime. I have written the function data_update() such that it will create detached thread for processing the data sent to this function. data_update() { pthread_attr_t attr_thread; ... (1 Reply)
Discussion started by: wonderman
1 Replies

7. Filesystems, Disks and Memory

/dev/core "link to program crash data"

Hi there, I found a link to a file /dev/core of 17 GB Is it ok??? I couldn't find many information about it. Any suggestion would be appreciated!!! Thanks in advance, Giordano Bruno PS: I'm working with FEDORA 6 (2 Replies)
Discussion started by: Giordano Bruno
2 Replies

8. Shell Programming and Scripting

Shel program file handling

Hi, Iam having the file as follows: QWASEDRF1234567890098765 abc@quebex.com 000000000-932333 678394-56=3 9033894 QWASEDRF1234567890098765 abc@quebex.com 000000000-932333 678394-56=3 9033894 OPIUYTREE0986666544443322 dcsx@olivaa.net ... (14 Replies)
Discussion started by: nivas
14 Replies

9. UNIX for Dummies Questions & Answers

Smart Crash Handling

Hi, Is there anything you can do to a *nix (SuSE Linux actually) which allows it to *try* to do a reboot if something crashes the system? I know they have something at work (but I don't work with the servers myself) which makes the server reboot if it crashes/locks (works about 80% of the... (0 Replies)
Discussion started by: d11wtq
0 Replies

10. Programming

handling-create new SIGNALS

Hi, i cannot find in which file and function the signals are handled by default.Can anyone help me? How can i create a 33th signal? Thanks (3 Replies)
Discussion started by: Panos
3 Replies
Login or Register to Ask a Question
savecore(8)						      System Manager's Manual						       savecore(8)

Name
       savecore - save a core dump of the operating system

Syntax
       /etc/savecore [ options ] dirname [ system ] [ corename ]

Description
       The  command  is  meant	to  be called near the end of the file.  The command saves the core dump of the system (assuming one was made) and
       writes a reboot message in the shutdown log.

       The command checks the core dump to be certain it corresponds with the current running ULTRIX.  If it does, it saves the core image in  the
       file  dirname/vmcore.n and saves the namelist in the file dirname/vmunix.n.  The trailing .n in the pathnames is replaced by a number which
       increments each time is run in that directory.

       After saving the core and namelist images, will save the error logger buffer into a predetermined file.	The error logger  buffer  contains
       information about why the crash occurred.  After completes, the daemon will extract the error logger file and translate its contents into a
       form familiar to the program.

       Before writes out a core image, it reads a number from the file dirname/minfree.  If there are fewer free blocks  on  the  filesystem  that
       contains  dirname  than the number obtained from the file, a core dump is not done.  If the file does not exist, savecore always writes out
       the core file (assuming that a core dump was taken).

       The command also writes a reboot message in the shut down log.  If the system crashed as a result of a panic, also records the panic string
       in the shut down log.

       For  partial  crash  dumps,  creates  a	sparse	core image file in dirname/vmcore.n.  If this sparse core image file is copied or moved to
       another location, the file expands to its true size which can take too much file system space.  Hence, to copy or move  sparse  core  image
       files, you must use the command. The command has a conversion option to create sparse output files.

Options
       -c   Clears  the core dump.  This option is useful when the core dump is corrupted in a way that will not allow to save it safely.  Use the
	    option with caution, because once it clears the core dump, the core dump cannot be retrieved.

       -d dumpdev dumplo
	    Specifies the dump device and the dump offset when running on a system image other than the currently running system image.  The  pro-
	    gram  assumes  that  the running system image is and it reads the dump device and dump device offset are different in the system image
	    that crashed, the option provides the correct dump device and dump device offset.

       -e   Saves only the error logger buffer into a file.  If used, core or namelist images are not saved.

       -f corename
	    Takes the i corefile name as the file from which to extract the the crash dump data instead of the default dump device.   This  option
	    is used only for diskless workstations.

       If  the	core  dump was from a system other than /vmunix, the name of that system must be supplied as system.  The program assumes that the
       running image is

       After successful completion, the core dump is cleared.  Also, a message is written in the file which tells whether the  dump  succeeded	or
       failed.

Files
       Shut down log

       Current running ULTRIX system

See Also
       dd(1), uerf(8)

																       savecore(8)