Re: [PATCH RFA] lin-lwp.c: Block SIGCHLD events when attaching

Kevin Buettner
2001-11-20T06:53:44Z

On Nov 19, 6:51pm, H . J . Lu wrote:

> > > > # gcc -g ex11.c -lpthread -lrt -D_GNU_SOURCE -static
> > > > # a.out
> > > > # gdb a.out
> > > > ...
> > > > (gdb) att 14226
> > > > Attaching to program: /home/hjl/bugs/gdb/thread/a.out, process 14226
> > > > ...
> > > > lin-lwp.c:620: gdb-internal-error: stop_wait_callback: Assertion `pid == GET_LWP (lp->ptid)' failed.
> > > > An internal GDB error was detected. This may make further
> > > >
> > > > ex11.c is from glibc and 14226 is the first thread. Your patch may fix
> > > > it also.
> > >
> > > I think this might be a different problem. I haven't been able to
> > > reproduce the exact problem that you mentioned above, either with
> > > or without my patch.
> > >
> > > I do occassionally see "Cannot find new threads: generic error". I'm
> > > going to try to figure this one out...
> >
> > The "Cannot find new threads: generic error" that I'm seeing in this
> > program is happening because td_ta_thr_iter() in libthread_db.so is
> > requesting that gdb read the memory associated with a struct
> > _pthread_descr_struct (which has size 1056). It turns out that gdb
> > is able to read 1024 bytes of this struct, but no more. (ptrace()
> > returns EIO when attempting to read more.)
> >
> > I'm not sure why this is happening. Could it be that the manager thread
> > is in the midst of updating the descriptor data structures?
>
> Can you try gdb 5.1 to see what happens with ex11.c?

I just tried it. It seems to behave about the same. It usually attaches
okay, but I am able to reproduce the "Cannot find new threads: generic error"
by using Jim's trick of repeatedly attaching and detaching.

Kevin