[FreeBSD 5.3] dlopen + pthread_create

bobby

Есть такая программа:
#include <pthread.h>
#include <dlfcn.h>

#include <iostream>

void * thread(void *)
{
}

using namespace std;

int main
{
pthread_t thr;

pthread_create(&thr, 0, thread, 0);
cerr << "thread started" << endl;

pthread_join(thr, 0);
cerr << "thread finished" << endl;

void * handle = dlopen("/usr/lib/libbz2.so", RTLD_LAZY);
cerr << "dlopen returned: " << handle << endl;

dlclose(handle);
cerr << "the end" << endl;

return 0;
}

компилирую её под FreeBSD 5.3 вот такой командой:
g++ -g -pthread -o test_ld test_ld.cc

запускаю под gdb53:
$ gdb53 ./test_ld
GNU gdb 5.3 (FreeBSD)
Copyright 2002 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 "i386-portbld-freebsd5.3"...
(gdb) r
Starting program: /usr/home//devel/test_ld
thread started
thread finished

Program received signal SIGTRAP, Trace/breakpoint trap.
0x2816cf7f in pthread_testcancel from /usr/lib/libpthread.so.1
(gdb) bt
0x2816cf7f in pthread_testcancel from /usr/lib/libpthread.so.1
0x281653b7 in pthread_mutexattr_init from /usr/lib/libpthread.so.1
(gdb) c
Continuing.

Program received signal SIGSEGV, Segmentation fault.
0x2816cf7f in pthread_testcancel from /usr/lib/libpthread.so.1
(gdb)

Что я делаю не так?
В FreeBSD 4.9, 5.2.1, Linux 2.6.5, Solaris 9 сигналы SIGTRAP и SIGSEGV не приходят, программа завершается нормально.

sergey_m

State-Changed-From-To: open->closed
State-Changed-By:
State-Changed-When: Fri Apr 8 00:09:10 MSD 2005
State-Changed-Why:
Не воспроизводится на 5.4 и 6.0. Либо действительно была такая проблема и она исправлена, либо что-то неправильно у тебя.
Если ты сможешь воспроизвести на 5.4 или 6.0, то приведи больше информации.

bobby

Попробовать негде. Найду 5.4 или 6.0 - попробую.
Оставить комментарий
Имя или ник:
Комментарий: