]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Define typedefs for bsd_uthread_ops fields
authorSimon Marchi <simon.marchi@ericsson.com>
Tue, 7 Feb 2017 21:34:50 +0000 (16:34 -0500)
committerSimon Marchi <simon.marchi@ericsson.com>
Tue, 7 Mar 2017 15:54:56 +0000 (10:54 -0500)
The next patch will modify the type of the fields of bsd_uthread_ops,
and will require changing parameters of the corresponding type at
different places.  I thought it would be more readable if typedefs were used.

gdb/ChangeLog:

* bsd-uthread.h (bsd_uthread_supply_register_ftype,
bsd_uthread_collect_register_ftype): New typedefs.
(bsd_uthread_set_supply_uthread,
bsd_uthread_set_collect_uthread): Use typedefs.
* bsd-uthread.c (struct bsd_uthread_ops)
<supply_uthread, collect_uthread>: Likewise.
(bsd_uthread_set_supply_uthread,
bsd_uthread_set_collect_uthread): Likewise.

gdb/bsd-uthread.c
gdb/bsd-uthread.h

index 20eecd38799e7cc985b663929e559d39661b0e8e..09a9de28aee560656221e5b89765419401db1f90 100644 (file)
@@ -45,10 +45,10 @@ static struct gdbarch_data *bsd_uthread_data;
 struct bsd_uthread_ops
 {
   /* Supply registers for an inactive thread to a register cache.  */
-  void (*supply_uthread)(struct regcache *, int, CORE_ADDR);
+  bsd_uthread_supply_register_ftype supply_uthread;
 
   /* Collect registers for an inactive thread from a register cache.  */
-  void (*collect_uthread)(const struct regcache *, int, CORE_ADDR);
+  bsd_uthread_collect_register_ftype collect_uthread;
 };
 
 static void *
@@ -60,32 +60,28 @@ bsd_uthread_init (struct obstack *obstack)
   return ops;
 }
 
-/* Set the function that supplies registers from an inactive thread
-   for architecture GDBARCH to SUPPLY_UTHREAD.  */
+/* See bsd-uthread.h.  */
 
 void
 bsd_uthread_set_supply_uthread (struct gdbarch *gdbarch,
-                               void (*supply_uthread) (struct regcache *,
-                                                       int, CORE_ADDR))
+                               bsd_uthread_supply_register_ftype func)
 {
   struct bsd_uthread_ops *ops
     = (struct bsd_uthread_ops *) gdbarch_data (gdbarch, bsd_uthread_data);
 
-  ops->supply_uthread = supply_uthread;
+  ops->supply_uthread = func;
 }
 
-/* Set the function that collects registers for an inactive thread for
-   architecture GDBARCH to SUPPLY_UTHREAD.  */
+/* See bsd-uthread.h.  */
 
 void
 bsd_uthread_set_collect_uthread (struct gdbarch *gdbarch,
-                        void (*collect_uthread) (const struct regcache *,
-                                                 int, CORE_ADDR))
+                                bsd_uthread_collect_register_ftype func)
 {
   struct bsd_uthread_ops *ops
     = (struct bsd_uthread_ops *) gdbarch_data (gdbarch, bsd_uthread_data);
 
-  ops->collect_uthread = collect_uthread;
+  ops->collect_uthread = func;
 }
 
 /* Magic number to help recognize a valid thread structure.  */
index 7e55913a756160a8babdbaec01b194f58edc1508..4802d019ae7d39bd0c2213cb98f271f52fe3c6df 100644 (file)
 #ifndef BSD_UTHREAD_H
 #define BSD_UTHREAD_H 1
 
+typedef void (*bsd_uthread_supply_register_ftype) (struct regcache *, int,
+                                                  CORE_ADDR);
+typedef void (*bsd_uthread_collect_register_ftype) (const struct regcache *,
+                                                   int, CORE_ADDR);
+
 /* Set the function that supplies registers for an inactive thread for
-   architecture GDBARCH to SUPPLY_UTHREAD.  */
+   architecture GDBARCH to FUNC.  */
 
-extern void bsd_uthread_set_supply_uthread (struct gdbarch *gdbarch,
-                                   void (*supply_uthread) (struct regcache *,
-                                                           int, CORE_ADDR));
+extern void bsd_uthread_set_supply_uthread
+  (struct gdbarch *gdbarch, bsd_uthread_supply_register_ftype func);
 
 
 /* Set the function that collects registers for an inactive thread for
-   architecture GDBARCH to SUPPLY_UTHREAD.  */
+   architecture GDBARCH to FUNC.  */
 
-extern void bsd_uthread_set_collect_uthread (struct gdbarch *gdbarch,
-                            void (*collect_uthread) (const struct regcache *,
-                                                     int, CORE_ADDR));
+extern void bsd_uthread_set_collect_uthread
+  (struct gdbarch *gdbarch, bsd_uthread_collect_register_ftype func);
 
 #endif /* bsd-uthread.h */