aboutsummaryrefslogtreecommitdiff
path: root/gdb/i386-tdep.c
diff options
context:
space:
mode:
authorAndreas Arnez <arnez@linux.vnet.ibm.com>2014-05-05 12:58:11 +0000
committerAndreas Krebbel <krebbel@linux.vnet.ibm.com>2014-05-21 17:49:16 +0200
commitecc37a5acc8ff504d62487149f61955343d35fcf (patch)
tree49b786b54bd3862532051e8b77f581d34e4a5809 /gdb/i386-tdep.c
parentb7611c43bf5dcdc84b4432fccef22247af11449e (diff)
downloadgdb-ecc37a5acc8ff504d62487149f61955343d35fcf.zip
gdb-ecc37a5acc8ff504d62487149f61955343d35fcf.tar.gz
gdb-ecc37a5acc8ff504d62487149f61955343d35fcf.tar.bz2
X86: Replace regset_alloc() invocations by static regset structures.
After removal of the regset_alloc invocations, the appropriate tdep fields become obsolete and are thus removed.
Diffstat (limited to 'gdb/i386-tdep.c')
-rw-r--r--gdb/i386-tdep.c46
1 files changed, 21 insertions, 25 deletions
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 7d2363f..88fc31f 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -3744,7 +3744,7 @@ i386_supply_gregset (const struct regset *regset, struct regcache *regcache,
general-purpose register set REGSET. If REGNUM is -1, do this for
all registers in REGSET. */
-void
+static void
i386_collect_gregset (const struct regset *regset,
const struct regcache *regcache,
int regnum, void *gregs, size_t len)
@@ -3828,6 +3828,23 @@ i386_collect_xstateregset (const struct regset *regset,
i387_collect_xsave (regcache, regnum, xstateregs, 1);
}
+/* Register set definitions. */
+
+const struct regset i386_gregset =
+ {
+ NULL, i386_supply_gregset, i386_collect_gregset
+ };
+
+static const struct regset i386_fpregset =
+ {
+ NULL, i386_supply_fpregset, i386_collect_fpregset
+ };
+
+static const struct regset i386_xstateregset =
+ {
+ NULL, i386_supply_xstateregset, i386_collect_xstateregset
+ };
+
/* Return the appropriate register set for the core section identified
by SECT_NAME and SECT_SIZE. */
@@ -3838,32 +3855,15 @@ i386_regset_from_core_section (struct gdbarch *gdbarch,
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
if (strcmp (sect_name, ".reg") == 0 && sect_size == tdep->sizeof_gregset)
- {
- if (tdep->gregset == NULL)
- tdep->gregset = regset_alloc (gdbarch, i386_supply_gregset,
- i386_collect_gregset);
- return tdep->gregset;
- }
+ return &i386_gregset;
if ((strcmp (sect_name, ".reg2") == 0 && sect_size == tdep->sizeof_fpregset)
|| (strcmp (sect_name, ".reg-xfp") == 0
&& sect_size == I387_SIZEOF_FXSAVE))
- {
- if (tdep->fpregset == NULL)
- tdep->fpregset = regset_alloc (gdbarch, i386_supply_fpregset,
- i386_collect_fpregset);
- return tdep->fpregset;
- }
+ return &i386_fpregset;
if (strcmp (sect_name, ".reg-xstate") == 0)
- {
- if (tdep->xstateregset == NULL)
- tdep->xstateregset = regset_alloc (gdbarch,
- i386_supply_xstateregset,
- i386_collect_xstateregset);
-
- return tdep->xstateregset;
- }
+ return &i386_xstateregset;
return NULL;
}
@@ -8287,17 +8287,13 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
gdbarch = gdbarch_alloc (&info, tdep);
/* General-purpose registers. */
- tdep->gregset = NULL;
tdep->gregset_reg_offset = NULL;
tdep->gregset_num_regs = I386_NUM_GREGS;
tdep->sizeof_gregset = 0;
/* Floating-point registers. */
- tdep->fpregset = NULL;
tdep->sizeof_fpregset = I387_SIZEOF_FSAVE;
- tdep->xstateregset = NULL;
-
/* The default settings include the FPU registers, the MMX registers
and the SSE registers. This can be overridden for a specific ABI
by adjusting the members `st0_regnum', `mm0_regnum' and