From 35e8c540b1014bd4a8baa3233886e1342b14ec5d Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Tue, 7 Feb 2017 16:34:50 -0500 Subject: Define typedefs for bsd_uthread_ops fields 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) : 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 20eecd3..09a9de2 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 7e55913..4802d01 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 */ -- cgit v1.1