]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdbserver: no point in hiding the regcache type nowadays
authorPedro Alves <palves@redhat.com>
Thu, 6 Aug 2015 16:29:01 +0000 (17:29 +0100)
committerPedro Alves <palves@redhat.com>
Thu, 6 Aug 2015 16:29:01 +0000 (17:29 +0100)
The regcache used to be hidden inside inferiors.c, but since the
tracepoints support that it's a first class object.  This also fixes a
few implicit pointer conversion errors in C++ mode, caused by a few
places missing the explicit cast.

gdb/gdbserver/ChangeLog:
2015-08-06  Pedro Alves  <palves@redhat.com>

* gdbthread.h (struct regcache): Forward declare.
(struct thread_info) <regcache_data>: Now a struct regcache
pointer.
* inferiors.c (inferior_regcache_data)
(set_inferior_regcache_data): Now work with struct regcache
pointers.
* inferiors.h (struct regcache): Forward declare.
(inferior_regcache_data, set_inferior_regcache_data): Now work
with struct regcache pointers.
* regcache.c (get_thread_regcache, regcache_invalidate_thread)
(free_register_cache_thread): Remove struct regcache pointer
casts.

gdb/gdbserver/ChangeLog
gdb/gdbserver/gdbthread.h
gdb/gdbserver/inferiors.c
gdb/gdbserver/inferiors.h
gdb/gdbserver/regcache.c

index 1c1bb5eba0977060e3d628e3bb81d8455488a2ad..5f0841779fc3f5638481eb1f8268bca5575f6783 100644 (file)
@@ -1,3 +1,18 @@
+2015-08-06  Pedro Alves  <palves@redhat.com>
+
+       * gdbthread.h (struct regcache): Forward declare.
+       (struct thread_info) <regcache_data>: Now a struct regcache
+       pointer.
+       * inferiors.c (inferior_regcache_data)
+       (set_inferior_regcache_data): Now work with struct regcache
+       pointers.
+       * inferiors.h (struct regcache): Forward declare.
+       (inferior_regcache_data, set_inferior_regcache_data): Now work
+       with struct regcache pointers.
+       * regcache.c (get_thread_regcache, regcache_invalidate_thread)
+       (free_register_cache_thread): Remove struct regcache pointer
+       casts.
+
 2015-08-06  Pedro Alves  <palves@redhat.com>
 
        * server.c (captured_main): On error, print the exception message
index b3e3e9dad7b3e96d38eec022b955d60949536d24..d6959f46e60a12a9e2fb36e1934497affd627f99 100644 (file)
@@ -22,6 +22,7 @@
 #include "inferiors.h"
 
 struct btrace_target_info;
+struct regcache;
 
 struct thread_info
 {
@@ -30,7 +31,7 @@ struct thread_info
   struct inferior_list_entry entry;
 
   void *target_data;
-  void *regcache_data;
+  struct regcache *regcache_data;
 
   /* The last resume GDB requested on this thread.  */
   enum resume_kind last_resume_kind;
index 7c5a1e0eac56a4f26c4e139689e7bdd3d97bae5a..d7ad347eeed4e457c13e952ebbcf3e18086d5e17 100644 (file)
@@ -230,14 +230,14 @@ set_inferior_target_data (struct thread_info *inferior, void *data)
   inferior->target_data = data;
 }
 
-void *
+struct regcache *
 inferior_regcache_data (struct thread_info *inferior)
 {
   return inferior->regcache_data;
 }
 
 void
-set_inferior_regcache_data (struct thread_info *inferior, void *data)
+set_inferior_regcache_data (struct thread_info *inferior, struct regcache *data)
 {
   inferior->regcache_data = data;
 }
index 0569586fcfc67bf7a7c8295189aad098e3db09c6..88ebbe373afb38f4c5abea6d16cb2c8f158c16c4 100644 (file)
@@ -33,6 +33,7 @@ struct inferior_list_entry
 };
 
 struct thread_info;
+struct regcache;
 struct target_desc;
 struct sym_cache;
 struct breakpoint;
@@ -147,7 +148,7 @@ struct inferior_list_entry *find_inferior_id (struct inferior_list *list,
 
 void *inferior_target_data (struct thread_info *);
 void set_inferior_target_data (struct thread_info *, void *);
-void *inferior_regcache_data (struct thread_info *);
-void set_inferior_regcache_data (struct thread_info *, void *);
+struct regcache *inferior_regcache_data (struct thread_info *);
+void set_inferior_regcache_data (struct thread_info *, struct regcache *);
 
 #endif /* INFERIORS_H */
index 8d7957b30e9f450414ef6e4713cf6eac6813495d..ef955ffc5a6d3ed9f7f6ed6ecfd9d03e418ea3db 100644 (file)
@@ -28,7 +28,7 @@ get_thread_regcache (struct thread_info *thread, int fetch)
 {
   struct regcache *regcache;
 
-  regcache = (struct regcache *) inferior_regcache_data (thread);
+  regcache = inferior_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
@@ -76,7 +76,7 @@ regcache_invalidate_thread (struct thread_info *thread)
 {
   struct regcache *regcache;
 
-  regcache = (struct regcache *) inferior_regcache_data (thread);
+  regcache = inferior_regcache_data (thread);
 
   if (regcache == NULL)
     return;
@@ -277,8 +277,7 @@ find_register_by_number (const struct target_desc *tdesc, int n)
 static void
 free_register_cache_thread (struct thread_info *thread)
 {
-  struct regcache *regcache
-    = (struct regcache *) inferior_regcache_data (thread);
+  struct regcache *regcache = inferior_regcache_data (thread);
 
   if (regcache != NULL)
     {