summaryrefslogtreecommitdiff
path: root/gdb/gdbserver/gdbthread.h
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2017-10-14 09:10:42 -0400
committerSimon Marchi <simon.marchi@ericsson.com>2017-10-14 09:10:42 -0400
commit9179355e655d78cf44ffdfb432e134eabceaebab (patch)
tree6fd72bc62e2cb3d02cc8d343dfdb21b8de15e848 /gdb/gdbserver/gdbthread.h
parentc9cb8905b489d094c6c42e103d4bc6e231e00cf0 (diff)
downloadbinutils-gdb-9179355e655d78cf44ffdfb432e134eabceaebab.tar.gz
gdbserver: Use std::list for all_processes
Remove the usage of inferior_list for the all_processes list in gdbserver, replace it with an std::list. The entry field in process_info is removed, and replaced by a simple pid field. The pid_of macro, used for both processes and threads, is replaced with separate functions. For completeness, I changed ptid_of and lwpid_of to functions as well. gdb/gdbserver/ChangeLog: * gdbthread.h (ptid_of, pid_of, lwpid_of): New functions. * inferiors.h: Include <list>. (struct process_info) <entry>: Remove field. <pid>: New field. (pid_of): Change macro to function. (ptid_of, lwpid_of): Remove macro. (all_processes): Change type to std::list<process_info *>. (ALL_PROCESSES): Remove macro. (for_each_process, find_process): New function. * inferiors.c (all_processes): Change type to std::list<process_info *>. (find_thread_process): Adjust. (add_process): Likewise. (remove_process): Likewise. (find_process_pid): Likewise. (get_first_process): Likewise. (started_inferior_callback): Remove. (have_started_inferiors_p): Adjust. (attached_inferior_callback): Remove. (have_attached_inferiors_p): Adjust. * linux-low.c (check_zombie_leaders): Likewise. * linux-x86-low.c (x86_arch_setup_process_callback): Remove. (x86_linux_update_xmltarget): Adjust. * server.c (handle_query): Likewise. (gdb_reattached_process): Remove. (handle_status): Adjust. (kill_inferior_callback): Likewise. (detach_or_kill_inferior): Remove. (print_started_pid): Likewise. (print_attached_pid): Likewise. (detach_or_kill_for_exit): Update. (process_serial_event): Likewise. * linux-arm-low.c (arm_new_fork): Likewise.
Diffstat (limited to 'gdb/gdbserver/gdbthread.h')
-rw-r--r--gdb/gdbserver/gdbthread.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/gdb/gdbserver/gdbthread.h b/gdb/gdbserver/gdbthread.h
index a864f958848..93688a36e4f 100644
--- a/gdb/gdbserver/gdbthread.h
+++ b/gdb/gdbserver/gdbthread.h
@@ -88,6 +88,30 @@ struct thread_info *find_any_thread_of_pid (int pid);
/* Get current thread ID (Linux task ID). */
#define current_ptid (current_thread->entry.id)
+/* Get the ptid of THREAD. */
+
+static inline ptid_t
+ptid_of (const thread_info *thread)
+{
+ return thread->entry.id;
+}
+
+/* Get the pid of THREAD. */
+
+static inline int
+pid_of (const thread_info *thread)
+{
+ return thread->entry.id.pid ();
+}
+
+/* Get the lwp of THREAD. */
+
+static inline long
+lwpid_of (const thread_info *thread)
+{
+ return thread->entry.id.lwp ();
+}
+
/* Create a cleanup to restore current_thread. */
struct cleanup *make_cleanup_restore_current_thread (void);