From: Pedro Alves <pedro@codesourcery.com>
To: gdb@sourceware.org
Cc: Jusctsch <schumjs@gmail.com>
Subject: Re: Thread exit error : gdb7.2 in FreeBSD (built from ports)
Date: Thu, 22 Sep 2011 17:11:00 -0000 [thread overview]
Message-ID: <201109221811.16620.pedro@codesourcery.com> (raw)
In-Reply-To: <32503830.post@talk.nabble.com>
On Thursday 22 September 2011 17:34:27, Jusctsch wrote:
> At this point, our inferior_ptid is the thread we planned on deleting, so we
> don't delete it and flag it as exited. It does do some cleanup however, and
> dips back into fbsd-threads.c a few times... Let's continue.
>
> GDB on Application
>
> infrun: target_wait (-1, status) =
> infrun: 1461 [Thread 831ff4900 (LWP 100269 BMC Event Log m)],
> infrun: status->kind = stopped, signal = SIGTRAP
> infrun: infwait_normal_state
> infrun: TARGET_WAITKIND_STOPPED
> infrun: stop_pc = 0x801b169c1
>
> GDB on GDB
>
> Breakpoint 5, get_current_frame () at frame.c:1177
> 1177 error (_("Invalid selected thread."));
>
> (gdb)
> (gdb) p inferior_ptid
> $6 = {pid = 1461, lwp = 0, tid = 100269}
> (gdb)
I still don't understand this. If this thread has exited
before, then why is the backend reporting a
TARGET_WAITKIND_STOPPED for it now? Did a new thread reappear later
out of nothing that reuses the same ID, description and all?
If by magic that's the case, then it's this bit in
infrun.c:handle_inferior_event:
/* If it's a new process, add it to the thread database. */
ecs->new_thread_event = (!ptid_equal (ecs->ptid, inferior_ptid)
&& !ptid_equal (ecs->ptid, minus_one_ptid)
&& !in_thread_list (ecs->ptid));
if (ecs->ws.kind != TARGET_WAITKIND_EXITED
&& ecs->ws.kind != TARGET_WAITKIND_SIGNALLED && ecs->new_thread_event)
add_thread (ecs->ptid);
in_thread_list returns true for an exited thread, but we should end
up in add_thread as well if ecs->ptid is in the thread list marked exited.
--
Pedro Alves
next prev parent reply other threads:[~2011-09-22 17:11 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 [this message]
[not found] ` <CAJoUm=HvAjAQVMVPEWs=deg0h6-m9+oMK3frD2_=bHRx+J1s5g@mail.gmail.com>
2011-09-23 19:31 ` John Schumacher
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=201109221811.16620.pedro@codesourcery.com \
--to=pedro@codesourcery.com \
--cc=gdb@sourceware.org \
--cc=schumjs@gmail.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