From 5c849b222b154cd5f481fee9d6f3971bd2eeddc2 Mon Sep 17 00:00:00 2001 From: Pedro Franco de Carvalho Date: Fri, 26 Oct 2018 09:37:53 -0300 Subject: [PATCH] [PowerPC] Don't zero-initialize vector register buffers Now that linux-tdep.c already zero-initializes the buffer used for generating core file notes, there is no need to do this in the linux collect functions for the vector regset. The memsets in gdbserver were not useful to begin with. gdb/ChangeLog: 2018-10-26 Pedro Franco de Carvalho * ppc-linux-tdep.c (ppc_linux_collect_vrregset): Remove. (ppc32_le_linux_vrregset, ppc32_be_linux_vrregset): Replace ppc_linux_collect_vrregset by regcache_collect_regset. gdb/gdbserver/ChangeLog: 2018-10-26 Pedro Franco de Carvalho * linux-ppc-low.c (ppc_fill_vrregset): Remove memset calls. --- gdb/ChangeLog | 6 ++++++ gdb/gdbserver/ChangeLog | 4 ++++ gdb/gdbserver/linux-ppc-low.c | 4 ---- gdb/ppc-linux-tdep.c | 22 ++-------------------- 4 files changed, 12 insertions(+), 24 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 411f43f..8b7323e 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,11 @@ 2018-10-26 Pedro Franco de Carvalho + * ppc-linux-tdep.c (ppc_linux_collect_vrregset): Remove. + (ppc32_le_linux_vrregset, ppc32_be_linux_vrregset): Replace + ppc_linux_collect_vrregset by regcache_collect_regset. + +2018-10-26 Pedro Franco de Carvalho + * linux-tdep.c (linux_collect_regset_section_cb): Use std::vector instead of char * and malloc for buf. Remove xfree. diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 27f7ab5..42fafac 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,7 @@ +2018-10-26 Pedro Franco de Carvalho + + * linux-ppc-low.c (ppc_fill_vrregset): Remove memset calls. + 2018-10-10 Sergio Durigan Junior Simon Marchi diff --git a/gdb/gdbserver/linux-ppc-low.c b/gdb/gdbserver/linux-ppc-low.c index 47428c1..d1ab69f 100644 --- a/gdb/gdbserver/linux-ppc-low.c +++ b/gdb/gdbserver/linux-ppc-low.c @@ -495,13 +495,9 @@ ppc_fill_vrregset (struct regcache *regcache, void *buf) if (__BYTE_ORDER == __BIG_ENDIAN) vscr_offset = 12; - /* Zero-pad the unused bytes in the fields for vscr and vrsave in - case they get displayed somewhere. */ - memset (®set[32 * 16], 0, 16); collect_register_by_name (regcache, "vscr", ®set[32 * 16 + vscr_offset]); - memset (®set[33 * 16], 0, 16); collect_register_by_name (regcache, "vrsave", ®set[33 * 16]); } diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c index 19c8092..cb117b6 100644 --- a/gdb/ppc-linux-tdep.c +++ b/gdb/ppc-linux-tdep.c @@ -444,24 +444,6 @@ ppc_linux_collect_gregset (const struct regset *regset, } } -static void -ppc_linux_collect_vrregset (const struct regset *regset, - const struct regcache *regcache, - int regnum, void *buf, size_t len) -{ - gdb_byte *vrregs = (gdb_byte *) buf; - - /* Zero-pad the unused bytes in the fields for vscr and vrsave - in case they get displayed somewhere (e.g. in core files). */ - if (regnum == PPC_VSCR_REGNUM || regnum == -1) - memset (&vrregs[32 * 16], 0, 16); - - if (regnum == PPC_VRSAVE_REGNUM || regnum == -1) - memset (&vrregs[33 * 16], 0, 16); - - regcache_collect_regset (regset, regcache, regnum, buf, len); -} - /* Regset descriptions. */ static const struct ppc_reg_offsets ppc32_linux_reg_offsets = { @@ -544,13 +526,13 @@ static const struct regcache_map_entry ppc32_be_linux_vrregmap[] = static const struct regset ppc32_le_linux_vrregset = { ppc32_le_linux_vrregmap, regcache_supply_regset, - ppc_linux_collect_vrregset + regcache_collect_regset }; static const struct regset ppc32_be_linux_vrregset = { ppc32_be_linux_vrregmap, regcache_supply_regset, - ppc_linux_collect_vrregset + regcache_collect_regset }; static const struct regcache_map_entry ppc32_linux_vsxregmap[] = -- 2.7.4