6399N/A+/* Machine dependent GDB support for core files on Solaris using "regsets".
6399N/A+ Copyright (C) 2013 Free Software Foundation, Inc.
6996N/A+ This program is free software; you can redistribute it
and/or modify
6996N/A+ it under the terms of the GNU General Public License as published by
6996N/A+ the Free Software Foundation; either version 3 of the License, or
6996N/A+ (at your option) any later version.
6996N/A+ This program is distributed in the hope that it will be useful,
6996N/A+ but WITHOUT ANY WARRANTY; without even the implied warranty of
6996N/A+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6996N/A+ GNU General Public License for more details.
6996N/A+ You should have received a copy of the GNU General Public License
6996N/A+/* This file is used by Solaris core dumps. The Solaris /proc filesystem
6996N/A+ * will yield different sizes for prgregset_t prfpregset_t depending
6996N/A+ * on sizeof(void*). We handle these differences in this Solaris-specific
6399N/A+/* Prototypes for supply_gregset etc. */
6399N/A+/* Provide registers to GDB from a core file.
6399N/A+ CORE_REG_SECT points to an array of bytes, which are the contents
6399N/A+ of a `note' from a core file which BFD thinks might contain
6399N/A+ register contents. CORE_REG_SIZE is its size.
6399N/A+ WHICH says which register set corelow suspects this is:
6399N/A+ 0 --- the general-purpose register set, in gregset_t format
6399N/A+ 2 --- the floating-point register set, in fpregset_t format
6399N/A+fetch_core_registers (struct regcache *regcache,
6399N/A+ gdb_gregset_t *gregset_p = &gregset;
6399N/A+ gdb_fpregset_t *fpregset_p = &fpregset;
6399N/A+ /* use default sizes on 64-bit Solaris */
6399N/A+ size_t gregset_size = sizeof (gregset);
6399N/A+ size_t fpregset_size = sizeof (fpregset);
6399N/A+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
6399N/A+ enum bfd_endian byte_order;
6399N/A+ if (gdbarch_osabi (gdbarch) == GDB_OSABI_SOLARIS)
6399N/A+ set_regcache_from_corefile (regcache);
6399N/A+ byte_order = gdbarch_byte_order (gdbarch);
6399N/A+ pointer_size = gdbarch_ptr_bit (gdbarch);
6399N/A+ if ((byte_order == BFD_ENDIAN_BIG) && (pointer_size == 32))
6399N/A+ else if ((byte_order == BFD_ENDIAN_LITTLE) && (pointer_size == 32))
6399N/A+ if (core_reg_size != gregset_size)
6399N/A+ warning (_("Wrong size gregset in core file."));
6399N/A+ memcpy (&gregset, core_reg_sect, gregset_size);
6399N/A+ supply_gregset (regcache, (const gdb_gregset_t *) gregset_p);
6399N/A+ if (core_reg_size != fpregset_size)
6399N/A+ warning (_("Wrong size fpregset in core file."));
6399N/A+ memcpy (&fpregset, core_reg_sect, fpregset_size);
6399N/A+ if (gdbarch_fp0_regnum (get_regcache_arch (regcache)) >= 0)
6399N/A+ supply_fpregset (regcache,
6399N/A+ (const gdb_fpregset_t *) fpregset_p);
6399N/A+ /* We've covered all the kinds of registers we know about here,
6399N/A+ so this must be something we wouldn't know what to do with
6399N/A+ anyway. Just ignore it. */
6399N/A+/* Register that we are able to handle ELF core file formats using
6399N/A+ standard procfs "regset" structures. */
6399N/A+static struct core_fns regset_core_fns =
6399N/A+ bfd_target_elf_flavour, /* core_flavour */
6399N/A+ default_check_format, /* check_format */
6399N/A+ default_core_sniffer, /* core_sniffer */
6399N/A+ fetch_core_registers, /* core_read_registers */
6399N/A+/* Provide a prototype to silence -Wmissing-prototypes. */
6399N/A+extern void _initialize_core_regset (void);
6399N/A+_initialize_core_regset (void)
6399N/A+ deprecated_add_core_fns (®set_core_fns);