From owner-freebsd-threads@FreeBSD.ORG Fri Jul 15 02:13:14 2011 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 021EB106566B for ; Fri, 15 Jul 2011 02:13:14 +0000 (UTC) (envelope-from davidxu@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id E5C0A8FC0A; Fri, 15 Jul 2011 02:13:13 +0000 (UTC) Received: from xyf.my.dom (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p6F2DCQ9096598; Fri, 15 Jul 2011 02:13:13 GMT (envelope-from davidxu@freebsd.org) Message-ID: <4E1FA239.2050200@freebsd.org> Date: Fri, 15 Jul 2011 10:13:13 +0800 From: David Xu User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.9.2.13) Gecko/20110127 Thunderbird/3.1.7 MIME-Version: 1.0 To: John Schumacher References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-threads@freebsd.org Subject: Re: dlopen fails, dynamically linking libthread_db.so fails (gdbserver) X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2011 02:13:14 -0000 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 /usr/include/proc_service.h.