Using fbsd-threads.c versus thread-db.c (gdbserver)

John Schumacher schumjs at gmail.com
Thu Jun 30 14:24:48 UTC 2011


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 <davidxu at freebsd.org> 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


More information about the freebsd-threads mailing list