dlopen fails, dynamically linking libthread_db.so fails (gdbserver)

John Schumacher schumjs at gmail.com
Thu Jul 14 15:19:53 UTC 2011

Hello all,
I'm having an issue in the process of making gdbserver work properly for
multi-threaded applications on FreeBSD.
Specifically, dynamically linking (through dlopen) the libthread_db.so library
seems to be an issue, for an unknown reason.
dlopen is a function in fbsd-threads called during init, on the
libthread_db.so library. In my implementation I get returned the following:

dlopen failed: /usr/lib/libthread_db.so: Undefined symbol
> "ps_pglobal_lookup".
> [GDB will not be able to debug user-mode threads: (null)]

(dlerror was emptied in the first statement, because of my changes- the null
should be replaced with the Undefined symbol jargon)

Also, libthread_db.so is soft-linked to the relevant and existing libraries
(in my case libthread_db.so.3).

A quick google shows that this message is present in the beginning of the
session of those running KGDB- even in normal operation! Has this always
failed? This basically means that all attempts to send thread_db calls
regarding threads to the kernel will fail. Is this an issue internal to
FreeBSD, or is there some way a developer can add these symbols to the

John Schumacher
University of Minnesota (TC)
Electrical Engineering

More information about the freebsd-threads mailing list