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

David Xu davidxu at freebsd.org
Fri Jul 15 02:13:14 UTC 2011

On 2011/07/14 23:19, John Schumacher wrote:
> 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
> library?

The libthread_db needs loader to provide proc service, see

More information about the freebsd-threads mailing list