From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18435 invoked by alias); 26 Feb 2013 14:40:33 -0000 Received: (qmail 18308 invoked by uid 22791); 26 Feb 2013 14:40:31 -0000 X-SWARE-Spam-Status: No, hits=-4.8 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-oa0-f48.google.com (HELO mail-oa0-f48.google.com) (209.85.219.48) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 26 Feb 2013 14:40:23 +0000 Received: by mail-oa0-f48.google.com with SMTP id j1so5167488oag.7 for ; Tue, 26 Feb 2013 06:40:22 -0800 (PST) X-Received: by 10.182.177.72 with SMTP id co8mr11528330obc.53.1361889622815; Tue, 26 Feb 2013 06:40:22 -0800 (PST) MIME-Version: 1.0 Received: by 10.60.130.231 with HTTP; Tue, 26 Feb 2013 06:39:37 -0800 (PST) In-Reply-To: <512CA5B8.2000706@redhat.com> References: <512B447F.8040309@mentor.com> <512CA5B8.2000706@redhat.com> From: Hui Zhu Date: Tue, 26 Feb 2013 14:40:00 -0000 Message-ID: Subject: Re: [PATCH] remote doesn't add the main thread if we didn't do so already To: Pedro Alves Cc: Hui Zhu , gdb-patches@sourceware.org, "Gustavo, Luis" Content-Type: text/plain; charset=ISO-8859-1 X-IsSubscribed: yes 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/msg00655.txt.bz2 Hi Pedro, On Tue, Feb 26, 2013 at 8:08 PM, Pedro Alves wrote: > 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? This patch is part of OSE support that includes some small changes and some bigger one. So my thought is post the small one first. Thanks, Hui > > 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 >