aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbthread.h
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2014-10-15 22:44:00 +0100
committerPedro Alves <palves@redhat.com>2014-10-15 22:55:14 +0100
commitab970af19746364a4f236bebc238ebb036adc898 (patch)
tree2302e629784df51901815310ee0e961185c6140b /gdb/gdbthread.h
parente8032dde10b743253125d7defb5f5503b21c1d26 (diff)
downloadgdb-ab970af19746364a4f236bebc238ebb036adc898.zip
gdb-ab970af19746364a4f236bebc238ebb036adc898.tar.gz
gdb-ab970af19746364a4f236bebc238ebb036adc898.tar.bz2
remote: get rid of all the T packets when syncing the thread list
This commit avoids the prune_threads call in the remote target's target_update_thread_list's implementation, eliminating all the "thread alive" RSP traffic (one packet per thread) whenever we fetch the thread list. IOW, this: Sending packet: $Tp2141.2150#82...Packet received: OK Sending packet: $Tp2141.214f#b7...Packet received: OK Sending packet: $Tp2141.2141#82...Packet received: OK ... more T packets; it's one per previously known live thread ... Sending packet: $qXfer:threads:read::0,fff#03...Packet received: l<threads>\n<thread id="p2141.2141" core="2"/>\n<thread id="p2141.214f" core="1"/>\n<thread id="p2141.2150" core="2"/>\n</threads>\n Becomes: Sending packet: $qXfer:threads:read::0,fff#03...Packet received: l<threads>\n<thread id="p2141.2141" core="2"/>\n<thread id="p2141.214f" core="1"/>\n<thread id="p2141.2150" core="2"/>\n</threads>\n Tested on x86_64 Fedora 20, native gdbserver: - tests the qXfer:threads:read method. Tested on x86_64 Fedora 20, native gdbserver with qXfer:threads:read force-disabled in gdbserver: - So that GDB falls back to the qfThreadInfo/qsThreadInfo method. And also manually smoked tested force disabling both qXfer:threads:read and qfThreadInfo/qsThreadInfo in gdbserver. gdb/ 2014-10-15 Pedro Alves <palves@redhat.com> * gdbthread.h (ALL_NON_EXITED_THREADS_SAFE): New macro. * remote.c (remote_update_thread_list): Skip calling prune_threads if any thread listing method is supported, and instead walk over the set of remote threads listed, deleting those that are not found in GDB's thread list.
Diffstat (limited to 'gdb/gdbthread.h')
-rw-r--r--gdb/gdbthread.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h
index 1ed98a2..937bd55 100644
--- a/gdb/gdbthread.h
+++ b/gdb/gdbthread.h
@@ -354,6 +354,14 @@ extern struct thread_info *iterate_over_threads (thread_callback_func, void *);
for (T = thread_list; T; T = T->next) \
if ((T)->state != THREAD_EXITED)
+/* Like ALL_NON_EXITED_THREADS, but allows deleting the currently
+ iterated thread. */
+#define ALL_NON_EXITED_THREADS_SAFE(T, TMP) \
+ for ((T) = thread_list; \
+ (T) != NULL ? ((TMP) = (T)->next, 1): 0; \
+ (T) = (TMP)) \
+ if ((T)->state != THREAD_EXITED)
+
extern int thread_count (void);
/* Switch from one thread to another. */