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]

[PATCH 3/7] Define and use typedefs for bsd_uthread_ops fields


The next patch modifies the type of the fields of bsd_uthread_ops, and
as a result will require changing parameters of the corresponding types
at different places.  I thought it would be more readable and
maintainable 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 | 20 ++++++++------------
 gdb/bsd-uthread.h | 19 +++++++++++--------
 2 files changed, 19 insertions(+), 20 deletions(-)

diff --git a/gdb/bsd-uthread.c b/gdb/bsd-uthread.c
index 20eecd3879..09a9de28ae 100644
--- a/gdb/bsd-uthread.c
+++ b/gdb/bsd-uthread.c
@@ -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.  */
diff --git a/gdb/bsd-uthread.h b/gdb/bsd-uthread.h
index 7e55913a75..4802d019ae 100644
--- a/gdb/bsd-uthread.h
+++ b/gdb/bsd-uthread.h
@@ -20,19 +20,22 @@
 #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 */
-- 
2.11.0


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