Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@codesourcery.com>
To: gdb-patches@sourceware.org, "Maciej W. Rozycki" <macro@codesourcery.com>
Cc: Hui Zhu <teawater@gmail.com>
Subject: Re: [RFA]corelow.c: Add tid to add_to_thread_list
Date: Fri, 06 Aug 2010 20:06:00 -0000	[thread overview]
Message-ID: <201008062105.52968.pedro@codesourcery.com> (raw)
In-Reply-To: <201008061817.49329.pedro@codesourcery.com>

On Friday 06 August 2010 18:17:48, Pedro Alves wrote:
> On Friday 06 August 2010 17:47:53, Hui Zhu wrote:

> > struct thread_info *
> > add_thread_silent (ptid_t ptid)
> > {
> 
> If this function hit an internal error in this scenario, then
> it has a bug.  I think Maciej wrote a patch to fix it in our
> internal tree.  I'll try to look for it.  Note that with this
> fixed, gdb would still discard all idle threads but one,
> and, when accessing the registers of the one that stays, we'd
> be accessing the wrong .reg section.

Here's the patch.  (Making Maciej's words mine, and tweaking
for context, ) this assertion:

.../gdb/thread.c:880: internal-error: switch_to_thread: Assertion `inf != NULL' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n)

is related to this change:

2009-05-24  Pedro Alves  <pedro@codesourcery.com>

        * thread.c (new_thread): New function.
        (add_thread_silent): Use it.

which removed a piece of code that actually added minus_one_ptid to
the list of threads.  The current state of switch_to_thread doesn't
allow minus_one_ptid in this context, but null_ptid can be safely used
instead to the same effect.  The change was bogus --- the intent was
to use new_thread (minus_one_ptid), not new_thread (ptid).
Maciej's patch fixes this just as well (or perhaps better), so I've
applied to mainline, and the 7.2 and 7.1 branches.

-- 
Pedro Alves

2010-08-06  Maciej W. Rozycki  <macro@codesourcery.com>

	gdb/
	* thread.c (add_thread_silent): Use null_ptid instead of
	minus_one_ptid while getting rid of stale inferior_ptid.

Index: gdb/thread.c
===================================================================
--- gdb/thread.c	(revision 283123)
+++ gdb/thread.c	(working copy)
@@ -187,11 +187,11 @@ add_thread_silent (ptid_t ptid)
 
       if (ptid_equal (inferior_ptid, ptid))
 	{
-	  tp = new_thread (ptid);
+	  tp = new_thread (null_ptid);
 
 	  /* Make switch_to_thread not read from the thread.  */
 	  tp->state_ = THREAD_EXITED;
-	  switch_to_thread (minus_one_ptid);
+	  switch_to_thread (null_ptid);
 
 	  /* Now we can delete it.  */
 	  delete_thread (ptid);


  reply	other threads:[~2010-08-06 20:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-03  8:49 Hui Zhu
2010-08-05 18:44 ` Tom Tromey
2010-08-06  2:56   ` Hui Zhu
2010-08-06  9:57     ` Pedro Alves
2010-08-06 16:48       ` Hui Zhu
2010-08-06 17:18         ` Pedro Alves
2010-08-06 20:06           ` Pedro Alves [this message]
2010-08-06 20:50             ` Maciej W. Rozycki
2010-08-09  2:28             ` Hui Zhu
2010-08-09 14:48               ` Pedro Alves

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=201008062105.52968.pedro@codesourcery.com \
    --to=pedro@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=macro@codesourcery.com \
    --cc=teawater@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