From: Pedro Alves <pedro@codesourcery.com>
To: gdb-patches@sourceware.org
Cc: Paul Pluzhnikov <ppluzhnikov@google.com>
Subject: Re: [RFC] Fix for gdb crash in "info thread" after exec().
Date: Wed, 28 May 2008 15:27:00 -0000 [thread overview]
Message-ID: <200805272106.16082.pedro@codesourcery.com> (raw)
In-Reply-To: <20080527190702.6956D3A6952@localhost>
A Tuesday 27 May 2008 20:07:02, Paul Pluzhnikov wrote:
> Ping.
>
> http://sourceware.org/ml/gdb-patches/2008-05/msg00386.html
>
> Also re-sending the patch as inline plain-text.
>
I agree that the threads should not survive across an exec, but
the crash you're reporting suggests that something is
trimming the ptid when it shouldn't, and that ptid is getting
into the thread list.
Here's a patch that handles this a bit more generically:
http://sourceware.org/ml/gdb-patches/2008-05/msg00230.html
In your test case, what is probably happening, is that
linux-nat.c/linux-thread-db.c is escaping an event ptid which
isn't in the thread list, which doesn't have a ptid.lwp member
set, so you're hitting this in 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);
Which I've been claiming is bad...
Could you confirm that this hunk of my patch,
Index: src/gdb/linux-thread-db.c
===================================================================
--- src.orig/gdb/linux-thread-db.c 2008-05-06 12:22:31.000000000 +0100
+++ src/gdb/linux-thread-db.c 2008-05-06 12:53:18.000000000 +0100
@@ -840,7 +840,7 @@ thread_db_wait (ptid_t ptid, struct targ
unpush_target (&thread_db_ops);
using_thread_db = 0;
- return pid_to_ptid (GET_PID (ptid));
+ return ptid;
}
/* If we do not know about the main thread yet, this would be a good time
to
... fixes the issue, and that you were hitting that new_thread_event piece
in infrun.c:handle_inferior_event while handling a TARGET_WAITKIND_EXECD ?
We may need some more interface cleanup to clear the current thread
list across an exec, if the original process had threads, but I don't
think your call is in the right place.
--
Pedro Alves
next prev parent reply other threads:[~2008-05-27 20:06 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-20 22:12 Paul Pluzhnikov
2008-05-28 7:10 ` Paul Pluzhnikov
2008-05-28 15:27 ` Pedro Alves [this message]
2008-05-28 17:10 ` Paul Pluzhnikov
2008-05-28 21:25 ` [new patch] " Pedro Alves
2008-05-28 21:34 ` Paul Pluzhnikov
2008-05-28 22:24 ` Pedro Alves
2008-06-05 1:16 ` Paul Pluzhnikov
2008-06-05 17:23 ` Michael Snyder
2008-06-05 20:43 ` Daniel Jacobowitz
2008-06-05 21:07 ` Pedro Alves
2008-05-28 17:49 ` Paul Pluzhnikov
-- strict thread matches above, loose matches on Subject: below --
2008-05-13 18:07 Paul Pluzhnikov
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=200805272106.16082.pedro@codesourcery.com \
--to=pedro@codesourcery.com \
--cc=gdb-patches@sourceware.org \
--cc=ppluzhnikov@google.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