Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Hui Zhu <hui_zhu@mentor.com>
To: <gdb-patches@sourceware.org>
Cc: "Gustavo, Luis" <luis_gustavo@mentor.com>
Subject: [PATCH] remote doesn't add the main thread if we didn't do so already
Date: Mon, 25 Feb 2013 11:01:00 -0000	[thread overview]
Message-ID: <512B447F.8040309@mentor.com> (raw)

Hi,

This is the patch to change function add_current_inferior_and_thread that doesn't add the main thread if we didn't do so already.

Thanks,
Hui

2013-02-25  Luis Machado  <lgustavo@codesourcery.com>

	* remote.c (add_current_inferior_and_thread): Only add the main
	thread if we didn't do so already.

--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -3316,10 +3316,16 @@ add_current_inferior_and_thread (char *w
        fake_pid_p = 1;
      }
  
-  remote_add_inferior (fake_pid_p, ptid_get_pid (inferior_ptid), -1);
+  /* Only add the main thread if we didn't do so already.  Some
+     targets don't support listing threads, so we need to handle
+     inclusion of the main thread here.  */
+  if (!in_thread_list (inferior_ptid))
+    {
+      remote_add_inferior (fake_pid_p, ptid_get_pid (inferior_ptid), -1);
  
-  /* Add the main thread.  */
-  add_thread_silent (inferior_ptid);
+      /* Add the main thread.  */
+      add_thread_silent (inferior_ptid);
+    }
  }
  
  static void


             reply	other threads:[~2013-02-25 11:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-25 11:01 Hui Zhu [this message]
2013-02-26 12:08 ` Pedro Alves
2013-02-26 14:40   ` Hui Zhu
2013-02-26 14:49     ` Pedro Alves
2013-02-27  2:00       ` Hui Zhu

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=512B447F.8040309@mentor.com \
    --to=hui_zhu@mentor.com \
    --cc=gdb-patches@sourceware.org \
    --cc=luis_gustavo@mentor.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