aboutsummaryrefslogtreecommitdiff
path: root/gdb/s390-linux-tdep.c
diff options
context:
space:
mode:
authorAndreas Arnez <arnez@linux.vnet.ibm.com>2014-09-12 08:42:48 +0000
committerAndreas Krebbel <krebbel@linux.vnet.ibm.com>2014-09-30 09:14:33 +0200
commit8f0435f75e3c9676d2e177ce055fed3155fd9476 (patch)
tree08032004cab3c1c432651500560db02af97b86bc /gdb/s390-linux-tdep.c
parent5aa82d050d61784823767fe3c982b6862fa47391 (diff)
downloadgdb-8f0435f75e3c9676d2e177ce055fed3155fd9476.zip
gdb-8f0435f75e3c9676d2e177ce055fed3155fd9476.tar.gz
gdb-8f0435f75e3c9676d2e177ce055fed3155fd9476.tar.bz2
Add 'regset' parameter to 'iterate_over_regset_sections_cb'
This adds the 'regset' parameter to the iterator callback. Consequently the 'regset_from_core_section' method is dropped for all targets that provide the iterator method. This change prepares for replacing regset_from_core_section everywhere, thereby eliminating one gdbarch interface. Since the iterator is usually no more complex than regset_from_core_section alone, targets that previously didn't define core_regset_sections will then gain multi-arch capable core file generation support without increased complexity. gdb/ChangeLog: * gdbarch.sh (iterate_over_regset_sections_cb): Add regset parameter. * gdbarch.h: Regenerate. * corelow.c (sniff_core_bfd): Don't sniff if gdbarch has a regset iterator. (get_core_register_section): Add parameter 'regset' and use it, if set. Add parameter 'min_size' and verify the bfd section size against it. (get_core_registers_cb): Add parameter 'regset' and pass it to get_core_register section. For the "standard" register sections ".reg" and ".reg2", set an appropriate default for human_name. (get_core_registers): Don't abort when the gdbarch has an iterator but no regset_from_core_section. Add NULL/0 for parameters 'regset'/'min_size' in calls to get_core_register_section. * linux-tdep.c (linux_collect_regset_section_cb): Add parameter 'regset' and use it instead of calling the regset_from_core_section gdbarch method. * i386-tdep.h (struct gdbarch_tdep): Add field 'fpregset'. * i386-tdep.c (i386_supply_xstateregset) (i386_collect_xstateregset, i386_xstateregset): Moved to i386-linux-tdep.c. (i386_regset_from_core_section): Drop handling for .reg-xfp and .reg-xstate. (i386_gdbarch_init): Set tdep field 'fpregset'. Enable generic core file support only if the regset iterator hasn't been set. * i386-linux-tdep.c (i386_linux_supply_xstateregset) (i386_linux_collect_xstateregset, i386_linux_xstateregset): New. Moved from i386-tdep.c and renamed to *_linux*. (i386_linux_iterate_over_regset_sections): Add regset parameter to each callback invocation. Allow any .reg-xstate size when reading from a core file. * amd64-tdep.c (amd64_supply_xstateregset) (amd64_collect_xstateregset, amd64_xstateregset): Moved to amd64-linux-tdep.c. (amd64_regset_from_core_section): Remove. (amd64_init_abi): Set new tdep field 'fpregset'. No longer install an amd64-specific regset_from_core_section gdbarch method. * amd64-linux-tdep.c (amd64_linux_supply_xstateregset) (amd64_linux_collect_xstateregset, amd64_linux_xstateregset): New. Moved from amd64-tdep.c and renamed to *_linux*. (amd64_linux_iterate_over_regset_sections): Add regset parameter to each callback invocation. Allow any .reg-xstate size when reading from a core file. * arm-linux-tdep.c (arm_linux_regset_from_core_section): Remove. (arm_linux_iterate_over_regset_sections): Add regset parameter to each callback invocation. (arm_linux_init_abi): No longer set the regset_from_core_section gdbarch method. * ppc-linux-tdep.c (ppc_linux_regset_from_core_section): Remove. (ppc_linux_iterate_over_regset_sections): Add regset parameter to each callback invocation. (ppc_linux_init_abi): No longer set the regset_from_core_section gdbarch method. * s390-linux-tdep.c (struct gdbarch_tdep): Remove the fields gregset, sizeof_gregset, fpregset, and sizeof_fpregset. (s390_regset_from_core_section): Remove. (s390_iterate_over_regset_sections): Add regset parameter to each callback invocation. (s390_gdbarch_init): No longer set the regset_from_core_section gdbarch method. Drop initialization of deleted tdep fields.
Diffstat (limited to 'gdb/s390-linux-tdep.c')
-rw-r--r--gdb/s390-linux-tdep.c69
1 files changed, 14 insertions, 55 deletions
diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c
index 840431d..abd2e40 100644
--- a/gdb/s390-linux-tdep.c
+++ b/gdb/s390-linux-tdep.c
@@ -82,13 +82,6 @@ struct gdbarch_tdep
int pc_regnum;
int cc_regnum;
- /* Core file register sets. */
- const struct regset *gregset;
- int sizeof_gregset;
-
- const struct regset *fpregset;
- int sizeof_fpregset;
-
int have_linux_v1;
int have_linux_v2;
int have_tdb;
@@ -536,36 +529,6 @@ const struct regset s390_tdb_regset = {
regcache_collect_regset
};
-/* Return the appropriate register set for the core section identified
- by SECT_NAME and SECT_SIZE. */
-static const struct regset *
-s390_regset_from_core_section (struct gdbarch *gdbarch,
- const char *sect_name, size_t sect_size)
-{
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
-
- if (strcmp (sect_name, ".reg") == 0 && sect_size >= tdep->sizeof_gregset)
- return tdep->gregset;
-
- if (strcmp (sect_name, ".reg2") == 0 && sect_size >= tdep->sizeof_fpregset)
- return tdep->fpregset;
-
- if (strcmp (sect_name, ".reg-s390-high-gprs") == 0 && sect_size >= 16*4)
- return &s390_upper_regset;
-
- if (strcmp (sect_name, ".reg-s390-last-break") == 0 && sect_size >= 8)
- return (gdbarch_ptr_bit (gdbarch) == 32
- ? &s390_last_break_regset : &s390x_last_break_regset);
-
- if (strcmp (sect_name, ".reg-s390-system-call") == 0 && sect_size >= 4)
- return &s390_system_call_regset;
-
- if (strcmp (sect_name, ".reg-s390-tdb") == 0 && sect_size >= 256)
- return &s390_tdb_regset;
-
- return NULL;
-}
-
/* Iterate over supported core file register note sections. */
static void
@@ -575,18 +538,25 @@ s390_iterate_over_regset_sections (struct gdbarch *gdbarch,
const struct regcache *regcache)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ const int gregset_size = (tdep->abi == ABI_LINUX_S390 ?
+ s390_sizeof_gregset : s390x_sizeof_gregset);
- cb (".reg", tdep->sizeof_gregset, "general-purpose", cb_data);
- cb (".reg2", s390_sizeof_fpregset, "floating-point", cb_data);
+ cb (".reg", gregset_size, &s390_gregset, NULL, cb_data);
+ cb (".reg2", s390_sizeof_fpregset, &s390_fpregset, NULL, cb_data);
if (tdep->abi == ABI_LINUX_S390 && tdep->gpr_full_regnum != -1)
- cb (".reg-s390-high-gprs", 16 * 4, "s390 GPR upper halves", cb_data);
+ cb (".reg-s390-high-gprs", 16 * 4, &s390_upper_regset,
+ "s390 GPR upper halves", cb_data);
if (tdep->have_linux_v1)
- cb (".reg-s390-last-break", 8, "s930 last-break address", cb_data);
+ cb (".reg-s390-last-break", 8,
+ (gdbarch_ptr_bit (gdbarch) == 32
+ ? &s390_last_break_regset : &s390x_last_break_regset),
+ "s930 last-break address", cb_data);
if (tdep->have_linux_v2)
- cb (".reg-s390-system-call", 4, "s390 system-call", cb_data);
+ cb (".reg-s390-system-call", 4, &s390_system_call_regset,
+ "s390 system-call", cb_data);
/* If regcache is set, we are in "write" (gcore) mode. In this
case, don't iterate over the TDB unless its registers are
@@ -595,7 +565,8 @@ s390_iterate_over_regset_sections (struct gdbarch *gdbarch,
&& (regcache == NULL
|| REG_VALID == regcache_register_status (regcache,
S390_TDB_DWORD0_REGNUM)))
- cb (".reg-s390-tdb", s390_sizeof_tdbregset, "s390 TDB", cb_data);
+ cb (".reg-s390-tdb", s390_sizeof_tdbregset, &s390_tdb_regset,
+ "s390 TDB", cb_data);
}
static const struct target_desc *
@@ -3067,8 +3038,6 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_stab_reg_to_regnum (gdbarch, s390_dwarf_reg_to_regnum);
set_gdbarch_dwarf2_reg_to_regnum (gdbarch, s390_dwarf_reg_to_regnum);
set_gdbarch_value_from_register (gdbarch, s390_value_from_register);
- set_gdbarch_regset_from_core_section (gdbarch,
- s390_regset_from_core_section);
set_gdbarch_core_read_description (gdbarch, s390_core_read_description);
set_gdbarch_iterate_over_regset_sections (gdbarch,
s390_iterate_over_regset_sections);
@@ -3134,11 +3103,6 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
switch (tdep->abi)
{
case ABI_LINUX_S390:
- tdep->gregset = &s390_gregset;
- tdep->sizeof_gregset = s390_sizeof_gregset;
- tdep->fpregset = &s390_fpregset;
- tdep->sizeof_fpregset = s390_sizeof_fpregset;
-
set_gdbarch_addr_bits_remove (gdbarch, s390_addr_bits_remove);
set_solib_svr4_fetch_link_map_offsets
(gdbarch, svr4_ilp32_fetch_link_map_offsets);
@@ -3147,11 +3111,6 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
break;
case ABI_LINUX_ZSERIES:
- tdep->gregset = &s390_gregset;
- tdep->sizeof_gregset = s390x_sizeof_gregset;
- tdep->fpregset = &s390_fpregset;
- tdep->sizeof_fpregset = s390_sizeof_fpregset;
-
set_gdbarch_long_bit (gdbarch, 64);
set_gdbarch_long_long_bit (gdbarch, 64);
set_gdbarch_ptr_bit (gdbarch, 64);