diff options
author | Jim Blandy <jimb@codesourcery.com> | 2004-05-21 22:15:10 +0000 |
---|---|---|
committer | Jim Blandy <jimb@codesourcery.com> | 2004-05-21 22:15:10 +0000 |
commit | 617a4cbacf3fae7fb4eb43708b127bd19dc1623b (patch) | |
tree | 428672b8e68b23c4d269fc7d793a88190248adbb | |
parent | 6bd3dfaaa22d67e2070f89b4c960311842a3faaf (diff) | |
download | gdb-617a4cbacf3fae7fb4eb43708b127bd19dc1623b.zip gdb-617a4cbacf3fae7fb4eb43708b127bd19dc1623b.tar.gz gdb-617a4cbacf3fae7fb4eb43708b127bd19dc1623b.tar.bz2 |
Allocate regset structures in the gdbarch's obstack, not using
xmalloc.
* regset.c (regset_alloc): Renamed from regset_xmalloc.
Add 'arch' argument. Allocate the regset on arch's obstack, not
using xmalloc.
* regset.h (regset_alloc): Update declaration.
* am64-tdep.c (amd64_regset_from_core_section): Update call; pass
gdbarch argument.
* amd64obsd-tdep.c (amd64obsd_regset_from_core_section): Same.
* i386-tdep.c (i386_regset_from_core_section): Same.
* i386nbsd-tdep.c (i386nbsd_aout_regset_from_core_section): Same.
* i386obsd-tdep.c (i386obsd_aout_regset_from_core_section): Same.
* sparc64fbsd-tdep.c (sparc64fbsd_init_abi): Same.
* sparc64nbsd-tdep.c (sparc64nbsd_init_abi): Same.
* sparc64obsd-tdep.c (sparc64obsd_init_abi): Same.
* sparcnbsd-tdep.c (sparc32nbsd_init_abi): Same.
-rw-r--r-- | gdb/ChangeLog | 19 | ||||
-rw-r--r-- | gdb/amd64-tdep.c | 3 | ||||
-rw-r--r-- | gdb/amd64obsd-tdep.c | 3 | ||||
-rw-r--r-- | gdb/i386-tdep.c | 6 | ||||
-rw-r--r-- | gdb/i386nbsd-tdep.c | 4 | ||||
-rw-r--r-- | gdb/i386obsd-tdep.c | 4 | ||||
-rw-r--r-- | gdb/regset.c | 10 | ||||
-rw-r--r-- | gdb/regset.h | 9 | ||||
-rw-r--r-- | gdb/sparc64fbsd-tdep.c | 7 | ||||
-rw-r--r-- | gdb/sparc64nbsd-tdep.c | 7 | ||||
-rw-r--r-- | gdb/sparc64obsd-tdep.c | 5 | ||||
-rw-r--r-- | gdb/sparcnbsd-tdep.c | 7 |
12 files changed, 56 insertions, 28 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 4850e7c..554363f 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,22 @@ +2004-05-21 Jim Blandy <jimb@redhat.com> + + Allocate regset structures in the gdbarch's obstack, not using + xmalloc. + * regset.c (regset_alloc): Renamed from regset_xmalloc. + Add 'arch' argument. Allocate the regset on arch's obstack, not + using xmalloc. + * regset.h (regset_alloc): Update declaration. + * am64-tdep.c (amd64_regset_from_core_section): Update call; pass + gdbarch argument. + * amd64obsd-tdep.c (amd64obsd_regset_from_core_section): Same. + * i386-tdep.c (i386_regset_from_core_section): Same. + * i386nbsd-tdep.c (i386nbsd_aout_regset_from_core_section): Same. + * i386obsd-tdep.c (i386obsd_aout_regset_from_core_section): Same. + * sparc64fbsd-tdep.c (sparc64fbsd_init_abi): Same. + * sparc64nbsd-tdep.c (sparc64nbsd_init_abi): Same. + * sparc64obsd-tdep.c (sparc64obsd_init_abi): Same. + * sparcnbsd-tdep.c (sparc32nbsd_init_abi): Same. + 2004-05-21 Joel Brobecker <brobecker@gnat.com> * config/djgpp/fnchange.lst: Undo previous change, was useless. diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c index a326811..8cb9862 100644 --- a/gdb/amd64-tdep.c +++ b/gdb/amd64-tdep.c @@ -1074,7 +1074,8 @@ 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_xmalloc (tdep, amd64_supply_fpregset, NULL); + tdep->fpregset = regset_alloc (gdbarch, tdep, + amd64_supply_fpregset, NULL); return tdep->fpregset; } diff --git a/gdb/amd64obsd-tdep.c b/gdb/amd64obsd-tdep.c index 5ded31d..01cc559 100644 --- a/gdb/amd64obsd-tdep.c +++ b/gdb/amd64obsd-tdep.c @@ -63,7 +63,8 @@ amd64obsd_regset_from_core_section (struct gdbarch *gdbarch, && sect_size >= tdep->sizeof_gregset + I387_SIZEOF_FXSAVE) { if (tdep->gregset == NULL) - tdep->gregset = regset_xmalloc (tdep, amd64obsd_supply_regset, NULL); + tdep->gregset = regset_alloc (gdbarch, tdep, + amd64obsd_supply_regset, NULL); return tdep->gregset; } diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index 9981059..d01dcc5 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -1662,7 +1662,8 @@ 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_xmalloc (tdep, i386_supply_gregset, NULL); + tdep->gregset = regset_alloc (gdbarch, tdep, + i386_supply_gregset, NULL); return tdep->gregset; } @@ -1671,7 +1672,8 @@ i386_regset_from_core_section (struct gdbarch *gdbarch, && sect_size == I387_SIZEOF_FXSAVE)) { if (tdep->fpregset == NULL) - tdep->fpregset = regset_xmalloc (tdep, i386_supply_fpregset, NULL); + tdep->fpregset = regset_alloc (gdbarch, tdep, + i386_supply_fpregset, NULL); return tdep->fpregset; } diff --git a/gdb/i386nbsd-tdep.c b/gdb/i386nbsd-tdep.c index 53dbe8a..4f214b4 100644 --- a/gdb/i386nbsd-tdep.c +++ b/gdb/i386nbsd-tdep.c @@ -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_xmalloc (tdep, i386nbsd_aout_supply_regset, NULL); + tdep->gregset = regset_alloc (gdbarch, tdep, + i386nbsd_aout_supply_regset, NULL); return tdep->gregset; } diff --git a/gdb/i386obsd-tdep.c b/gdb/i386obsd-tdep.c index a21faab..43257ef 100644 --- a/gdb/i386obsd-tdep.c +++ b/gdb/i386obsd-tdep.c @@ -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_xmalloc (tdep, i386obsd_aout_supply_regset, NULL); + tdep->gregset = regset_alloc (gdbarch, tdep, + i386obsd_aout_supply_regset, NULL); return tdep->gregset; } diff --git a/gdb/regset.c b/gdb/regset.c index 2ab40b8..7392676 100644 --- a/gdb/regset.c +++ b/gdb/regset.c @@ -25,11 +25,13 @@ struct regset * -regset_xmalloc (const void *descr, - supply_regset_ftype *supply_regset, - collect_regset_ftype *collect_regset) +regset_alloc (struct gdbarch *arch, + const void *descr, + supply_regset_ftype *supply_regset, + collect_regset_ftype *collect_regset) { - struct regset *r = (struct regset *) xmalloc (sizeof (*r)); + struct regset *r + = (struct regset *) gdbarch_obstack_zalloc (arch, sizeof (*r)); r->descr = descr; r->supply_regset = supply_regset; diff --git a/gdb/regset.h b/gdb/regset.h index b787c72..e64c48b 100644 --- a/gdb/regset.h +++ b/gdb/regset.h @@ -51,10 +51,11 @@ struct regset function is COLLECT_REGSET. If the regset has no collect function, pass NULL for COLLECT_REGSET. - The object returned is allocated using xmalloc. */ -extern struct regset *regset_xmalloc (const void *descr, - supply_regset_ftype *supply_regset, - collect_regset_ftype *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 7864ffa..bcb9bde 100644 --- a/gdb/sparc64fbsd-tdep.c +++ b/gdb/sparc64fbsd-tdep.c @@ -199,11 +199,12 @@ sparc64fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) { struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - tdep->gregset - = regset_xmalloc (&sparc64fbsd_gregset, sparc64fbsd_supply_gregset, NULL); + tdep->gregset = regset_alloc (gdbarch, &sparc64fbsd_gregset, + sparc64fbsd_supply_gregset, NULL); tdep->sizeof_gregset = 256; - tdep->fpregset = regset_xmalloc (NULL, sparc64fbsd_supply_fpregset, NULL); + tdep->fpregset = regset_alloc (gdbarch, NULL, + 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 25a0074..1d43d02 100644 --- a/gdb/sparc64nbsd-tdep.c +++ b/gdb/sparc64nbsd-tdep.c @@ -226,11 +226,12 @@ sparc64nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) { struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - tdep->gregset - = regset_xmalloc (&sparc64nbsd_gregset, sparc64nbsd_supply_gregset, NULL); + tdep->gregset = regset_alloc (gdbarch, &sparc64nbsd_gregset, + sparc64nbsd_supply_gregset, NULL); tdep->sizeof_gregset = 160; - tdep->fpregset = regset_xmalloc (NULL, sparc64nbsd_supply_fpregset, NULL); + tdep->fpregset = regset_alloc (gdbarch, NULL, + 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 b6bd88c..e34df92 100644 --- a/gdb/sparc64obsd-tdep.c +++ b/gdb/sparc64obsd-tdep.c @@ -184,9 +184,8 @@ sparc64obsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) { struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - tdep->gregset = regset_xmalloc (&sparc64obsd_core_gregset, - sparc64obsd_supply_gregset, - NULL); + tdep->gregset = regset_alloc (gdbarch, &sparc64obsd_core_gregset, + 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 ab6003c..90270ed 100644 --- a/gdb/sparcnbsd-tdep.c +++ b/gdb/sparcnbsd-tdep.c @@ -274,11 +274,12 @@ 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_xmalloc (&sparc32nbsd_gregset, sparc32nbsd_supply_gregset, NULL); + tdep->gregset = regset_alloc (gdbarch, &sparc32nbsd_gregset, + sparc32nbsd_supply_gregset, NULL); tdep->sizeof_gregset = 20 * 4; - tdep->fpregset = regset_xmalloc (NULL, sparc32nbsd_supply_fpregset, NULL); + tdep->fpregset = regset_alloc (gdbarch, NULL, + sparc32nbsd_supply_fpregset, NULL); tdep->sizeof_fpregset = 33 * 4; frame_unwind_append_sniffer (gdbarch, sparc32nbsd_sigtramp_frame_sniffer); |