From owner-freebsd-threads@FreeBSD.ORG Thu Jun 30 14:24:48 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 862AB106564A for ; Thu, 30 Jun 2011 14:24:48 +0000 (UTC) (envelope-from schumjs@gmail.com) Received: from mail-iw0-f182.google.com (mail-iw0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 511068FC12 for ; Thu, 30 Jun 2011 14:24:47 +0000 (UTC) Received: by iwr19 with SMTP id 19so2714841iwr.13 for ; Thu, 30 Jun 2011 07:24:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=0CGTjkSQKJ7bxWPHdnLDSZ0SBGmD0guj6V+7ClZgNOc=; b=BWI/jwC30idzBc3upOTdSVk5GHNdzJiU2tWrPdUs0XC0hW4wQ2BIRIMo5BFhUIRIaK sP0Lm8birv1NvreVB1sB3jYbuQ2pyQXNU+JVQ1x6SV961b9beY0AymHzNEtj/tXemRJO TnBu2nvhQHpU1yoep4GeMHdnXWVO2WMKzIavo= MIME-Version: 1.0 Received: by 10.231.113.214 with SMTP id b22mr1850055ibq.102.1309443887426; Thu, 30 Jun 2011 07:24:47 -0700 (PDT) Received: by 10.231.149.13 with HTTP; Thu, 30 Jun 2011 07:24:47 -0700 (PDT) In-Reply-To: <4E0C1787.8030102@freebsd.org> References: <4E0C1787.8030102@freebsd.org> Date: Thu, 30 Jun 2011 09:24:47 -0500 Message-ID: From: John Schumacher To: David Xu Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-threads@freebsd.org Subject: Re: Using fbsd-threads.c versus thread-db.c (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: Thu, 30 Jun 2011 14:24:48 -0000 Thanks for the clarification David. So for something like gdbserver, which cannot currently query threads, the functional equivalent of fbsd-threads must be implemented to allow for thread awareness? Would there be a reason that gdbserver cannot use the same functions as gdb is using to query threads (gdb being thread aware)? It seems like after the attach on the initial process, there should be no difference between the two- the only difference that I can see is that gdbserver can attach on-the-fly, so it would have to be aware of existing threads. I have looked at the linux flavour of gdbserver. It has full thread awareness and manipulation, but using the nptl threading methods which allow lwps to be handled as full processes. This essentially allows every request type of ptrace() to operate on lwps. There's more to it (like handling certain signals), but that seems to be the big difference. I guess another valid question would be if FreeBSD planned on implementing nptl-like threading in the near future... Thanks a bunch -John On Thu, Jun 30, 2011 at 1:28 AM, David Xu wrote: > On 2011/06/30 01:36, John Schumacher wrote: > > Question: > > Does anyone understand the differences between freebsd-threads.c and > > thread-db.c in FreeBSD? > > Linux's gdbserver makes calls to thread-db.c and thread-db.c sits in the > > gdbserver folder in the 8.1 FreeBSD distro. > > However, I notice that fbsd-threads.c (which sits in > > FreeBSD\8.1\builds\8.1\kernel\source\gnu\usr.bin\gdb\libgdb) has similar > > functionality. > > Is the thread-db.c sitting in the gdbserver a relic from when it was > ported > > over, and doesn't work with FreeBSD? Should one use the fbsd-threads.c to > > query the kernel for new and existing threads? > > > AFAIK, thread-db.c is for Linux only, fbsd-threads.c is FreeBSD code > which implements gdb's target, the code depends on external library > called libthread_db which is a standard to query threads. > > > Thanks > > -John > > > -- John Schumacher University of Minnesota (TC) Electrical Engineering