From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30094 invoked by alias); 24 Jul 2008 15:09:52 -0000 Received: (qmail 30086 invoked by uid 22791); 24 Jul 2008 15:09:51 -0000 X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 24 Jul 2008 15:09:34 +0000 Received: (qmail 10145 invoked from network); 24 Jul 2008 15:09:32 -0000 Received: from unknown (HELO orlando.local) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 24 Jul 2008 15:09:32 -0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: Don't query extra info about the internal main thread Date: Thu, 24 Jul 2008 15:09:00 -0000 User-Agent: KMail/1.9.9 MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_vsJiIhHsXWaju+E" Message-Id: <200807241609.35834.pedro@codesourcery.com> 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: 2008-07/txt/msg00429.txt.bz2 --Boundary-00=_vsJiIhHsXWaju+E Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Content-length: 634 Hi, A couple of weeks ago, Dmitry Smirnov reported that GDB was trying to get qThreadExtraInfo out of his target and it was damaging his debug session, as GDB complained about a protocol error -- because the reply that came back was ill-formed. If the remote side doesn't have any thread support, there's no use in querying info about the main thread that GDB added internally. One would expect stubs that don't support threads to return empty to this optional packet, but his report showed that it's better to not rely on stubs behaving. Tested against gdbserver with and without --disable-packet=threads. OK? -- Pedro Alves --Boundary-00=_vsJiIhHsXWaju+E Content-Type: text/x-diff; charset="utf-8"; name="dont_query_internal_threads.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="dont_query_internal_threads.diff" Content-length: 961 2008-07-24 Pedro Alves * remote.c (remote_threads_extra_info): Don't query the remote server about info on the internally added main thread. --- gdb/remote.c | 6 ++++++ 1 file changed, 6 insertions(+) Index: src/gdb/remote.c =================================================================== --- src.orig/gdb/remote.c 2008-07-12 18:52:38.000000000 +0100 +++ src/gdb/remote.c 2008-07-24 15:47:42.000000000 +0100 @@ -2042,6 +2042,12 @@ remote_threads_extra_info (struct thread internal_error (__FILE__, __LINE__, _("remote_threads_extra_info")); + if (ptid_equal (tp->ptid, magic_null_ptid) + || (ptid_get_pid (tp->ptid) != 0 && ptid_get_tid (tp->ptid) == 0)) + /* This is the main thread which was added by GDB. The remote + server doesn't know about it. */ + return NULL; + if (use_threadextra_query) { xsnprintf (rs->buf, get_remote_packet_size (), "qThreadExtraInfo,%lx", --Boundary-00=_vsJiIhHsXWaju+E--