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 05/14] Add a small helper to get at a thread's inferior


Add a helper to get at a given thread's inferior.  There are places
that open code this that can just call this helper instead.
---
 gdb/gdbthread.h |    2 ++
 gdb/thread.c    |    9 +++++++++
 2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h
index 97ded57..0135219 100644
--- a/gdb/gdbthread.h
+++ b/gdb/gdbthread.h
@@ -411,4 +411,6 @@ extern struct thread_info* inferior_thread (void);
 
 extern void update_thread_list (void);
 
+extern struct inferior *get_thread_inferior (struct thread_info *thr);
+
 #endif /* GDBTHREAD_H */
diff --git a/gdb/thread.c b/gdb/thread.c
index 0777887..b42c8c3 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -74,6 +74,15 @@ inferior_thread (void)
   return tp;
 }
 
+struct inferior *
+get_thread_inferior (struct thread_info *thr)
+{
+  int pid;
+
+  pid = ptid_get_pid (thr->ptid);
+  return find_inferior_pid (pid);
+}
+
 void
 delete_step_resume_breakpoint (struct thread_info *tp)
 {


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