diff options
-rw-r--r-- | gdb/ChangeLog | 38 | ||||
-rw-r--r-- | gdb/amd64-tdep.c | 5 | ||||
-rw-r--r-- | gdb/amd64obsd-tdep.c | 5 | ||||
-rw-r--r-- | gdb/i386-tdep.c | 10 | ||||
-rw-r--r-- | gdb/i386nbsd-tdep.c | 6 | ||||
-rw-r--r-- | gdb/i386obsd-tdep.c | 6 | ||||
-rw-r--r-- | gdb/regset.c | 21 | ||||
-rw-r--r-- | gdb/regset.h | 17 | ||||
-rw-r--r-- | gdb/sparc64fbsd-tdep.c | 8 | ||||
-rw-r--r-- | gdb/sparc64nbsd-tdep.c | 8 | ||||
-rw-r--r-- | gdb/sparc64obsd-tdep.c | 5 | ||||
-rw-r--r-- | gdb/sparcnbsd-tdep.c | 8 |
12 files changed, 84 insertions, 53 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index b2e6137..9875c8b 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,41 @@ +2004-05-22 Mark Kettenis <kettenis@gnu.org> + + * regset.c: Tweak comment. + (regset_alloc): Remove descr argument. Use GDBARCH_OBSTACK_ZALLOC + macro. + * regset.h: Update copyright year. + (struct regset): Remove `descr' member, add `gdbarch' member. + (regset_alloc): Adjust prototype and comment. + * i386-tdep.c (i386_supply_gregset): Get TDEP from REGSET->arch. + (i386_supply_fpregset): Likewise. + (i386_regset_from_core_section): Update call to regset_alloc. + * i386obsd-tdep.c (i386obsd_aout_supply_regset): Get TDEP from + REGSET->arch. + (i386obsd_aout_regset_from_core_section): Update call to + regset_alloc. + * i386nbsd-tdep.c (i386nbsd_aout_supply_regset): Get TDEP from + REGSET->arch. + (i386nbsd_aout_regset_from_core_section): Update call to + regset_alloc. + * amd64-tdep.c (amd64_supply_fpregset): Get TDEP from + REGSET->arch. + (amd64_regset_from_core_section): Update call to regset_alloc. + * amd64obsd-tdep.c (amd64obsd_supply_regset): Get TDEP from + REGSET->arch. + (amd64obsd_regset_from_core_section): Update call to regset_alloc. + * sparcnbsd-tdep.c (sparc32nbsd_supply_gregset): Directly pass + &sparc32nbsd_gregset in sparc32_supply_gregset call. + (sparc32nbsd_init_abi): Update call to regset_alloc. + * sparc64obsd-tdep.c (sparc64obsd_supply_gregset): Directly pass + &sparc64obsd_core_gregset in sparc64_supply_gregset call. + (sparc64obsd_init_abi): Update call to regset_alloc. + * sparc64nbsd-tdep.c (sparc64nbsd_supply_gregset): Directly pass + &sparc64nbsd_gregset in sparc64_supply_gregset call. + (sparc64nbsd_init_abi): Update call to regset_alloc. + * sparc64fbsd-tdep.c (sparc64fbsd_supply_gregset): Directly pass + &sparc64fbsd_gregset in sparc64_supply_gregset call. + (sparc64fbsd_init_abi): Update call to regset_alloc. + 2004-05-22 Jim Blandy <jimb@redhat.com> * ppc-tdep.h (spe_register_p): New declaration. diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c index 8cb9862..2ce8efc 100644 --- a/gdb/amd64-tdep.c +++ b/gdb/amd64-tdep.c @@ -1056,7 +1056,7 @@ static void amd64_supply_fpregset (const struct regset *regset, struct regcache *regcache, int regnum, const void *fpregs, size_t len) { - const struct gdbarch_tdep *tdep = regset->descr; + const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch); gdb_assert (len == tdep->sizeof_fpregset); amd64_supply_fxsave (regcache, regnum, fpregs); @@ -1074,8 +1074,7 @@ amd64_regset_from_core_section (struct gdbarch *gdbarch, if (strcmp (sect_name, ".reg2") == 0 && sect_size == tdep->sizeof_fpregset) { if (tdep->fpregset == NULL) - tdep->fpregset = regset_alloc (gdbarch, tdep, - amd64_supply_fpregset, NULL); + tdep->fpregset = regset_alloc (gdbarch, amd64_supply_fpregset, NULL); return tdep->fpregset; } diff --git a/gdb/amd64obsd-tdep.c b/gdb/amd64obsd-tdep.c index 01cc559..c1574cd 100644 --- a/gdb/amd64obsd-tdep.c +++ b/gdb/amd64obsd-tdep.c @@ -42,7 +42,7 @@ amd64obsd_supply_regset (const struct regset *regset, struct regcache *regcache, int regnum, const void *regs, size_t len) { - const struct gdbarch_tdep *tdep = regset->descr; + const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch); gdb_assert (len >= tdep->sizeof_gregset + I387_SIZEOF_FXSAVE); @@ -63,8 +63,7 @@ amd64obsd_regset_from_core_section (struct gdbarch *gdbarch, && sect_size >= tdep->sizeof_gregset + I387_SIZEOF_FXSAVE) { if (tdep->gregset == NULL) - tdep->gregset = regset_alloc (gdbarch, tdep, - amd64obsd_supply_regset, NULL); + tdep->gregset = regset_alloc (gdbarch, amd64obsd_supply_regset, NULL); return tdep->gregset; } diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index d01dcc5..3b9ce9c 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -1616,7 +1616,7 @@ void i386_supply_gregset (const struct regset *regset, struct regcache *regcache, int regnum, const void *gregs, size_t len) { - const struct gdbarch_tdep *tdep = regset->descr; + const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch); const char *regs = gregs; int i; @@ -1638,7 +1638,7 @@ static void i386_supply_fpregset (const struct regset *regset, struct regcache *regcache, int regnum, const void *fpregs, size_t len) { - const struct gdbarch_tdep *tdep = regset->descr; + const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch); if (len == I387_SIZEOF_FXSAVE) { @@ -1662,8 +1662,7 @@ i386_regset_from_core_section (struct gdbarch *gdbarch, if (strcmp (sect_name, ".reg") == 0 && sect_size == tdep->sizeof_gregset) { if (tdep->gregset == NULL) - tdep->gregset = regset_alloc (gdbarch, tdep, - i386_supply_gregset, NULL); + tdep->gregset = regset_alloc (gdbarch, i386_supply_gregset, NULL); return tdep->gregset; } @@ -1672,8 +1671,7 @@ i386_regset_from_core_section (struct gdbarch *gdbarch, && sect_size == I387_SIZEOF_FXSAVE)) { if (tdep->fpregset == NULL) - tdep->fpregset = regset_alloc (gdbarch, tdep, - i386_supply_fpregset, NULL); + tdep->fpregset = regset_alloc (gdbarch, i386_supply_fpregset, NULL); return tdep->fpregset; } diff --git a/gdb/i386nbsd-tdep.c b/gdb/i386nbsd-tdep.c index 4f214b4..3f19608 100644 --- a/gdb/i386nbsd-tdep.c +++ b/gdb/i386nbsd-tdep.c @@ -64,7 +64,7 @@ i386nbsd_aout_supply_regset (const struct regset *regset, struct regcache *regcache, int regnum, const void *regs, size_t len) { - const struct gdbarch_tdep *tdep = regset->descr; + const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch); gdb_assert (len >= tdep->sizeof_gregset + I387_SIZEOF_FSAVE); @@ -86,8 +86,8 @@ i386nbsd_aout_regset_from_core_section (struct gdbarch *gdbarch, && sect_size >= tdep->sizeof_gregset + I387_SIZEOF_FSAVE) { if (tdep->gregset == NULL) - tdep->gregset = regset_alloc (gdbarch, tdep, - i386nbsd_aout_supply_regset, NULL); + tdep->gregset = + regset_alloc (gdbarch, i386nbsd_aout_supply_regset, NULL); return tdep->gregset; } diff --git a/gdb/i386obsd-tdep.c b/gdb/i386obsd-tdep.c index 43257ef..6f1ae5b 100644 --- a/gdb/i386obsd-tdep.c +++ b/gdb/i386obsd-tdep.c @@ -119,7 +119,7 @@ i386obsd_aout_supply_regset (const struct regset *regset, struct regcache *regcache, int regnum, const void *regs, size_t len) { - const struct gdbarch_tdep *tdep = regset->descr; + const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch); gdb_assert (len >= tdep->sizeof_gregset + I387_SIZEOF_FSAVE); @@ -141,8 +141,8 @@ i386obsd_aout_regset_from_core_section (struct gdbarch *gdbarch, && sect_size >= tdep->sizeof_gregset + I387_SIZEOF_FSAVE) { if (tdep->gregset == NULL) - tdep->gregset = regset_alloc (gdbarch, tdep, - i386obsd_aout_supply_regset, NULL); + tdep->gregset = + regset_alloc (gdbarch, i386obsd_aout_supply_regset, NULL); return tdep->gregset; } diff --git a/gdb/regset.c b/gdb/regset.c index 7392676..d588b7d 100644 --- a/gdb/regset.c +++ b/gdb/regset.c @@ -1,4 +1,4 @@ -/* Regset support functions, for GDB. +/* Manage register sets. Copyright 2004 Free Software Foundation, Inc. @@ -21,21 +21,26 @@ #include "defs.h" #include "regset.h" + #include "gdb_assert.h" +/* Allocate a fresh 'struct regset' whose supply_regset function is + SUPPLY_REGSET, and whose collect_regset function is COLLECT_REGSET. + If the regset has no collect_regset function, pass NULL for + COLLECT_REGSET. + + The object returned is allocated on ARCH's obstack. */ struct regset * regset_alloc (struct gdbarch *arch, - const void *descr, supply_regset_ftype *supply_regset, collect_regset_ftype *collect_regset) { - struct regset *r - = (struct regset *) gdbarch_obstack_zalloc (arch, sizeof (*r)); + struct regset *regset = GDBARCH_OBSTACK_ZALLOC (arch, struct regset); - r->descr = descr; - r->supply_regset = supply_regset; - r->collect_regset = collect_regset; + regset->arch = arch; + regset->supply_regset = supply_regset; + regset->collect_regset = collect_regset; - return r; + return regset; } diff --git a/gdb/regset.h b/gdb/regset.h index e64c48b..48ad32d 100644 --- a/gdb/regset.h +++ b/gdb/regset.h @@ -1,6 +1,6 @@ /* Manage register sets. - Copyright 2003 Free Software Foundation, Inc. + Copyright 2003, 2004 Free Software Foundation, Inc. This file is part of GDB. @@ -26,6 +26,7 @@ struct gdbarch; struct regcache; /* Data structure describing a register set. */ + typedef void (supply_regset_ftype) (const struct regset *, struct regcache *, int, const void *, size_t); typedef void (collect_regset_ftype) (const struct regset *, @@ -36,7 +37,7 @@ struct regset { /* Data pointer for private use by the methods below, presumably providing some sort of description of the register set. */ - const void *descr; + struct gdbarch *arch; /* Function supplying values in a register set to a register cache. */ supply_regset_ftype *supply_regset; @@ -45,17 +46,15 @@ struct regset collect_regset_ftype *collect_regset; }; - -/* Allocate a fresh 'struct regset' whose descr is DESCR, whose - supply_regset function is SUPPLY_REGSET, and whose collect_regset - function is COLLECT_REGSET. If the regset has no collect function, - pass NULL for COLLECT_REGSET. +/* Allocate a fresh 'struct regset' whose supply_regset function is + SUPPLY_REGSET, and whose collect_regset function is COLLECT_REGSET. + If the regset has no collect_regset function, pass NULL for + COLLECT_REGSET. The object returned is allocated on ARCH's obstack. */ + extern struct regset *regset_alloc (struct gdbarch *arch, - const void *descr, supply_regset_ftype *supply_regset, collect_regset_ftype *collect_regset); - #endif /* regset.h */ diff --git a/gdb/sparc64fbsd-tdep.c b/gdb/sparc64fbsd-tdep.c index bcb9bde..9ca4983 100644 --- a/gdb/sparc64fbsd-tdep.c +++ b/gdb/sparc64fbsd-tdep.c @@ -54,7 +54,7 @@ sparc64fbsd_supply_gregset (const struct regset *regset, struct regcache *regcache, int regnum, const void *gregs, size_t len) { - sparc64_supply_gregset (regset->descr, regcache, regnum, gregs); + sparc64_supply_gregset (&sparc64fbsd_gregset, regcache, regnum, gregs); } static void @@ -199,12 +199,10 @@ sparc64fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) { struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - tdep->gregset = regset_alloc (gdbarch, &sparc64fbsd_gregset, - sparc64fbsd_supply_gregset, NULL); + tdep->gregset = regset_alloc (gdbarch, sparc64fbsd_supply_gregset, NULL); tdep->sizeof_gregset = 256; - tdep->fpregset = regset_alloc (gdbarch, NULL, - sparc64fbsd_supply_fpregset, NULL); + tdep->fpregset = regset_alloc (gdbarch, sparc64fbsd_supply_fpregset, NULL); tdep->sizeof_fpregset = 272; frame_unwind_append_sniffer (gdbarch, sparc64fbsd_sigtramp_frame_sniffer); diff --git a/gdb/sparc64nbsd-tdep.c b/gdb/sparc64nbsd-tdep.c index 1d43d02..544c65b 100644 --- a/gdb/sparc64nbsd-tdep.c +++ b/gdb/sparc64nbsd-tdep.c @@ -57,7 +57,7 @@ sparc64nbsd_supply_gregset (const struct regset *regset, struct regcache *regcache, int regnum, const void *gregs, size_t len) { - sparc64_supply_gregset (regset->descr, regcache, regnum, gregs); + sparc64_supply_gregset (&sparc64nbsd_gregset, regcache, regnum, gregs); } static void @@ -226,12 +226,10 @@ sparc64nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) { struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - tdep->gregset = regset_alloc (gdbarch, &sparc64nbsd_gregset, - sparc64nbsd_supply_gregset, NULL); + tdep->gregset = regset_alloc (gdbarch, sparc64nbsd_supply_gregset, NULL); tdep->sizeof_gregset = 160; - tdep->fpregset = regset_alloc (gdbarch, NULL, - sparc64nbsd_supply_fpregset, NULL); + tdep->fpregset = regset_alloc (gdbarch, sparc64nbsd_supply_fpregset, NULL); tdep->sizeof_fpregset = 272; frame_unwind_append_sniffer (gdbarch, sparc64nbsd_sigtramp_frame_sniffer); diff --git a/gdb/sparc64obsd-tdep.c b/gdb/sparc64obsd-tdep.c index e34df92..b74679c 100644 --- a/gdb/sparc64obsd-tdep.c +++ b/gdb/sparc64obsd-tdep.c @@ -61,7 +61,7 @@ sparc64obsd_supply_gregset (const struct regset *regset, { const char *regs = gregs; - sparc64_supply_gregset (regset->descr, regcache, regnum, regs); + sparc64_supply_gregset (&sparc64obsd_core_gregset, regcache, regnum, regs); sparc64_supply_fpregset (regcache, regnum, regs + 288); } @@ -184,8 +184,7 @@ sparc64obsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) { struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - tdep->gregset = regset_alloc (gdbarch, &sparc64obsd_core_gregset, - sparc64obsd_supply_gregset, NULL); + tdep->gregset = regset_alloc (gdbarch, sparc64obsd_supply_gregset, NULL); tdep->sizeof_gregset = 832; frame_unwind_append_sniffer (gdbarch, sparc64obsd_sigtramp_frame_sniffer); diff --git a/gdb/sparcnbsd-tdep.c b/gdb/sparcnbsd-tdep.c index 90270ed..9019590 100644 --- a/gdb/sparcnbsd-tdep.c +++ b/gdb/sparcnbsd-tdep.c @@ -55,7 +55,7 @@ sparc32nbsd_supply_gregset (const struct regset *regset, struct regcache *regcache, int regnum, const void *gregs, size_t len) { - sparc32_supply_gregset (regset->descr, regcache, regnum, gregs); + sparc32_supply_gregset (&sparc32nbsd_gregset, regcache, regnum, gregs); /* Traditional NetBSD core files don't use multiple register sets. Instead, the general-purpose and floating-point registers are @@ -274,12 +274,10 @@ sparc32nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) set_gdbarch_long_double_bit (gdbarch, 64); set_gdbarch_long_double_format (gdbarch, &floatformat_ieee_double_big); - tdep->gregset = regset_alloc (gdbarch, &sparc32nbsd_gregset, - sparc32nbsd_supply_gregset, NULL); + tdep->gregset = regset_alloc (gdbarch, sparc32nbsd_supply_gregset, NULL); tdep->sizeof_gregset = 20 * 4; - tdep->fpregset = regset_alloc (gdbarch, NULL, - sparc32nbsd_supply_fpregset, NULL); + tdep->fpregset = regset_alloc (gdbarch, sparc32nbsd_supply_fpregset, NULL); tdep->sizeof_fpregset = 33 * 4; frame_unwind_append_sniffer (gdbarch, sparc32nbsd_sigtramp_frame_sniffer); |