Subject: Re: KASSERT failure when debugging threaded programs
To: Antti Kantee <pooka@cs.hut.fi>
From: Andrew Doran <ad@netbsd.org>
List: current-users
Date: 11/02/2007 01:12:39
On Mon, Oct 29, 2007 at 01:31:30PM +0200, Antti Kantee wrote:

> On Wed Oct 24 2007 at 21:03:59 +0300, Antti Kantee wrote:
> > (I'm only guessing that debugging threaded programs is the reason)
> > 
> > After stepping through a threaded program I can hit the KASSERT in
> > line 550 of kern_sig.c: KASSERT(sigismember(&sp->sp_set, signo));
> > The trace is: lwp_userret -> issignal -> sigget.
> > 
> > Anyone seeing similar issues?  kernel is from Monday's sources.
> 
> I was pointed out that this is probably the same issue as kern/36183.
> Even ideas for a (uncommitworthy) workaround would be welcome, as I
> occasionally forget that I can't use gdb on multithreaded programs and
> panic my system.

We're missing support (in -current) for debugging threaded programs due to
the gdb upgrade some time ago. That's something that can probably be ported
from the wrstuden-fixsa branch.

The panic you're seeing is due to kern/36183, right. The underlying problem
is that ptrace needs work to debug threaded programs. We can either make gdb
use /proc and improve procfs, or figure out how to make ptrace work well
with threads. I don't know of a thread-aware ptrace implementation but maybe
FreeBSD or Darwin have one.

It's on my list to fix before 5.0, but I would certainly not complain if
someone else bet me to it. :-)

Andrew