From owner-freebsd-threads@FreeBSD.ORG Mon Aug 4 19:39:39 2008 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 B0FF81065675 for ; Mon, 4 Aug 2008 19:39:39 +0000 (UTC) (envelope-from dixit@netapp.com) Received: from mx2.netapp.com (mx2.netapp.com [216.240.18.37]) by mx1.freebsd.org (Postfix) with ESMTP id 9D0EB8FC1E for ; Mon, 4 Aug 2008 19:39:39 +0000 (UTC) (envelope-from dixit@netapp.com) X-IronPort-AV: E=Sophos;i="4.31,306,1215414000"; d="scan'208";a="24391775" Received: from smtp1.corp.netapp.com ([10.57.156.124]) by mx2-out.netapp.com with ESMTP; 04 Aug 2008 12:39:38 -0700 Received: from dixit-lxp.nane.netapp.com (gpowelltp.nane.netapp.com [10.97.16.81] (may be forged)) by smtp1.corp.netapp.com (8.13.1/8.13.1/NTAP-1.6) with ESMTP id m74JdcP4018032 for ; Mon, 4 Aug 2008 12:39:38 -0700 (PDT) Message-ID: <48975AF9.3060204@netapp.com> Date: Mon, 04 Aug 2008 15:39:37 -0400 From: "Dixit, Amol" User-Agent: Thunderbird 2.0.0.16 (X11/20080707) MIME-Version: 1.0 To: freebsd-threads@freebsd.org References: <488A213F.70105@netapp.com> In-Reply-To: <488A213F.70105@netapp.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: libpthread and 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: Mon, 04 Aug 2008 19:39:39 -0000 Hi, I am now linking my sample application with libthr instead of libpthread, as libthr is the default going forward and it got me past issues in my previous mail (below). I had a question regarding FreeBsd libthread_db. In libthr_db_ops vector (libthr_db.c), we have pt_ta_map_id2thr() and pt_ta_map_lwp2thr(). The former maps tid to thread_handle and latter maps pid to tid. But pt_ta_map_lwp2thr() internally calls pt_ta_map_id2thr() in libthr_db.c so 'pid to tid' conversion is missing. If FreeBsd intends to keep it this way, I will have to modify gdbserver to not use 'pid' to find threads as Linux does. Can someone shed some light on this? Am I mailing the correct mailing-list with these queries? Thanks, Amol Dixit, Amol wrote: > Hi, > I am attempting to port gdbserver to freebsd (initially only for x86 & > libpthread) and I need some assistance with libpthread and libthread-db. > (i) From the code looks like libpthread does not provide any 'thread > creation event' symbol/address to be looked up by thread-db. I got > around this by adding a dummy function call before _thread_create > returned, and that new symbol can be used by thread-db to set > thread-creation breakpoint (analogous to _thread_bp_create in libthr). > (ii) Next hurdle is the race between thread-db and libpthread. > Thread-db tries to access '_thread_list' which is maintained in > libpthread and will eventually contain the 'initial thread' but this > list is NULL when thread-db tries to access it early. There is a > comment before _pthread_create() "It'd be nice to automatically have > _libpthread_init called on program execution..." which will be helpful > for thread-db. Currently I am stuck here as thread-db cannot enable > threading early enough since libpthread is assigning 'initial thread' > to '_thread_list' lazily. > > Am I on the right track on above issues? Any work going on in this area? > Really appreciate any help on this project. > > Thanks, > Amol > > > _______________________________________________ > freebsd-threads@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-threads > To unsubscribe, send any mail to > "freebsd-threads-unsubscribe@freebsd.org"