[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: Newbie question



kamesh jayachandran forced the electrons to say:
> I am new to linux .I want to know what is the purpose of core file that is 
> created in the home directory.

Well, the core file is not created in the home directory always, it is
created in the current working directory of the process that dumped core.

When a process tries to do something that the computer is not capable
of (like dividing by 0), or when it tries to do something it is not
allowed to do (like accessing memory beyond what it was allocated),
or even at times when the programmer/user explicitly asks it to do so,
the process dumps core. The core file is a memory image of the process
that dumped it, and contains information about the state of the program
at that time, the order and arguments with which functions were called
(called the stack trace), the environment, and various other details
that can be valuable to the programmer/debugger.

The following situations can generate core dumps:
1. Signals - SIGFPE, SIGSEGV, SIGTRAP, SIGIOT, SIGABRT, SIGQUIT
2. Explicit call to function abort() or raise() or kill().
3. Keyboard interrupt via control-\ (depending on your keymap)

The first two of the above list of signals correspond to the
two situations mentioned above (divide by 0 and accessing invalid
memory). Note that all cases finally are equivalent to signals - calls
to abort() raises the SIGABRT signal, and control-\ raises the SIGQUIT
signal. raise() and kill() can raise any signal, but only the ones in
(1) generate core files.

The programmer can avoid core dumps by handling these signals, and
letting the program die gracefully. The user if he is not interested in
core dump files, should put the command

ulimit -c 0

in his .bash_profile (this is for bash).

Binand
---
Send e-mail to 'ilugc-request@xxxxxxxxxxxxxxxxxx' with 'unsubscribe' 
in either the subject or the body to unsubscribe from this list.