From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13518 invoked by alias); 25 Feb 2013 11:01:35 -0000 Received: (qmail 13510 invoked by uid 22791); 25 Feb 2013 11:01:34 -0000 X-SWARE-Spam-Status: No, hits=-3.5 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 25 Feb 2013 11:01:24 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1U9voB-00033u-Ko from Hui_Zhu@mentor.com for gdb-patches@sourceware.org; Mon, 25 Feb 2013 03:01:23 -0800 Received: from SVR-ORW-FEM-04.mgc.mentorg.com ([147.34.97.41]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Mon, 25 Feb 2013 03:01:23 -0800 Received: from [127.0.0.1] (147.34.91.1) by svr-orw-fem-04.mgc.mentorg.com (147.34.97.41) with Microsoft SMTP Server id 14.1.289.1; Mon, 25 Feb 2013 03:01:22 -0800 Message-ID: <512B447F.8040309@mentor.com> Date: Mon, 25 Feb 2013 11:01:00 -0000 From: Hui Zhu User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:19.0) Gecko/20130126 Thunderbird/19.0 MIME-Version: 1.0 To: CC: "Gustavo, Luis" Subject: [PATCH] remote doesn't add the main thread if we didn't do so already Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit 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/msg00623.txt.bz2 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 * 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