Pthread Iissue?

Steve Mynott steve at
Thu Aug 7 16:19:00 PDT 2003

The following program dumps core (works on FreeBSD 4.5).

#include <pthread.h>
#include <stdio.h>
void *
thread (void *param)
  char ch = (char) param;
  int i;
  for (i=0; i<4097; i++) {
main (void)
  pthread_t tid;
  pthread_create (&tid, NULL, thread, (void *)'A');
  pthread_create (&tid, NULL, thread, (void *)'B');
  pthread_join(tid, NULL);


fault (core dumped)

steve at fred threads> gdb thread101 thread101.core
GNU gdb 4.18 (FreeBSD)
Copyright 1998 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 
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-unknown-freebsd"...Deprecated bfd_read 
called at 
line 2627 in elfstab_build_psymtabs
Deprecated bfd_read called at 
line 933 in fill_symbuf

Core was generated by `thread101'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/lib/
Reading symbols from /usr/libexec/
#0  0x280da64f in __swbuf () from /usr/lib/
(gdb) bt full
#0  0x280da64f in __swbuf () from /usr/lib/
No symbol table info available.
#1  0x804863e in __sputc (_c=65, _p=0x280fe2f8) at /usr/include/stdio.h:366
        _c = 65
        _p = (FILE *) 0x280fe2f8
#2  0x80485a7 in thread (param=0x41) at thread101.c:12
        ch = 65 'A'
        i = 4096
#3  0x2807f110 in _thread_start () from /usr/lib/
No symbol table info available.
#4  0x0 in ?? ()
No symbol table info available.
(gdb) list 12
7       thread (void *param)
8       {
9         char ch = (char) param;
10        int i;
11        for (i=0; i<4097; i++) {
12          putchar(ch);
13        }
14      }
-- Steve

More information about the Bugs mailing list