Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Don't query extra info about the internal main thread
@ 2008-07-24 15:09 Pedro Alves
  2008-07-24 15:14 ` Daniel Jacobowitz
  0 siblings, 1 reply; 2+ messages in thread
From: Pedro Alves @ 2008-07-24 15:09 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 634 bytes --]

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

[-- Attachment #2: dont_query_internal_threads.diff --]
[-- Type: text/x-diff, Size: 961 bytes --]

2008-07-24  Pedro Alves  <pedro@codesourcery.com>

	* 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",

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Don't query extra info about the internal main thread
  2008-07-24 15:09 Don't query extra info about the internal main thread Pedro Alves
@ 2008-07-24 15:14 ` Daniel Jacobowitz
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Jacobowitz @ 2008-07-24 15:14 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

On Thu, Jul 24, 2008 at 04:09:35PM +0100, Pedro Alves wrote:
> 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?

OK.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-07-24 15:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-24 15:09 Don't query extra info about the internal main thread Pedro Alves
2008-07-24 15:14 ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox