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]

[pushed] gdbserver: Rename some functions, thread -> inferior


These functions apply to thread, and not inferiors (in the gdbserver
sense, the abstraction for threads and processes, as in
inferior_list).  Therefore, it would make more sense if these functions
were named with "thread" rather than "inferior".

gdb/gdbserver/ChangeLog:

	* inferiors.h (inferior_target_data): Rename to ...
	(thread_target_data): ... this.
	(inferior_regcache_data): Rename to ...
	(thread_regcache_data): ... this.
	(set_inferior_regcache_data): Rename to ...
	(set_thread_regcache_data): ... this.
	* inferiors.c (inferior_target_data): Rename to ...
	(thread_target_data): ... this.
	(inferior_regcache_data): Rename to ...
	(thread_regcache_data): ... this.
	(set_inferior_regcache_data): Rename to ...
	(set_thread_regcache_data): ... this.
	(free_one_thread): Update.
	* linux-low.h (get_thread_lwp): Update.
	* regcache.c (get_thread_regcache): Update.
	(regcache_invalidate_thread): Update.
	(free_register_cache_thread): Update.
	* win32-i386-low.c (update_debug_registers_callback): Update.
	(win32_get_current_dr): Update.
	* win32-low.c (thread_rec): Update.
	(delete_thread_info): Update.
	(continue_one_thread): Update.
	(suspend_one_thread): Update.
---
 gdb/gdbserver/ChangeLog        | 26 ++++++++++++++++++++++++++
 gdb/gdbserver/inferiors.c      | 14 +++++++-------
 gdb/gdbserver/inferiors.h      |  6 +++---
 gdb/gdbserver/linux-low.h      |  2 +-
 gdb/gdbserver/regcache.c       | 10 +++++-----
 gdb/gdbserver/win32-i386-low.c |  4 ++--
 gdb/gdbserver/win32-low.c      |  8 ++++----
 7 files changed, 48 insertions(+), 22 deletions(-)

diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 0bf9610..117ba5f 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,29 @@
+2017-08-25  Simon Marchi  <simon.marchi@ericsson.com>
+
+	* inferiors.h (inferior_target_data): Rename to ...
+	(thread_target_data): ... this.
+	(inferior_regcache_data): Rename to ...
+	(thread_regcache_data): ... this.
+	(set_inferior_regcache_data): Rename to ...
+	(set_thread_regcache_data): ... this.
+	* inferiors.c (inferior_target_data): Rename to ...
+	(thread_target_data): ... this.
+	(inferior_regcache_data): Rename to ...
+	(thread_regcache_data): ... this.
+	(set_inferior_regcache_data): Rename to ...
+	(set_thread_regcache_data): ... this.
+	(free_one_thread): Update.
+	* linux-low.h (get_thread_lwp): Update.
+	* regcache.c (get_thread_regcache): Update.
+	(regcache_invalidate_thread): Update.
+	(free_register_cache_thread): Update.
+	* win32-i386-low.c (update_debug_registers_callback): Update.
+	(win32_get_current_dr): Update.
+	* win32-low.c (thread_rec): Update.
+	(delete_thread_info): Update.
+	(continue_one_thread): Update.
+	(suspend_one_thread): Update.
+
 2017-08-24  Simon Marchi  <simon.marchi@ericsson.com>
 
 	* inferiors.c (set_inferior_target_data): Remove.
diff --git a/gdb/gdbserver/inferiors.c b/gdb/gdbserver/inferiors.c
index 8a2e5d2..3c171a1 100644
--- a/gdb/gdbserver/inferiors.c
+++ b/gdb/gdbserver/inferiors.c
@@ -197,7 +197,7 @@ static void
 free_one_thread (struct inferior_list_entry *inf)
 {
   struct thread_info *thread = get_thread (inf);
-  free_register_cache (inferior_regcache_data (thread));
+  free_register_cache (thread_regcache_data (thread));
   free (thread);
 }
 
@@ -309,21 +309,21 @@ find_inferior_id (struct inferior_list *list, ptid_t id)
 }
 
 void *
-inferior_target_data (struct thread_info *inferior)
+thread_target_data (struct thread_info *thread)
 {
-  return inferior->target_data;
+  return thread->target_data;
 }
 
 struct regcache *
-inferior_regcache_data (struct thread_info *inferior)
+thread_regcache_data (struct thread_info *thread)
 {
-  return inferior->regcache_data;
+  return thread->regcache_data;
 }
 
 void
-set_inferior_regcache_data (struct thread_info *inferior, struct regcache *data)
+set_thread_regcache_data (struct thread_info *thread, struct regcache *data)
 {
-  inferior->regcache_data = data;
+  thread->regcache_data = data;
 }
 
 /* Return true if LIST has exactly one entry.  */
diff --git a/gdb/gdbserver/inferiors.h b/gdb/gdbserver/inferiors.h
index be248b0..f229e67 100644
--- a/gdb/gdbserver/inferiors.h
+++ b/gdb/gdbserver/inferiors.h
@@ -160,8 +160,8 @@ struct inferior_list_entry *
 					void *),
 			   void *arg);
 
-void *inferior_target_data (struct thread_info *);
-struct regcache *inferior_regcache_data (struct thread_info *);
-void set_inferior_regcache_data (struct thread_info *, struct regcache *);
+void *thread_target_data (struct thread_info *);
+struct regcache *thread_regcache_data (struct thread_info *);
+void set_thread_regcache_data (struct thread_info *, struct regcache *);
 
 #endif /* INFERIORS_H */
diff --git a/gdb/gdbserver/linux-low.h b/gdb/gdbserver/linux-low.h
index 2bf7e7c..9106144 100644
--- a/gdb/gdbserver/linux-low.h
+++ b/gdb/gdbserver/linux-low.h
@@ -252,7 +252,7 @@ struct linux_target_ops
 
 extern struct linux_target_ops the_low_target;
 
-#define get_thread_lwp(thr) ((struct lwp_info *) (inferior_target_data (thr)))
+#define get_thread_lwp(thr) ((struct lwp_info *) (thread_target_data (thr)))
 #define get_lwp_thread(lwp) ((lwp)->thread)
 
 /* This struct is recorded in the target_data field of struct thread_info.
diff --git a/gdb/gdbserver/regcache.c b/gdb/gdbserver/regcache.c
index 0f16f60..9b837e7 100644
--- a/gdb/gdbserver/regcache.c
+++ b/gdb/gdbserver/regcache.c
@@ -28,7 +28,7 @@ get_thread_regcache (struct thread_info *thread, int fetch)
 {
   struct regcache *regcache;
 
-  regcache = inferior_regcache_data (thread);
+  regcache = thread_regcache_data (thread);
 
   /* Threads' regcaches are created lazily, because biarch targets add
      the main thread/lwp before seeing it stop for the first time, and
@@ -44,7 +44,7 @@ get_thread_regcache (struct thread_info *thread, int fetch)
       gdb_assert (proc->tdesc != NULL);
 
       regcache = new_register_cache (proc->tdesc);
-      set_inferior_regcache_data (thread, regcache);
+      set_thread_regcache_data (thread, regcache);
     }
 
   if (fetch && regcache->registers_valid == 0)
@@ -76,7 +76,7 @@ regcache_invalidate_thread (struct thread_info *thread)
 {
   struct regcache *regcache;
 
-  regcache = inferior_regcache_data (thread);
+  regcache = thread_regcache_data (thread);
 
   if (regcache == NULL)
     return;
@@ -277,13 +277,13 @@ find_register_by_number (const struct target_desc *tdesc, int n)
 static void
 free_register_cache_thread (struct thread_info *thread)
 {
-  struct regcache *regcache = inferior_regcache_data (thread);
+  struct regcache *regcache = thread_regcache_data (thread);
 
   if (regcache != NULL)
     {
       regcache_invalidate_thread (thread);
       free_register_cache (regcache);
-      set_inferior_regcache_data (thread, NULL);
+      set_thread_regcache_data (thread, NULL);
     }
 }
 
diff --git a/gdb/gdbserver/win32-i386-low.c b/gdb/gdbserver/win32-i386-low.c
index c505190..40bdf12 100644
--- a/gdb/gdbserver/win32-i386-low.c
+++ b/gdb/gdbserver/win32-i386-low.c
@@ -45,7 +45,7 @@ update_debug_registers_callback (struct inferior_list_entry *entry,
 				 void *pid_p)
 {
   struct thread_info *thr = (struct thread_info *) entry;
-  win32_thread_info *th = (win32_thread_info *) inferior_target_data (thr);
+  win32_thread_info *th = (win32_thread_info *) thread_target_data (thr);
   int pid = *(int *) pid_p;
 
   /* Only update the threads of this process.  */
@@ -90,7 +90,7 @@ static DWORD64
 win32_get_current_dr (int dr)
 {
   win32_thread_info *th
-    = (win32_thread_info *) inferior_target_data (current_thread);
+    = (win32_thread_info *) thread_target_data (current_thread);
 
   win32_require_context (th);
 
diff --git a/gdb/gdbserver/win32-low.c b/gdb/gdbserver/win32-low.c
index 88f6911..cc84d15 100644
--- a/gdb/gdbserver/win32-low.c
+++ b/gdb/gdbserver/win32-low.c
@@ -198,7 +198,7 @@ thread_rec (ptid_t ptid, int get_context)
   if (thread == NULL)
     return NULL;
 
-  th = (win32_thread_info *) inferior_target_data (thread);
+  th = (win32_thread_info *) thread_target_data (thread);
   if (get_context)
     win32_require_context (th);
   return th;
@@ -232,7 +232,7 @@ static void
 delete_thread_info (struct inferior_list_entry *entry)
 {
   struct thread_info *thread = (struct thread_info *) entry;
-  win32_thread_info *th = (win32_thread_info *) inferior_target_data (thread);
+  win32_thread_info *th = (win32_thread_info *) thread_target_data (thread);
 
   remove_thread (thread);
   CloseHandle (th->h);
@@ -433,7 +433,7 @@ continue_one_thread (struct inferior_list_entry *this_thread, void *id_ptr)
 {
   struct thread_info *thread = (struct thread_info *) this_thread;
   int thread_id = * (int *) id_ptr;
-  win32_thread_info *th = (win32_thread_info *) inferior_target_data (thread);
+  win32_thread_info *th = (win32_thread_info *) thread_target_data (thread);
 
   if (thread_id == -1 || thread_id == th->tid)
     {
@@ -1333,7 +1333,7 @@ static void
 suspend_one_thread (struct inferior_list_entry *entry)
 {
   struct thread_info *thread = (struct thread_info *) entry;
-  win32_thread_info *th = (win32_thread_info *) inferior_target_data (thread);
+  win32_thread_info *th = (win32_thread_info *) thread_target_data (thread);
 
   if (!th->suspended)
     {
-- 
2.7.4


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