[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Where's my core file ?



Have this really wierd problem with core dumps - we have several computers
running linux that we use for debugging, with various configurations. on
most of them (that is all but one)  when an application crashes it does not
always produce a core dump (most times it doesn't) and no - I haven't forgot
about ulimit. ulimit -c is always set for unlimited.
Consider, please, the following piece of core :

<testcore.c>
#include <stdio.h>
#include <unistd.h>
#include <pthread.h>

int threadSleep = 5;

void* func(void* x)
{
 int* y = NULL;
 printf("I'm a %s !\n","thread");
 sleep(threadSleep);
 (*y)=0;
 return NULL;
}

int main(int argc, char* argv[])
{
 int t;
 int i = 1;
 int* y = NULL;
 if (argc > 1) {
    i = atoi(argv[1]);
 }
 if (argc > 2) {
    threadSleep = atoi(argv[2]);
 }
 for (t = 0; t < i ; ++t) {
    pthread_t t;
    pthread_create(&t,NULL,func,NULL);
    pthread_detach(t);
 }
 sleep(10);
 return (*y);
 return 0;
}
</testcore.c>
and the following compile command
$ gcc -lpthread -o testcore testcore.c

now I can create several threads that will crash :-)

candidate number 1 : Mandrake 7.2 , updated to KDE 2.1, kernel
2.2.17-21mdksecure :
no core dumps whatsoever, no matter what I try.

candidate number 2 : Redhat 7.1 , updated to KDE 2.2 and kernel
2.4.3-12enterprise :
can get a core dump only when one thread is running :
$ testcore 1 5
but not when multiple threads are running
$ testcore 2 5
or when the main program would die before the threads
$ testcore 1 20
even then - I get only one core file which isn't numbered (when a multi
threaded application dies I need to get several core files where each is
appended the pid of the thread that dies)

candidate number 3 : Mandrake 8.0, updated to kernel 2.4.3-20 :
always get a core dump, only of the thread that seg faulted, the core file
is numbered.

I searched Google, looked in newsgroups, read mans and howtos, and has no
clue why on some machines I get the core and on some I dont.. please help ?

Oded

--
White dwarf seeks red giant for binary relationship.



=================================================================
To unsubscribe, send mail to linux-il-request@linux.org.il with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail linux-il-request@linux.org.il