Re: fail to attach to process on Solaris

Pedro Alves
2011-09-21T16:46:50Z

On Wednesday 21 September 2011 17:18:25, Burkhardt, Glenn wrote:
> Thank you very much for your response.
>
> I did peek at /proc from the command line when the breakpoint in
> find_procinfo_or_die() was hit - there was no corresponding LWP. Nor,
> does it seem, that any LWP with the same thread number ever existed.
>
> Here's more extensive info, with a complete stack trace, and some
> preliminary info printed after gdb attaches. This time, the thread
> number that triggered the problem was 65.

Okay. I assume your program isn't spawning and exiting threads
quickly in succession, otherwise, we'd see LWP ids much higher.

It's libthread_db.so that maps a thread to a LWP id, so we
may be missing some state checks and getting back a stale id.
Try the "maint info sol-threads" command (I never noticed this
command before), and let's see what state does libthread_db.so
think the thread is in. I see that linux-thread-db.c (the glibc/linux
fork of this code) has extra checks for ignoring threads in some states
that the Solaris code doesn't have.

Please don't top post. That has a tendency of making one
forget to answer questions. :-) Here it is again:

> This is Solaris 9, with the default 1:1 model thread library, right?

--
Pedro Alves