Re: gcore and nptl threads on linux

Daniel Jacobowitz
2003-03-06T01:49:51Z

On Wed, Mar 05, 2003 at 08:44:49PM -0500, Andrew Cagney wrote:
> >On Wed, Mar 05, 2003 at 07:56:01PM -0500, Andrew Cagney wrote:
> >
> >>
> >
> >>>>I would think the null_ptid would serve in such a case.
> >
> >>>
> >>>
> >>>I guess the issue is that we should be dumping the set of LWPs to the
> >>>generated core file, not the set of threads. It seems to me like GDB
> >>>should be aware of the list of LWPs, and it shouldn't be hidden in each
> >>>individual thread package.
> >
> >>
> >>You mean add them to the `struct thread_info' list? Why not (ignoring
> >>technical realities for the moment :-)?
> >
> >
> >Well, I wouldn't do it that way. I haven't really designed this, so
> >bear with me if it has some squishy spots.
> >
> >I think there should be two lists:
> > all threads
> > all lwps
>
> I believe in `zero, one, many':
>
> - lwps
> - processes
> - threads (as in pthread)
> - threads (as in a java interpreter thread)
> - tasks (as in ada)

Makes sense.

> Each has something like:
>
> - an architecture
> - a target
> - an owner?

Not sure...

> >Should the data structures be the same? I don't know. The mapping
> >between them would be defined by the thread stratum; its role would be
> >to take thread requests, convert them to LWP requests, and pass them
> >on. The process stratum would be responsible for managing all of the
> >LWPs.
>
> Things to do today should include throwing out stratum (along with the
> bath water).

Good luck, it's been on my list for a year and a half or so and every
time I try I get scared and find something else to do.

> >This has some advantages, I think. Here's one: we would have a logical
> >interface for reporting an event from an LWP that doesn't currently
> >have a thread. This happens in LinuxThreads, as I've mentioned
> >recently. The thread stratum could see that the inferior ptid was just
> >an LWP id and pass the request along no questions asked.
>
> ? That sounds a bit up-side-down, shouldn't events be propogating up -
> lwp gets to see them before thread?

I disconnected from myself there. Event -> lwp layer -> thread layer;
GDB request -> thread layer -> lwp layer.

> >Hmm, definitely some loose edges in that one. Should both an LWP and a
> >thread have a regcache? Might work.
>
> Don't forget that a regcache is just a local performance optimization -
> a look-a-side buffer.

--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer