* Linux child process does not core dump
[not found] <1311857035.41442.YahooMailNeo@web137319.mail.in.yahoo.com>
@ 2011-07-28 12:46 ` Srinivas Nayak
2011-07-28 13:44 ` Maxin B John
2011-07-28 18:39 ` Jesper Juhl
0 siblings, 2 replies; 3+ messages in thread
From: Srinivas Nayak @ 2011-07-28 12:46 UTC (permalink / raw)
To: linux-kernel
Hi,
In my program, I fork() to get a child process.
Because of some problem, child process terminates by a segmentation fault.
Parent process is still running.
I have compiled my code with -g option.
I have done: ulimit -c unlimited.
I am not getting core dump of the child process.
How can I get the core dump of child process?
Sincerely,
Srinivas Nayak
________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Linux child process does not core dump
2011-07-28 12:46 ` Linux child process does not core dump Srinivas Nayak
@ 2011-07-28 13:44 ` Maxin B John
2011-07-28 18:39 ` Jesper Juhl
1 sibling, 0 replies; 3+ messages in thread
From: Maxin B John @ 2011-07-28 13:44 UTC (permalink / raw)
To: Srinivas Nayak; +Cc: linux-kernel
Hi Srinivas,
On Thu, Jul 28, 2011 at 3:46 PM, Srinivas Nayak
<sinu_nayak2001@yahoo.co.in> wrote:
>
> In my program, I fork() to get a child process.
> Because of some problem, child process terminates by a segmentation fault.
> Parent process is still running.
>
> I have compiled my code with -g option.
> I have done: ulimit -c unlimited.
>
> I am not getting core dump of the child process.
>
> How can I get the core dump of child process?
You can call setrlimit(2) from the child process to get core dump.
Best Regard,
Maxin B. John
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Linux child process does not core dump
2011-07-28 12:46 ` Linux child process does not core dump Srinivas Nayak
2011-07-28 13:44 ` Maxin B John
@ 2011-07-28 18:39 ` Jesper Juhl
1 sibling, 0 replies; 3+ messages in thread
From: Jesper Juhl @ 2011-07-28 18:39 UTC (permalink / raw)
To: Srinivas Nayak; +Cc: linux-kernel
On Thu, 28 Jul 2011, Srinivas Nayak wrote:
> Hi,
>
> In my program, I fork() to get a child process.
> Because of some problem, child process terminates by a segmentation fault.
> Parent process is still running.
>
> I have compiled my code with -g option.
> I have done: ulimit -c unlimited.
>
> I am not getting core dump of the child process.
>
> How can I get the core dump of child process?
>
As you've noticed, by default core dumps are usually supressed (ulimit -c
is 0 (zero)). As you mention yourself, you can change this with "ulimit -c
unlimited" (or a specific size rather than "unlimited". But there are
still a few things you need to be aware of:
1. The ulimit setting you just made only takes effect for the shell that
you run it in. So if, for example, you are running "ulimit -c unlimited"
in one xterm and then launch your app from a different xterm, then that
second xterm will still have "ulimit -c 0" and you won't get your dump. So
start the app from the same shell that you used to execute "ulimit -c
unlimited".
2. If your application changes its working directory before crashing, then
the core dump will be in the directory it changed to, not in the directory
you launched it from. Be sure you are looking for the "core" file in the
right location.
3. If the current working directory of the application is mounted
read-only or doesn't have sufficient space to write your core dump, then
you won't get any. Make sure the app's current working directory is
writable and has sufficient space available.
Try this for a test:
$ cat crash.c
#include <stdlib.h>
int main()
{
abort();
}
$ gcc crash.c
$ ./a.out
Aborted (core dumped)
$ ls -l core
-rw------- 1 jj users 221184 Jul 28 20:34 core
$ file core
core: ELF 64-bit LSB core file x86-64, version 1 (SYSV), SVR4-style, from './a.out'
$
--
Jesper Juhl <jj@chaosbits.net> http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-07-28 18:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <1311857035.41442.YahooMailNeo@web137319.mail.in.yahoo.com>
2011-07-28 12:46 ` Linux child process does not core dump Srinivas Nayak
2011-07-28 13:44 ` Maxin B John
2011-07-28 18:39 ` Jesper Juhl
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.