Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@mvista.com>
To: Kevin Buettner <kevinb@redhat.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [PATCH RFA/RFC] Don't use lwp_from_thread() in thread_db_wait()
Date: Tue, 12 Mar 2002 08:23:00 -0000	[thread overview]
Message-ID: <20020312112331.A24963@nevyn.them.org> (raw)
In-Reply-To: <1020312075215.ZM22017@localhost.localdomain>

On Tue, Mar 12, 2002 at 12:52:16AM -0700, Kevin Buettner wrote:
> On Mar 11, 10:23pm, Daniel Jacobowitz wrote:
> 
> > On Mon, Mar 11, 2002 at 08:16:19PM -0700, Kevin Buettner wrote:
> > > I think that an LWP id cache is only useful so long as all of the
> > > threads are stopped.  This is because the mappings could change in the
> > > course of running the program.  So, for this particular case, where
> > > the threads are running and we want to wait for one of them to stop,
> > > the cache wouldn't be useful to us.
> > > 
> > > Of course, if we have knowledge that a particular thread
> > > implementation never changes its mappings or perhaps only changes its
> > > mappings for certain threads, we might be able to use such a cache
> > > across the stop/start transitions.  However, I think that Mark had
> > > intended for thread-db.c to be a fairly generic solution that's not
> > > wedded to any one particular thread implementation.  In particular, it
> > > should be possible to use it with an M:N model in which a thread may
> > > migrate from one LWP to another.
> > 
> > This implies that part of the caching should be in lin-lwp.c rather
> > than in thread-db.c... that knowledge belongs with the lower level
> > threading layer.  Does that make sense?
> 
> I think I see what you're driving at, though I don't think it belongs
> in lin-lwp.c.  lin-lwp.c should, I hope, be usable as is by a number
> of different thread implementations.  Instead, I think what you have
> in mind should reside in some sort of policy adjuct to thread-db.c
> which understands the kinds of relationships that can exist between
> thread ids and lwp ids.  If it knows that the thread implementation
> uses a 1:1 model as linuxthreads does now, it can use agressive
> caching.  (By which I mean that the cache is allowed to persist
> between stops in the debugger).  If it uses a M:N model, it must cache
> more conservatively.  (I.e, the cache must be invalidated whenever the
> inferior is resumed.)  I think this code could be reasonably generic
> and it shouldn't be too hard to implement.  The difficult part will be

I like this a lot.

> to figure out which kind of thread library you have.  After all, if
> someone provided a dropin replacement for linuxthreads which
> implemented M:N threading, how would you tell the difference?

... great care, and maybe a ``set'' option to override?  Unfortunately,
IBM's ngpt seems to be mostly drop-in, barring some symbol versioning
complexity.  We can probably find a way to distinguish...  what's worse
is that NGPT can build as a libpthread.so, but not a libthread_db.so,
so we may have to handle mismatches :(

> > We could also, for instance, update the cache via thread event
> > reporting...
> 
> If the thread events tell GDB when a thread has migrated from one
> LWP to another, then this would work too.

Yes, that could probably be arranged.  Someday we should talk to a
vendor of an M:N threads package and see what we have to work with.  I
don't know of any offhand besides NGPT.

> ...
> 
> But, for the problem at hand (i.e, the bug that my patch is intended
> to fix), I think it's important that we first make it work without
> caching.  As I see it, the cache ought to exist to enhance
> performance, not guarantee basic correctness.  If we can't make it
> work without some sort of caching or enhanced thread event reporting,
> we need to understand exactly why first.

I agree.

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer


  reply	other threads:[~2002-03-12 16:23 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-11 15:46 Kevin Buettner
2002-03-11 18:47 ` Daniel Jacobowitz
2002-03-11 19:16   ` Kevin Buettner
2002-03-11 19:23     ` Daniel Jacobowitz
2002-03-11 23:52       ` Kevin Buettner
2002-03-12  8:23         ` Daniel Jacobowitz [this message]
2002-03-13  9:37           ` David Taylor
2002-03-13  9:55             ` Daniel Jacobowitz
2002-03-13 10:18               ` Andrew Cagney
2002-03-13 10:38               ` David Taylor
2002-04-02 13:19 ` Daniel Jacobowitz
2002-05-02 14:07   ` Michael Snyder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020312112331.A24963@nevyn.them.org \
    --to=drow@mvista.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=kevinb@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox