aboutsummaryrefslogtreecommitdiff
path: root/gdb/s390-linux-tdep.c
diff options
context:
space:
mode:
authorAlan Hayward <alan.hayward@arm.com>2018-08-13 10:04:11 +0100
committerAlan Hayward <alan.hayward@arm.com>2018-08-13 10:16:41 +0100
commita616bb94509c22c96ae8bf1432ec28a7f3e31778 (patch)
treecec4cbdc93deaceb249df32a4914668d7d48ef45 /gdb/s390-linux-tdep.c
parentfacbd8bd3d6d51c907494a269dc13a2a0a75bc4e (diff)
downloadgdb-a616bb94509c22c96ae8bf1432ec28a7f3e31778.zip
gdb-a616bb94509c22c96ae8bf1432ec28a7f3e31778.tar.gz
gdb-a616bb94509c22c96ae8bf1432ec28a7f3e31778.tar.bz2
Split size in regset section iterators
In the existing code, when using the regset section iteration functions, the size parameter is used in different ways. With collect, size is used to create the buffer in which to write the regset. (see linux-tdep.c::linux_collect_regset_section_cb). With supply, size is used to confirm the existing regset is the correct size. If REGSET_VARIABLE_SIZE is set then the regset can be bigger than size. Effectively, size is the minimum possible size of the regset. (see corelow.c::get_core_register_section). There are currently no targets with both REGSET_VARIABLE_SIZE and a collect function. In SVE, a corefile can contain one of two formats after the header, both of which are different sizes. However, when writing a core file, we always want to write out the full bigger size. To allow support of collects for REGSET_VARIABLE_SIZE we need two sizes. This is done by adding supply_size and collect_size. gdb/ * aarch64-fbsd-tdep.c (aarch64_fbsd_iterate_over_regset_sections): Add supply_size and collect_size. * aarch64-linux-tdep.c (aarch64_linux_iterate_over_regset_sections): Likewise. * alpha-linux-tdep.c (alpha_linux_iterate_over_regset_sections): * alpha-nbsd-tdep.c (alphanbsd_iterate_over_regset_sections): Likewise. * amd64-fbsd-tdep.c (amd64fbsd_iterate_over_regset_sections): Likewise. * amd64-linux-tdep.c (amd64_linux_iterate_over_regset_sections): Likewise. * arm-bsd-tdep.c (armbsd_iterate_over_regset_sections): Likewise. * arm-fbsd-tdep.c (arm_fbsd_iterate_over_regset_sections): Likewise. * arm-linux-tdep.c (arm_linux_iterate_over_regset_sections): Likewise. * corelow.c (get_core_registers_cb): Likewise. (core_target::fetch_registers): Likewise. * fbsd-tdep.c (fbsd_collect_regset_section_cb): Likewise. * frv-linux-tdep.c (frv_linux_iterate_over_regset_sections): Likewise. * gdbarch.h (void): Regenerate. * gdbarch.sh: Add supply_size and collect_size. * hppa-linux-tdep.c (hppa_linux_iterate_over_regset_sections): Likewise. * hppa-nbsd-tdep.c (hppanbsd_iterate_over_regset_sections): Likewise. * hppa-obsd-tdep.c (hppaobsd_iterate_over_regset_sections): Likewise. * i386-fbsd-tdep.c (i386fbsd_iterate_over_regset_sections): Likewise. * i386-linux-tdep.c (i386_linux_iterate_over_regset_sections): Likewise. * i386-tdep.c (i386_iterate_over_regset_sections): Likewise. * ia64-linux-tdep.c (ia64_linux_iterate_over_regset_sections): Likewise. * linux-tdep.c (linux_collect_regset_section_cb): Likewise. * m32r-linux-tdep.c (m32r_linux_iterate_over_regset_sections): Likewise. * m68k-bsd-tdep.c (m68kbsd_iterate_over_regset_sections): Likewise. * m68k-linux-tdep.c (m68k_linux_iterate_over_regset_sections): Likewise. * mips-fbsd-tdep.c (mips_fbsd_iterate_over_regset_sections): Likewise. * mips-linux-tdep.c (mips_linux_iterate_over_regset_sections): Likewise. * mips-nbsd-tdep.c (mipsnbsd_iterate_over_regset_sections): Likewise. * mips64-obsd-tdep.c (mips64obsd_iterate_over_regset_sections): Likewise. * mn10300-linux-tdep.c (am33_iterate_over_regset_sections): Likewise. * nios2-linux-tdep.c (nios2_iterate_over_regset_sections): Likewise. * ppc-fbsd-tdep.c (ppcfbsd_iterate_over_regset_sections): Likewise. * ppc-linux-tdep.c (ppc_linux_iterate_over_regset_sections): Likewise. * ppc-nbsd-tdep.c (ppcnbsd_iterate_over_regset_sections): Likewise. * ppc-obsd-tdep.c (ppcobsd_iterate_over_regset_sections): Likewise. * riscv-linux-tdep.c (riscv_linux_iterate_over_regset_sections): Likewise. * rs6000-aix-tdep.c (rs6000_aix_iterate_over_regset_sections): Likewise. * s390-linux-tdep.c (s390_iterate_over_regset_sections): Likewise. * score-tdep.c (score7_linux_iterate_over_regset_sections): Likewise. * sh-tdep.c (sh_iterate_over_regset_sections): Likewise. * sparc-tdep.c (sparc_iterate_over_regset_sections): Likewise. * tilegx-linux-tdep.c (tilegx_iterate_over_regset_sections): Likewise. * vax-tdep.c (vax_iterate_over_regset_sections): Likewise. * xtensa-tdep.c (xtensa_iterate_over_regset_sections): Likewise.
Diffstat (limited to 'gdb/s390-linux-tdep.c')
-rw-r--r--gdb/s390-linux-tdep.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c
index 4561559..ee8fb01 100644
--- a/gdb/s390-linux-tdep.c
+++ b/gdb/s390-linux-tdep.c
@@ -273,21 +273,22 @@ s390_iterate_over_regset_sections (struct gdbarch *gdbarch,
const int gregset_size = (tdep->abi == ABI_LINUX_S390 ?
s390_sizeof_gregset : s390x_sizeof_gregset);
- cb (".reg", gregset_size, &s390_gregset, NULL, cb_data);
- cb (".reg2", s390_sizeof_fpregset, &s390_fpregset, NULL, cb_data);
+ cb (".reg", gregset_size, gregset_size, &s390_gregset, NULL, cb_data);
+ cb (".reg2", s390_sizeof_fpregset, 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_upper_regset,
+ cb (".reg-s390-high-gprs", 16 * 4, 16 * 4, &s390_upper_regset,
"s390 GPR upper halves", cb_data);
if (tdep->have_linux_v1)
- cb (".reg-s390-last-break", 8,
+ cb (".reg-s390-last-break", 8, 8,
(gdbarch_ptr_bit (gdbarch) == 32
? &s390_last_break_regset : &s390x_last_break_regset),
"s390 last-break address", cb_data);
if (tdep->have_linux_v2)
- cb (".reg-s390-system-call", 4, &s390_system_call_regset,
+ cb (".reg-s390-system-call", 4, 4, &s390_system_call_regset,
"s390 system-call", cb_data);
/* If regcache is set, we are in "write" (gcore) mode. In this
@@ -297,14 +298,14 @@ s390_iterate_over_regset_sections (struct gdbarch *gdbarch,
&& (regcache == NULL
|| (REG_VALID
== regcache->get_register_status (S390_TDB_DWORD0_REGNUM))))
- cb (".reg-s390-tdb", s390_sizeof_tdbregset, &s390_tdb_regset,
- "s390 TDB", cb_data);
+ cb (".reg-s390-tdb", s390_sizeof_tdbregset, s390_sizeof_tdbregset,
+ &s390_tdb_regset, "s390 TDB", cb_data);
if (tdep->v0_full_regnum != -1)
{
- cb (".reg-s390-vxrs-low", 16 * 8, &s390_vxrs_low_regset,
+ cb (".reg-s390-vxrs-low", 16 * 8, 16 * 8, &s390_vxrs_low_regset,
"s390 vector registers 0-15 lower half", cb_data);
- cb (".reg-s390-vxrs-high", 16 * 16, &s390_vxrs_high_regset,
+ cb (".reg-s390-vxrs-high", 16 * 16, 16 * 16, &s390_vxrs_high_regset,
"s390 vector registers 16-31", cb_data);
}
@@ -314,12 +315,12 @@ s390_iterate_over_regset_sections (struct gdbarch *gdbarch,
{
if (regcache == NULL
|| REG_VALID == regcache->get_register_status (S390_GSD_REGNUM))
- cb (".reg-s390-gs-cb", 4 * 8, &s390_gs_regset,
+ cb (".reg-s390-gs-cb", 4 * 8, 4 * 8, &s390_gs_regset,
"s390 guarded-storage registers", cb_data);
if (regcache == NULL
|| REG_VALID == regcache->get_register_status (S390_BC_GSD_REGNUM))
- cb (".reg-s390-gs-bc", 4 * 8, &s390_gsbc_regset,
+ cb (".reg-s390-gs-bc", 4 * 8, 4 * 8, &s390_gsbc_regset,
"s390 guarded-storage broadcast control", cb_data);
}
}