NetBSD-Users archive

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

gcc -pg is broken with threaded applications



This is 5.1_STABLE amd64. Any ideas why threaded application crash like
this?

atom$ cat tmp.c
#include <pthread.h>

void *run(void *arg)
{
        pthread_detach(pthread_self());
}

int main(void)
{
        int i;
        pthread_t tid;

        for (i = 0; i < 8; i++)
        {
                pthread_create(&tid, NULL, &run, NULL);
        }

        pthread_exit(NULL);
}

atom$ gcc -pg -g3 -O1 tmp.c -lpthread
/usr/lib/libc.so.12: warning: warning: this program uses xdr_domainname
(), which is deprecated and buggy. /usr/lib/libc.so.12: warning:
warning: this program uses xdr_mapname(), which is deprecated and
buggy. /usr/lib/libc.so.12: warning: warning: this program uses
xdr_peername(), which is deprecated and buggy. 

atom$ ./a.out
a.out: _lwp_ctl: [1]   Segmentation fault (core dumped) ./a.out 

atom$ gdb ./a.out ./a.out.core GNU gdb 6.5
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and
you are welcome to change it and/or distribute copies of it under
certain conditions. Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for
details. This GDB was configured as "x86_64--netbsd"...
Reading symbols from /usr/lib/libpthread.so.0...done.
Loaded symbols for /usr/lib/libpthread.so.0
Reading symbols from /usr/lib/libc.so.12...done.
Loaded symbols for /usr/lib/libc.so.12
Reading symbols from /usr/libexec/ld.elf_so...done.
Loaded symbols for /usr/libexec/ld.elf_so
Core was generated by `a.out'.
Program terminated with signal 11, Segmentation fault.
#0  0x000000000041476c in choose_arena_hard ()
(gdb) where
#0  0x000000000041476c in choose_arena_hard ()
#1  0x00000000004158bc in imalloc ()
#2  0x0000000000415f13 in malloc ()
#3  0x000000000045c9f3 in _citrus_lookup_seq_open ()
#4  0x000000000045cbb4 in _citrus_lookup_simple ()
#5  0x0000000000443622 in catopen ()
#6  0x00000000004433b0 in strerror_r ()
#7  0x0000000000411b0d in strerror ()
#8  0x00000000004114fd in verr ()
#9  0x000000000041102e in err ()
#10 0x00007f7ffdc0b70f in pthread__init () from /usr/lib/libpthread.so.0
#11 0x0000000000433b38 in __libc_init ()
#12 0x000000000046502b in __do_global_ctors_aux ()
#13 0x000000000040fe3e in _init ()
#14 0x00007f7fffffd4f8 in ?? ()
#15 0x00000000004100e9 in ___start ()
#16 0x00007f7ffdffa000 in ?? ()
#17 0x0000000000000001 in ?? ()
#18 0x00007f7ffffff778 in ?? ()
#19 0x0000000000000000 in ?? ()
(gdb) q


Home | Main Index | Thread Index | Old Index