Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Michael Snyder <msnyder@cygnus.com>
To: Kevin Buettner <kevinb@cygnus.com>
Cc: John Hughes <john@Calva.COM>, gdb@sourceware.cygnus.com
Subject: Re: When is a tid a lwp and vice versa?
Date: Fri, 06 Jul 2001 14:23:00 -0000	[thread overview]
Message-ID: <3B462C5E.A6DE39B@cygnus.com> (raw)
In-Reply-To: <1010706155030.ZM32038@ocotillo.lan>

Kevin Buettner wrote:
> 
> On Jul 4, 10:53am, John Hughes wrote:
> 
> > > Anyway...  it would be a tremendous help if you could figure out why
> > > (and how) the lwp component of inferior_ptid is getting set to 1.
> > > Also, it would be useful to know what the tid value is in this
> > > circumstance.
> >
> > Ok, here we go...
> 
> Thanks...
> 
> > In procfs_init_inferior we have:
> >
> >   if ((pi = create_procinfo (pid, 0)) == NULL)
> >     perror ("procfs: out of memory in 'init_inferior'");
> >
> > so we make a procinfo with pid = pid and tid = 0
> >
> > but later on we say:
> >
> >   /* The 'process ID' we return to GDB is composed of
> >      the actual process ID plus the lwp ID. */
> >   inferior_ptid = MERGEPID (pi->pid, proc_get_current_thread (pi));
> >
> > and proc_get_current_thread has:
> >
> >   if (!pi->status_valid)
> >     if (!proc_get_status (pi))
> >       return 0;
> >   return pi->prstatus.pr_lwp.pr_lwpid;
> >
> > The lwpid is 1, not zero, of course.
> 
> Is 1 a reasonable value for pi->prstatus.pr_lwp.pr_lwpid ?  (It looks
> rather fishy to me.)
> 
> > so the "lwp" field in inferior_ptid is now 1.  (tid is zero).
> >
> > eventualy we call procfs_resume with inferior_ptid and then we do:
> >
> >      if (PIDGET (ptid) != -1)
> >        {
> >          /* Resume a specific thread, presumably suppressing the others. */
> >          thread = find_procinfo (PIDGET (ptid), TIDGET (ptid));
> >          if (thread == NULL)
> >            warning ("procfs: resume can't find thread %ld -- resuming all.",
> >                     TIDGET (ptid));
> >
> > Which prints the ugly message.
> 
> I seem to recall Michael Snyder saying something about this recently...
> Something along the lines that his recent infrun.c fixes cause
> spurious warnings in procfs.c.  I'm not sure if this was one of them
> though...   (CC'd to Michael for his comment.)

OK, I'm not entirely clear why the LWP is 1, but it's clear
that this warning is spurious.  It's happening because I made
resume send the inferior_ptid to target_resume whenever stepping
over a breakpoint, regardless of whether the program is 
multi-threaded or not.  Probably we cannot expect to have a
valid LWP at that point.

I will silence the warning.

Michael


  reply	other threads:[~2001-07-06 14:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1010703175044.ZM25944@ocotillo.lan>
2001-07-04  1:54 ` John Hughes
2001-07-06  8:50   ` Kevin Buettner
2001-07-06 14:23     ` Michael Snyder [this message]
2001-07-08  2:22     ` John Hughes
2001-06-29  1:52 John Hughes
2001-06-29  3:33 ` John Hughes

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=3B462C5E.A6DE39B@cygnus.com \
    --to=msnyder@cygnus.com \
    --cc=gdb@sourceware.cygnus.com \
    --cc=john@Calva.COM \
    --cc=kevinb@cygnus.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