From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18751 invoked by alias); 26 Feb 2013 12:08:40 -0000 Received: (qmail 18677 invoked by uid 22791); 26 Feb 2013 12:08:33 -0000 X-SWARE-Spam-Status: No, hits=-8.0 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_SPAMHAUS_DROP,KHOP_THREADED,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 26 Feb 2013 12:08:27 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r1QC8PCx013958 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 26 Feb 2013 07:08:25 -0500 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r1QC8Onl024617; Tue, 26 Feb 2013 07:08:24 -0500 Message-ID: <512CA5B8.2000706@redhat.com> Date: Tue, 26 Feb 2013 12:08:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 To: Hui Zhu CC: gdb-patches@sourceware.org, "Gustavo, Luis" Subject: Re: [PATCH] remote doesn't add the main thread if we didn't do so already References: <512B447F.8040309@mentor.com> In-Reply-To: <512B447F.8040309@mentor.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2013-02/txt/msg00651.txt.bz2 Hi Hui, Luis, Thanks for the patch. On 02/25/2013 11:01 AM, Hui Zhu wrote: > 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. > I have the mild impression I've seen this change before, but heck if I recall any details, and I may be wrong. Can you or Luis expand on the background/rationale for this change? Thanks. > Thanks, > Hui > > 2013-02-25 Luis Machado > > * 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