This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFC/WIP PATCH 13/14] Make "thread apply all" only loop over threads in the current set


This makes "thread apply all" only loop over threads in the current
set instead of always all threads.  That is,

  [all]> thread apply all printf "current thread is %d\n", $_thread

  Thread 3 (Thread 0x7ffff7028700 (LWP 30304)):
  current thread is 3

  Thread 2 (Thread 0x7ffff7829700 (LWP 30303)):
  current thread is 2

  Thread 1 (Thread 0x7ffff7fcb720 (LWP 30300)):
  current thread is 1

vs

  [all]> [1.1] thread apply all printf "current thread is %d\n", $_thread

  Thread 1 (Thread 0x7ffff7fcb720 (LWP 30300)):
  current thread is 1


I think it might make sense to make "info threads" only list threads
of the current focus too.  WDYT?
---
 gdb/thread.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/gdb/thread.c b/gdb/thread.c
index 846d2d3..55a64ac 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -46,6 +46,7 @@
 #include "gdb_regex.h"
 #include "cli/cli-utils.h"
 #include "continuations.h"
+#include "itset.h"
 
 /* Definition of struct thread_info exported to gdbthread.h.  */
 
@@ -1199,8 +1200,8 @@ thread_apply_all_command (char *cmd, int from_tty)
      execute_command.  */
   saved_cmd = xstrdup (cmd);
   make_cleanup (xfree, saved_cmd);
-  for (tp = thread_list; tp; tp = tp->next)
-    if (thread_alive (tp))
+  ALL_THREADS (tp)
+    if (itset_contains_thread (current_itset, tp) && thread_alive (tp))
       {
 	switch_to_thread (tp->ptid);
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]