public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: John Schumacher <schumjs@gmail.com>
To: Pedro Alves <pedro@codesourcery.com>
Cc: gdb@sourceware.org
Subject: Re: Thread exit error : gdb7.2 in FreeBSD (built from ports)
Date: Fri, 23 Sep 2011 19:31:00 -0000	[thread overview]
Message-ID: <1316806255.1566.10.camel@johnUbuntu> (raw)
In-Reply-To: <CAJoUm=HvAjAQVMVPEWs=deg0h6-m9+oMK3frD2_=bHRx+J1s5g@mail.gmail.com>

On Thu, 2011-09-22 at 17:06 -0500, John Schumacher wrote:
> 
> This is very suspicious. Is FreeBSD calling into gdb twice for an
> exiting thread? The first time, we are flagging it as exited, and
> getting caught up in the get_current_frame() the second time?
> 
> 
> Is fbsd-threads.c the one who is calling into gdb? Or how does that
> relationship work?
> Thanks again
> -John
> -- 
> John Schumacher
> 
> 

I have questions about the following areas of code within fbsd-threads.c

static ptid_t
fbsd_thread_wait (struct target_ops *ops,
		  ptid_t ptid, struct target_waitstatus *ourstatus, int options)
{
....
      if (ourstatus->value.sig == TARGET_SIGNAL_TRAP)
        check_event(ret);
      /* this is a hack, if an event won't cause gdb to stop, for
example,
         SIGARLM, gdb resumes the process immediatly without setting
         inferior_ptid to the new thread returned here, this is a bug
         because inferior_ptid may already not exist there, and passing
         a none existing thread to fbsd_thread_resume causes error. */
      if (!fbsd_thread_alive (ops, inferior_ptid))
        {
          delete_thread (inferior_ptid);
          inferior_ptid = ret;
        }
    }

  return (ret);
}

Don't we already notify gdb of this through handle_inferior_event? Why
should fbsd-threads.c do this on its own? 
When debugging I saw the following:  we remove the thread here, but
later then an execution_control_state is still created for
handle_inferior_event for the exiting lwp ( or thread, it's used
ambiguously in the case of 1:1 threading) with stop_func_name =
0x8018c13c5 "_thread_bp_death" for the exiting thread. As the thread
state is '_exiting', we will then get hosed later when we handle this as
it checks get_current_frame() (which has an error if the thread state ==
exiting) and forces the user to have to switch to a different thread.

When this delete is commented out, threads are still being properly
removed and no error()'s are occurring. Can you shed any light on the
condition that it is talking about?

(Hopefully this message will pass through without modification, I'm
using plain-text)


  parent reply	other threads:[~2011-09-23 19:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-14 14:27 Jusctsch
2011-09-14 14:41 ` Jusctsch
2011-09-14 15:04 ` Pedro Alves
2011-09-14 17:12   ` Jusctsch
2011-09-14 17:59     ` Pedro Alves
2011-09-22 15:49       ` Jusctsch
2011-09-22 16:34         ` Jusctsch
2011-09-22 17:11           ` Pedro Alves
     [not found]             ` <CAJoUm=HvAjAQVMVPEWs=deg0h6-m9+oMK3frD2_=bHRx+J1s5g@mail.gmail.com>
2011-09-23 19:31               ` John Schumacher [this message]
2011-09-22 22:30 John Schumacher

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=1316806255.1566.10.camel@johnUbuntu \
    --to=schumjs@gmail.com \
    --cc=gdb@sourceware.org \
    --cc=pedro@codesourcery.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).