2004-04-22 21:13:06 +00:00
|
|
|
|
/* Target-dependent code for OpenBSD/powerpc.
|
|
|
|
|
|
2008-01-01 22:53:26 +00:00
|
|
|
|
Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
|
2004-04-22 21:13:06 +00:00
|
|
|
|
|
|
|
|
|
This file is part of GDB.
|
|
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
2007-08-23 18:08:50 +00:00
|
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
2004-04-22 21:13:06 +00:00
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
2007-08-23 18:08:50 +00:00
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
2004-04-22 21:13:06 +00:00
|
|
|
|
|
|
|
|
|
#include "defs.h"
|
|
|
|
|
#include "arch-utils.h"
|
2005-08-21 10:47:48 +00:00
|
|
|
|
#include "frame.h"
|
|
|
|
|
#include "frame-unwind.h"
|
* avr-tdep.c, hppa-tdep.c, hppabsd-tdep.c, i386-tdep.c,
ia64-tdep.c, m68k-tdep.c, mips-linux-tdep.c, ppcobsd-tdep.c,
sparc-linux-tdep.c: Include "gdbtypes.h" instead of "floatformat.h".
* Makefile.in (avr-tdep.o, hppabsd-tdep.o, hppa-tdep.o, i386-tdep.o)
(ia64-tdep.o, m68k-tdep.o, mips-linux-tdep.o, ppcobsd-tdep.o)
(sparc-linux-tdep.o): Update.
2007-02-16 21:49:59 +00:00
|
|
|
|
#include "gdbtypes.h"
|
2004-04-22 21:13:06 +00:00
|
|
|
|
#include "osabi.h"
|
|
|
|
|
#include "regcache.h"
|
|
|
|
|
#include "regset.h"
|
2005-08-21 10:47:48 +00:00
|
|
|
|
#include "symtab.h"
|
2005-04-09 11:39:38 +00:00
|
|
|
|
#include "trad-frame.h"
|
2004-04-22 21:13:06 +00:00
|
|
|
|
|
2005-04-09 11:39:38 +00:00
|
|
|
|
#include "gdb_assert.h"
|
2004-04-22 21:13:06 +00:00
|
|
|
|
#include "gdb_string.h"
|
|
|
|
|
|
|
|
|
|
#include "ppc-tdep.h"
|
|
|
|
|
#include "ppcobsd-tdep.h"
|
|
|
|
|
#include "solib-svr4.h"
|
|
|
|
|
|
|
|
|
|
/* Register offsets from <machine/reg.h>. */
|
|
|
|
|
struct ppc_reg_offsets ppcobsd_reg_offsets;
|
2006-05-15 21:53:20 +00:00
|
|
|
|
struct ppc_reg_offsets ppcobsd_fpreg_offsets;
|
2004-04-22 21:13:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Core file support. */
|
|
|
|
|
|
|
|
|
|
/* Supply register REGNUM in the general-purpose register set REGSET
|
|
|
|
|
from the buffer specified by GREGS and LEN to register cache
|
|
|
|
|
REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
ppcobsd_supply_gregset (const struct regset *regset,
|
|
|
|
|
struct regcache *regcache, int regnum,
|
|
|
|
|
const void *gregs, size_t len)
|
|
|
|
|
{
|
|
|
|
|
ppc_supply_gregset (regset, regcache, regnum, gregs, len);
|
|
|
|
|
ppc_supply_fpregset (regset, regcache, regnum, gregs, len);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Collect register REGNUM in the general-purpose register set
|
|
|
|
|
REGSET. from register cache REGCACHE into the buffer specified by
|
|
|
|
|
GREGS and LEN. If REGNUM is -1, do this for all registers in
|
|
|
|
|
REGSET. */
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
ppcobsd_collect_gregset (const struct regset *regset,
|
|
|
|
|
const struct regcache *regcache, int regnum,
|
|
|
|
|
void *gregs, size_t len)
|
|
|
|
|
{
|
|
|
|
|
ppc_collect_gregset (regset, regcache, regnum, gregs, len);
|
|
|
|
|
ppc_collect_fpregset (regset, regcache, regnum, gregs, len);
|
|
|
|
|
}
|
|
|
|
|
|
2005-04-16 21:08:21 +00:00
|
|
|
|
/* OpenBSD/powerpc register set. */
|
2004-04-22 21:13:06 +00:00
|
|
|
|
|
|
|
|
|
struct regset ppcobsd_gregset =
|
|
|
|
|
{
|
|
|
|
|
&ppcobsd_reg_offsets,
|
|
|
|
|
ppcobsd_supply_gregset
|
|
|
|
|
};
|
|
|
|
|
|
2006-05-15 21:53:20 +00:00
|
|
|
|
struct regset ppcobsd_fpregset =
|
|
|
|
|
{
|
|
|
|
|
&ppcobsd_fpreg_offsets,
|
|
|
|
|
ppc_supply_fpregset
|
|
|
|
|
};
|
|
|
|
|
|
2004-04-22 21:13:06 +00:00
|
|
|
|
/* Return the appropriate register set for the core section identified
|
|
|
|
|
by SECT_NAME and SECT_SIZE. */
|
|
|
|
|
|
|
|
|
|
static const struct regset *
|
|
|
|
|
ppcobsd_regset_from_core_section (struct gdbarch *gdbarch,
|
|
|
|
|
const char *sect_name, size_t sect_size)
|
|
|
|
|
{
|
|
|
|
|
if (strcmp (sect_name, ".reg") == 0 && sect_size >= 412)
|
|
|
|
|
return &ppcobsd_gregset;
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2005-04-09 11:39:38 +00:00
|
|
|
|
/* Signal trampolines. */
|
|
|
|
|
|
2005-08-21 10:47:48 +00:00
|
|
|
|
/* Since OpenBSD 3.2, the sigtramp routine is mapped at a random page
|
|
|
|
|
in virtual memory. The randomness makes it somewhat tricky to
|
|
|
|
|
detect it, but fortunately we can rely on the fact that the start
|
|
|
|
|
of the sigtramp routine is page-aligned. We recognize the
|
|
|
|
|
trampoline by looking for the code that invokes the sigreturn
|
|
|
|
|
system call. The offset where we can find that code varies from
|
|
|
|
|
release to release.
|
|
|
|
|
|
|
|
|
|
By the way, the mapping mentioned above is read-only, so you cannot
|
|
|
|
|
place a breakpoint in the signal trampoline. */
|
|
|
|
|
|
|
|
|
|
/* Default page size. */
|
|
|
|
|
static const int ppcobsd_page_size = 4096;
|
|
|
|
|
|
|
|
|
|
/* Offset for sigreturn(2). */
|
|
|
|
|
static const int ppcobsd_sigreturn_offset[] = {
|
|
|
|
|
0x98, /* OpenBSD 3.8 */
|
|
|
|
|
0x0c, /* OpenBSD 3.2 */
|
|
|
|
|
-1
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static int
|
2008-05-01 00:40:39 +00:00
|
|
|
|
ppcobsd_sigtramp_frame_sniffer (const struct frame_unwind *self,
|
|
|
|
|
struct frame_info *this_frame,
|
|
|
|
|
void **this_cache)
|
2005-08-21 10:47:48 +00:00
|
|
|
|
{
|
2008-05-01 00:40:39 +00:00
|
|
|
|
CORE_ADDR pc = get_frame_pc (this_frame);
|
2005-08-21 10:47:48 +00:00
|
|
|
|
CORE_ADDR start_pc = (pc & ~(ppcobsd_page_size - 1));
|
|
|
|
|
const int *offset;
|
|
|
|
|
char *name;
|
|
|
|
|
|
|
|
|
|
find_pc_partial_function (pc, &name, NULL, NULL);
|
|
|
|
|
if (name)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
for (offset = ppcobsd_sigreturn_offset; *offset != -1; offset++)
|
|
|
|
|
{
|
|
|
|
|
gdb_byte buf[2 * PPC_INSN_SIZE];
|
|
|
|
|
unsigned long insn;
|
|
|
|
|
|
2008-05-01 00:40:39 +00:00
|
|
|
|
if (!safe_frame_unwind_memory (this_frame, start_pc + *offset,
|
2005-08-21 10:47:48 +00:00
|
|
|
|
buf, sizeof buf))
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
/* Check for "li r0,SYS_sigreturn". */
|
|
|
|
|
insn = extract_unsigned_integer (buf, PPC_INSN_SIZE);
|
|
|
|
|
if (insn != 0x38000067)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
/* Check for "sc". */
|
|
|
|
|
insn = extract_unsigned_integer (buf + PPC_INSN_SIZE, PPC_INSN_SIZE);
|
|
|
|
|
if (insn != 0x44000002)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static struct trad_frame_cache *
|
2008-05-01 00:40:39 +00:00
|
|
|
|
ppcobsd_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
|
2005-04-09 11:39:38 +00:00
|
|
|
|
{
|
2008-05-01 00:40:39 +00:00
|
|
|
|
struct gdbarch *gdbarch = get_frame_arch (this_frame);
|
2005-04-09 11:39:38 +00:00
|
|
|
|
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
|
2005-08-21 10:47:48 +00:00
|
|
|
|
struct trad_frame_cache *cache;
|
|
|
|
|
CORE_ADDR addr, base, func;
|
|
|
|
|
gdb_byte buf[PPC_INSN_SIZE];
|
|
|
|
|
unsigned long insn, sigcontext_offset;
|
2005-04-09 11:39:38 +00:00
|
|
|
|
int i;
|
|
|
|
|
|
2005-08-21 10:47:48 +00:00
|
|
|
|
if (*this_cache)
|
|
|
|
|
return *this_cache;
|
|
|
|
|
|
2008-05-01 00:40:39 +00:00
|
|
|
|
cache = trad_frame_cache_zalloc (this_frame);
|
2005-08-21 10:47:48 +00:00
|
|
|
|
*this_cache = cache;
|
|
|
|
|
|
2008-05-01 00:40:39 +00:00
|
|
|
|
func = get_frame_pc (this_frame);
|
2005-08-21 10:47:48 +00:00
|
|
|
|
func &= ~(ppcobsd_page_size - 1);
|
2008-05-01 00:40:39 +00:00
|
|
|
|
if (!safe_frame_unwind_memory (this_frame, func, buf, sizeof buf))
|
2005-08-21 10:47:48 +00:00
|
|
|
|
return cache;
|
|
|
|
|
|
|
|
|
|
/* Calculate the offset where we can find `struct sigcontext'. We
|
|
|
|
|
base our calculation on the amount of stack space reserved by the
|
|
|
|
|
first instruction of the signal trampoline. */
|
|
|
|
|
insn = extract_unsigned_integer (buf, PPC_INSN_SIZE);
|
|
|
|
|
sigcontext_offset = (0x10000 - (insn & 0x0000ffff)) + 8;
|
|
|
|
|
|
2008-05-01 00:40:39 +00:00
|
|
|
|
base = get_frame_register_unsigned (this_frame, gdbarch_sp_regnum (gdbarch));
|
2005-08-21 10:47:48 +00:00
|
|
|
|
addr = base + sigcontext_offset + 2 * tdep->wordsize;
|
2005-04-09 11:39:38 +00:00
|
|
|
|
for (i = 0; i < ppc_num_gprs; i++, addr += tdep->wordsize)
|
|
|
|
|
{
|
|
|
|
|
int regnum = i + tdep->ppc_gp0_regnum;
|
2005-08-21 10:47:48 +00:00
|
|
|
|
trad_frame_set_reg_addr (cache, regnum, addr);
|
2005-04-09 11:39:38 +00:00
|
|
|
|
}
|
2005-08-21 10:47:48 +00:00
|
|
|
|
trad_frame_set_reg_addr (cache, tdep->ppc_lr_regnum, addr);
|
2005-04-09 11:39:38 +00:00
|
|
|
|
addr += tdep->wordsize;
|
2005-08-21 10:47:48 +00:00
|
|
|
|
trad_frame_set_reg_addr (cache, tdep->ppc_cr_regnum, addr);
|
2005-04-09 11:39:38 +00:00
|
|
|
|
addr += tdep->wordsize;
|
2005-08-21 10:47:48 +00:00
|
|
|
|
trad_frame_set_reg_addr (cache, tdep->ppc_xer_regnum, addr);
|
2005-04-09 11:39:38 +00:00
|
|
|
|
addr += tdep->wordsize;
|
2005-08-21 10:47:48 +00:00
|
|
|
|
trad_frame_set_reg_addr (cache, tdep->ppc_ctr_regnum, addr);
|
2005-04-09 11:39:38 +00:00
|
|
|
|
addr += tdep->wordsize;
|
2007-11-16 Markus Deuling <deuling@de.ibm.com>
* m32r-rom.c (m32r_supply_register): Use get_regcache_arch to get at
the current architecture by regcache.
* ppcnbsd-nat.c (ppcnbsd_supply_pcb): Likewise.
* ppc-linux-nat.c (fetch_altivec_register, fetch_spe_register)
(fetch_register, supply_vrregset, fetch_ppc_registers)
(store_altivec_register, store_spe_register, store_register)
(fill_vrregset, store_ppc_registers): Likewise.
* ppcobsd-nat.c (ppcobsd_supply_pcb): Likewise.
* win32-nat.c (do_win32_fetch_inferior_registers)
(do_win32_store_inferior_registers): Likewise.
* procfs.c (procfs_fetch_registers, procfs_store_registers): Likewise.
* remote-m32r-sdi.c (m32r_fetch_registers)
(m32r_store_registers): Likewise.
* remote-sim.c (gdbsim_fetch_register, gdbsim_store_register): Likewise.
* trad-frame.c (trad_frame_alloc_saved_regs): Replace current_gdbarch by
gdbarch.
* user-regs.c (user_reg_map_name_to_regnum): Likewise.
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call)
(do_ppc_sysv_return_value, ppc64_sysv_abi_push_dummy_call)
(ppc64_sysv_abi_return_value): Likewise.
* m32c-tdep.c (m32c_register_reggroup_p): Likewise.
* m2-lang.c (build_m2_types): Likewise.
* ppc-linux-tdep.c (ppc_linux_sigtramp_cache
* ppcnbsd-tdep.c (ppcnbsd_sigtramp_cache_init): Likewise.
* ppcobsd-tdep.c (ppcobsd_sigtramp_frame_cache): Likewise.
* rs6000-tdep.c (ppc_dwarf2_frame_init_reg): Likewise.
* m68hc11-tdep.c (m68hc11_frame_unwind_cache): Use get_frame_arch to
get at the current architecture by frame_info.
* gcore.c (derive_stack_segment): Likewise.
* shnbsd-nat.c (GETREGS_SUPPLIES): Add gdbarch parameter.
(shnbsd_fetch_inferior_registers, shnbsd_store_inferior_registers): Add
gdbarch to GETREGS_SUPPLIES call.
2007-11-16 04:53:46 +00:00
|
|
|
|
trad_frame_set_reg_addr (cache, gdbarch_pc_regnum (gdbarch), addr);
|
2007-06-18 Markus Deuling <deuling@de.ibm.com>
* gdbarch.sh (SP_REGNUM): Replace by gdbarch_sp_regnum.
* v850-tdep.c (v850_unwind_sp): Likewise.
* std-regs.c (value_of_builtin_frame_sp_reg): Likewise.
* stack.c (frame_info): Likewise.
* stabsread.c (define_symbol): Likewise.
* sh-tdep.c (sh_push_dummy_call_fpu, sh_push_dummy_call_nofpu)
(sh_dwarf2_frame_init_reg, sh_frame_cache, sh_frame_prev_register)
(sh_unwind_sp): Likewise.
* sh64-tdep.c (sh64_push_dummy_call, sh64_frame_cache)
(sh64_frame_prev_register, sh64_unwind_sp): Likewise.
* rs6000-tdep.c (rs6000_push_dummy_call, rs6000_unwind_dummy_id)
(rs6000_frame_cache): Likewise.
* rs6000-nat.c (store_register): Likewise.
* remote-mips.c (mips_wait): Likewise.
* procfs.c (procfs_fetch_registers, procfs_store_registers): Likewise.
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call)
(ppc64_sysv_abi_push_dummy_call): Likewise.
* ppcobsd-tdep.c (ppcobsd_sigtramp_frame_cache): Likewise.
* ppcobsd-nat.c (ppcobsd_supply_pcb): Likewise.
* ppcnbsd-tdep.c (ppcnbsd_sigtramp_cache_init): Likewise.
* ppc-linux-tdep.c (ppc_linux_sigtramp_cache): Likewise.
* m32r-rom.c (m32r_supply_register): Likewise.
* frame.c (frame_sp_unwind): Likewise.
* mips-tdep.c (mips_insn16_frame_cache)
(mips_insn32_frame_cache): Likewise (comment).
* m68klinux-nat.c (supply_gregset): Likewise.
* m68k-tdep.c (m68k_get_longjmp_target): Likewise.
* ia64-tdep.c (ia64_frame_prev_register): Likewise.
* i386-tdep.c (i386_get_longjmp_target): Likewise.
* dwarf2-frame.c (dwarf2_frame_default_init_reg): Likewise.
* cris-tdep.c (cris_regnums, cris_sigcontext_addr)
(cris_sigtramp_frame_unwind_cache, cris_push_dummy_call)
(cris_scan_prologue, crisv32_scan_prologue, cris_unwind_sp)
(cris_register_type, crisv32_register_type)
(cris_dwarf2_frame_init_reg): Likewise.
* arch-utils.c (legacy_virtual_frame_pointer): Likewise.
* amd64-tdep.c (amd64_frame_prev_register): Likewise.
* amd64-linux-tdep.c (amd64_linux_sigcontext_addr): Likewise.
* libunwind-frame.c (libunwind_frame_cache): Likewise.
* gdbarch.sh (PC_REGNUM): Replace by gdbarch_pc_regnum.
* regcache.c (read_pc_pid, generic_target_write_pc): Likewise.
* xtensa-tdep.c (xtensa_register_type, xtensa_supply_gregset)
(xtensa_unwind_pc, xtensa_frame_cache, xtensa_frame_prev_register)
(xtensa_extract_return_value, xtensa_store_return_value): Likewise.
* v850-tdep.c (v850_unwind_pc): Likewise.
* stack.c (frame_info): Likewise.
* sh-tdep.c (sh_generic_show_regs, sh3_show_regs, sh2e_show_regs)
(sh2a_show_regs, sh2a_nofpu_show_regs, sh3e_show_regs)
(sh3_dsp_show_regs, sh4_show_regs, sh4_nofpu_show_regs)
(sh_dwarf2_frame_init_reg, sh_frame_prev_register, sh_unwind_pc)
(sh_dsp_show_regs): Likewise.
* shnbsd-tdep.c (shnbsd_supply_gregset)
(shnbsd_collect_gregset): Likewise.
* shnbsd-nat.c (GETREGS_SUPPLIES): Likewise.
* sh64-tdep.c (sh64_compact_reg_base_num, sh64_show_media_regs)
(sh64_frame_prev_register, sh64_unwind_pc): Likewise.
* rs6000-tdep.c (ppc_supply_gregset, ppc_collect_gregset)
(6000_register_reggroup_p, rs6000_unwind_pc)
(rs6000_frame_cache): Likewise.
* rs6000-nat.c (regmap, rs6000_fetch_inferior_registers)
(rs6000_store_inferior_registers): Likewise.
* remote-mips.c (mips_wait, mips_load): Likewise.
* procfs.c (procfs_fetch_registers, procfs_store_registers): Likewise.
* ppcobsd-tdep.c (ppcobsd_sigtramp_frame_cache): Likewise.
* ppcobsd-nat.c (ppcobsd_supply_pcb): Likewise.
* ppcnbsd-tdep.c (ppcnbsd_sigtramp_cache_init): Likewise.
* ppcnbsd-nat.c (getregs_supplies, ppcnbsd_supply_pcb): Likewise.
* ppc-linux-tdep.c (ppc_linux_sigtramp_cache): Likewise.
* ppc-linux-nat.c (ppc_register_u_addr, fetch_ppc_registers)
(store_ppc_registers, fill_gregset): Likewise.
* mips-tdep.c (mips_stub_frame_cache, mips_gdbarch_init): Likewise.
* mipsnbsd-tdep.c (mipsnbsd_supply_reg, mipsnbsd_fill_reg): Likewise.
* mipsnbsd-nat.c (getregs_supplies): Likewise.
* m68k-tdep.c (m68k_register_type, m68k_unwind_pc): Likewise.
* m68klinux-nat.c (supply_gregset): Likewise.
* irix5-nat.c (fill_gregset): Likewise.
* i386-tdep.c (i386_unwind_pc): Likewise.
* i386-linux-nat.c (i386_linux_resume): Likewise.
* frame.c (get_prev_frame_1): Likewise.
* dwarf2-frame.c (dwarf2_frame_default_init_reg): Likewise.
* dbug-rom.c (dbug_supply_register): Likewise.
* cris-tdep.c (cris_sigtramp_frame_unwind_cache, cris_scan_prologue)
(crisv32_scan_prologue, cris_unwind_pc, cris_register_size)
(cris_register_type, crisv32_register_type, crisv32_register_name)
(cris_dwarf2_frame_init_reg, find_step_target)
(cris_software_single_step, cris_supply_gregset)
(cris_regnums): Likewise.
* alpha-linux-nat.c (alpha_linux_register_u_offset): Likewise.
* aix-thread.c (special_register_p, supply_sprs64, supply_sprs32)
(fill_sprs64, fill_sprs32, store_regs_user_thread): Likewise.
* mips-linux-tdep.c (mips_linux_write_pc): Likewise.
* gdbarch.sh (PS_REGNUM): Replace by gdbarch_ps_regnum.
* dbug-rom.c (dbug_supply_register): Likewise.
* xtensa-tdep.c (xtensa_supply_gregset, xtensa_frame_cache)
(xtensa_frame_prev_register, xtensa_push_dummy_call): Likewise.
* win32-nat.c (win32_resume): Likewise.
* std-regs.c (value_of_builtin_frame_ps_reg)
(value_of_builtin_frame_pc_reg): Likewise.
* m68k-tdep.c (m68k_register_type): Likewise.
* m68klinux-nat.c (supply_gregset): Likewise.
* gdbarch.sh (FP0_REGNUM): Replace by gdbarch_fp0_regnum.
* sh-tdep.c (sh_extract_return_value_fpu, sh_store_return_value_fpu)
(sh2e_show_regs, sh2a_show_regs, sh3e_show_regs, sh4_show_regs)
(sh_sh2a_register_type, sh_sh3e_register_type, sh_sh4_register_type)
(fv_reg_base_num, dr_reg_base_num): Likewise.
* sh64-tdep.c (sh64_fv_reg_base_num, sh64_dr_reg_base_num)
(sh64_fpp_reg_base_num, sh64_compact_reg_base_num, sh64_push_dummy_call)
(sh64_extract_return_value, sh64_store_return_value)
(sh64_show_media_regs, sh64_show_compact_regs, sh64_register_type)
(sh64_do_fp_register, sh64_media_print_registers_info): Likewise.
* procfs.c (procfs_fetch_registers, procfs_store_registers)
(invalidate_cache): Likewise.
* ppc-linux-tdep.c (ppc_linux_sigtramp_cache): Likewise.
* mipsnbsd-tdep.c (mipsnbsd_supply_fpreg)
(mipsnbsd_fill_fpreg): Likewise.
* mipsnbsd-nat.c (mipsnbsd_fetch_inferior_registers)
(mipsnbsd_store_inferior_registers): Likewise.
* mips-linux-tdep.c (mips_supply_fpregset, mips_fill_fpregset)
(mips64_supply_fpregset, mips64_fill_fpregset): Likewise.
* mips-linux-nat.c (mips64_linux_register_addr): Likewise.
* m68k-tdep.c (m68k_register_type, m68k_convert_register_p): Likewise.
* m68klinux-nat.c (getfpregs_supplies, supply_fpregset)
(fill_fpregset): Likewise.
* irix5-nat.c (supply_fpregset, fill_fpregset): Likewise.
* i386-tdep.h (struct_return): Likewise (comment).
* i386-nto-tdep.c (i386nto_register_area): Likewise.
* go32-nat.c (fetch_register, go32_fetch_registers, store_register)
(go32_store_registers): Likewise.
* alpha-tdep.c (alpha_next_pc): Likewise.
* alpha-linux-nat.c (alpha_linux_register_u_offset): Likewise.
* alphabsd-nat.c (alphabsd_fetch_inferior_registers)
(alphabsd_store_inferior_registers): Likewise.
* core-regset.c (fetch_core_registers): Likewise.
* i386v4-nat.c (supply_fpregset, fill_fpregset): Likewise.
* gdbarch.c, gdbarch.h: Regenerate.
2007-06-18 17:45:26 +00:00
|
|
|
|
/* SRR0? */
|
2005-04-09 11:39:38 +00:00
|
|
|
|
addr += tdep->wordsize;
|
|
|
|
|
|
|
|
|
|
/* Construct the frame ID using the function start. */
|
2005-08-21 10:47:48 +00:00
|
|
|
|
trad_frame_set_id (cache, frame_id_build (base, func));
|
|
|
|
|
|
|
|
|
|
return cache;
|
2005-04-09 11:39:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
2005-08-21 10:47:48 +00:00
|
|
|
|
static void
|
2008-05-01 00:40:39 +00:00
|
|
|
|
ppcobsd_sigtramp_frame_this_id (struct frame_info *this_frame,
|
2005-08-21 10:47:48 +00:00
|
|
|
|
void **this_cache, struct frame_id *this_id)
|
|
|
|
|
{
|
|
|
|
|
struct trad_frame_cache *cache =
|
2008-05-01 00:40:39 +00:00
|
|
|
|
ppcobsd_sigtramp_frame_cache (this_frame, this_cache);
|
2005-08-21 10:47:48 +00:00
|
|
|
|
|
|
|
|
|
trad_frame_get_id (cache, this_id);
|
|
|
|
|
}
|
|
|
|
|
|
2008-05-01 00:40:39 +00:00
|
|
|
|
static struct value *
|
|
|
|
|
ppcobsd_sigtramp_frame_prev_register (struct frame_info *this_frame,
|
|
|
|
|
void **this_cache, int regnum)
|
2005-04-09 11:39:38 +00:00
|
|
|
|
{
|
2005-08-21 10:47:48 +00:00
|
|
|
|
struct trad_frame_cache *cache =
|
2008-05-01 00:40:39 +00:00
|
|
|
|
ppcobsd_sigtramp_frame_cache (this_frame, this_cache);
|
2005-08-21 10:47:48 +00:00
|
|
|
|
|
2008-05-01 00:40:39 +00:00
|
|
|
|
return trad_frame_get_register (cache, this_frame, regnum);
|
2005-08-21 10:47:48 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static const struct frame_unwind ppcobsd_sigtramp_frame_unwind = {
|
2005-04-09 11:39:38 +00:00
|
|
|
|
SIGTRAMP_FRAME,
|
2005-08-21 10:47:48 +00:00
|
|
|
|
ppcobsd_sigtramp_frame_this_id,
|
2008-05-01 00:40:39 +00:00
|
|
|
|
ppcobsd_sigtramp_frame_prev_register,
|
|
|
|
|
NULL,
|
|
|
|
|
ppcobsd_sigtramp_frame_sniffer
|
2005-04-09 11:39:38 +00:00
|
|
|
|
};
|
|
|
|
|
|
2005-04-16 21:08:21 +00:00
|
|
|
|
|
2004-04-22 21:13:06 +00:00
|
|
|
|
static void
|
|
|
|
|
ppcobsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
|
|
|
|
{
|
2005-04-16 21:37:02 +00:00
|
|
|
|
/* OpenBSD doesn't support the 128-bit `long double' from the psABI. */
|
|
|
|
|
set_gdbarch_long_double_bit (gdbarch, 64);
|
* doublest.c (floatformat_from_length): Use the right element from
gdbarch floatformats.
(floatformat_from_type, extract_typed_floating)
(store_typed_floating): Likewise.
* doublest.h: Remove declarations for undefined floatformat arrays.
* gdbarch.sh (float_format, double_format, long_double_format): Change
to pairs.
(pformat): Update for pairs.
* gdbarch.c, gdbarch.h: Regenerated.
* gdbtypes.c (floatformats_ieee_single, floatformats_ieee_double)
(floatformats_ieee_double_littlebyte_bigword)
(floatformats_i387_ext, floatformats_m68881_ext, floatformats_arm_ext)
(floatformats_ia64_spill, floatformats_ia64_quad, floatformats_vax_f)
(floatformats_vax_d): New variables.
(builtin_type_ieee_single, builtin_type_ieee_double)
(builtin_type_arm_ext, builtin_type_ia64_spill)
(builtin_type_ia64_quad): Replace arrays with individual types.
(builtin_type_ieee_single_big, builtin_type_ieee_single_little)
(builtin_type_ieee_double_big, builtin_type_ieee_double_little)
(builtin_type_ieee_double_littlebyte_bigword, builtin_type_i960_ext)
(builtin_type_m88110_ext, builtin_type_m88110_harris_ext)
(builtin_type_arm_ext_big, builtin_type_arm_ext_littlebyte_bigword)
(builtin_type_ia64_spill_big, builtin_type_ia64_spill_little)
(builtin_type_ia64_quad_big, builtin_type_ia64_quad_little): Delete
unused and endian-specific types.
(recursive_dump_type): Update for floatformat pairs.
(build_flt): Move higher. Handle bit == -1. Take a floatformat pair.
(build_gdbtypes): Use build_flt.
(_initialize_gdbtypes): Update set of initialized types.
* gdbtypes.h: Update declarations to match gdbtypes.c.
(struct main_type): Store a pointer to two floatformats.
* arch-utils.c (default_float_format, default_double_format): Delete.
* arch-utils.h (default_float_format, default_double_format): Delete.
* arm-tdep.c, avr-tdep.c, hppa-tdep.c, hppabsd-tdep.c, i386-tdep.c,
ia64-tdep.c, iq2000-tdep.c, m68k-tdep.c, m88k-tdep.c,
mips-linux-tdep.c, mips-tdep.c, mt-tdep.c, ppcobsd-tdep.c,
sparc-linux-tdep.c, sparc-tdep.c, sparcnbsd-tdep.c, spu-tdep.c,
vax-tdep.c, alpha-tdep.c, ppc-sysv-tdep.c: Update.
2007-01-29 17:31:06 +00:00
|
|
|
|
set_gdbarch_long_double_format (gdbarch, floatformats_ieee_double);
|
2005-04-16 21:37:02 +00:00
|
|
|
|
|
2005-04-22 20:29:14 +00:00
|
|
|
|
/* OpenBSD currently uses a broken GCC. */
|
|
|
|
|
set_gdbarch_return_value (gdbarch, ppc_sysv_abi_broken_return_value);
|
|
|
|
|
|
2004-04-22 21:13:06 +00:00
|
|
|
|
/* OpenBSD uses SVR4-style shared libraries. */
|
|
|
|
|
set_solib_svr4_fetch_link_map_offsets
|
|
|
|
|
(gdbarch, svr4_ilp32_fetch_link_map_offsets);
|
|
|
|
|
|
|
|
|
|
set_gdbarch_regset_from_core_section
|
|
|
|
|
(gdbarch, ppcobsd_regset_from_core_section);
|
2005-04-09 11:39:38 +00:00
|
|
|
|
|
2008-05-01 00:40:39 +00:00
|
|
|
|
frame_unwind_append_unwinder (gdbarch, &ppcobsd_sigtramp_frame_unwind);
|
2004-04-22 21:13:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* OpenBSD uses uses the traditional NetBSD core file format, even for
|
|
|
|
|
ports that use ELF. */
|
|
|
|
|
#define GDB_OSABI_NETBSD_CORE GDB_OSABI_OPENBSD_ELF
|
|
|
|
|
|
|
|
|
|
static enum gdb_osabi
|
|
|
|
|
ppcobsd_core_osabi_sniffer (bfd *abfd)
|
|
|
|
|
{
|
|
|
|
|
if (strcmp (bfd_get_target (abfd), "netbsd-core") == 0)
|
|
|
|
|
return GDB_OSABI_NETBSD_CORE;
|
|
|
|
|
|
|
|
|
|
return GDB_OSABI_UNKNOWN;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Provide a prototype to silence -Wmissing-prototypes. */
|
|
|
|
|
void _initialize_ppcobsd_tdep (void);
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
_initialize_ppcobsd_tdep (void)
|
|
|
|
|
{
|
|
|
|
|
/* BFD doesn't set a flavour for NetBSD style a.out core files. */
|
|
|
|
|
gdbarch_register_osabi_sniffer (bfd_arch_powerpc, bfd_target_unknown_flavour,
|
|
|
|
|
ppcobsd_core_osabi_sniffer);
|
|
|
|
|
|
2005-04-16 21:08:21 +00:00
|
|
|
|
gdbarch_register_osabi (bfd_arch_rs6000, 0, GDB_OSABI_OPENBSD_ELF,
|
|
|
|
|
ppcobsd_init_abi);
|
2004-04-22 21:13:06 +00:00
|
|
|
|
gdbarch_register_osabi (bfd_arch_powerpc, 0, GDB_OSABI_OPENBSD_ELF,
|
|
|
|
|
ppcobsd_init_abi);
|
|
|
|
|
|
|
|
|
|
/* Avoid initializing the register offsets again if they were
|
|
|
|
|
already initailized by ppcobsd-nat.c. */
|
|
|
|
|
if (ppcobsd_reg_offsets.pc_offset == 0)
|
|
|
|
|
{
|
|
|
|
|
/* General-purpose registers. */
|
|
|
|
|
ppcobsd_reg_offsets.r0_offset = 0;
|
* ppc-linux-nat.c (right_fill_reg): Delete.
(supply_gregset): Use ppc_supply_gregset.
(supply_fpregset): Use ppc_supply_fpregset.
(fill_gregset): Use ppc_collect_gregset.
(fill_fpregset): Use ppc_collect_fpregset.
* ppc-linux-tdep.c (PPC_LINUX_PT_*): Don't define.
(right_supply_register, ppc_linux_supply_gregset): Delete.
(ppc32_linux_supply_gregset, ppc64_linux_supply_gregset): Delete.
(ppc_linux_supply_fpregset): Delete.
(ppc_linux_collect_gregset): New function.
(ppc32_linux_reg_offsets, ppc64_linux_reg_offsets): New.
(ppc32_linux_gregset, ppc64_linux_gregset): Update to use reg offsets,
ppc_linux_supply_gregset, and ppc_collect_gregset.
(ppc_linux_fpregset): Rename to ppc32_linux_fpregset and update.
(ppc_linux_gregset, ppc_linux_fpregset): New functions.
(ppc_linux_regset_from_core_section): Update.
* ppc-tdep.h (ppc_linux_gregset, ppc_linux_fpregset): Declare.
(ppc_linux_supply_gregset, ppc_linux_supply_fpregset): Delete.
(struct ppc_reg_offsets): Add gpr_size, xr_size, fpscr_size fields.
* ppcobsd-tdep.c (ppcobsd_supply_gregset): Delete FIXME and assert.
(ppcobsd_collect_gregset): Likewise.
(_initialize_ppcnbsd_tdep): Init gpr_size, xr_size, fpscr_size.
* ppcnbsd-tdep.c (_initialize_ppcobsd_tdep): Likewise.
* ppcobsd-nat.c (_initialize_ppcobsd_nat): Likewise.
* rs6000-aix-tdep.c (rs6000_aix32_reg_offsets): Likewise.
(rs6000_aix64_reg_offsets): Likewise.
(rs6000_aix_supply_regset): Call ppc_supply_fpregset without testing
ppc_floating_point_unit_p.
(rs6000_aix_collect_regset): Similarly.
* rs6000-tdep.c (ppc_supply_reg): Add regsize param. Adjust offset
when regsize is larger than regcache register size.
(ppc_collect_reg): Similarly zero pad when regsize is larger than
regcache register size.
(ppc_greg_offset): New function, split out from..
(ppc_supply_gregset): ..here. Separate code handling all regs from
single reg case. Correct xer offset.
(ppc_fpreg_offset): New function, split out from..
(ppc_supply_fpregset): ..here. Separate code handling all regs from
single reg case.
(ppc_collect_gregset, ppc_collect_fpregset): Likewise.
(ppc_supply_fpregset, ppc_collect_fpregset): Don't assert we have
a fp unit, instead return if no fp.
2007-08-30 13:13:59 +00:00
|
|
|
|
ppcobsd_reg_offsets.gpr_size = 4;
|
|
|
|
|
ppcobsd_reg_offsets.xr_size = 4;
|
2004-04-22 21:13:06 +00:00
|
|
|
|
ppcobsd_reg_offsets.pc_offset = 384;
|
|
|
|
|
ppcobsd_reg_offsets.ps_offset = 388;
|
|
|
|
|
ppcobsd_reg_offsets.cr_offset = 392;
|
|
|
|
|
ppcobsd_reg_offsets.lr_offset = 396;
|
|
|
|
|
ppcobsd_reg_offsets.ctr_offset = 400;
|
|
|
|
|
ppcobsd_reg_offsets.xer_offset = 404;
|
|
|
|
|
ppcobsd_reg_offsets.mq_offset = 408;
|
|
|
|
|
|
|
|
|
|
/* Floating-point registers. */
|
|
|
|
|
ppcobsd_reg_offsets.f0_offset = 128;
|
|
|
|
|
ppcobsd_reg_offsets.fpscr_offset = -1;
|
|
|
|
|
|
|
|
|
|
/* AltiVec registers. */
|
|
|
|
|
ppcobsd_reg_offsets.vr0_offset = 0;
|
|
|
|
|
ppcobsd_reg_offsets.vscr_offset = 512;
|
|
|
|
|
ppcobsd_reg_offsets.vrsave_offset = 520;
|
|
|
|
|
}
|
2006-05-15 21:53:20 +00:00
|
|
|
|
|
|
|
|
|
if (ppcobsd_fpreg_offsets.fpscr_offset == 0)
|
|
|
|
|
{
|
|
|
|
|
/* Floating-point registers. */
|
|
|
|
|
ppcobsd_reg_offsets.f0_offset = 0;
|
|
|
|
|
ppcobsd_reg_offsets.fpscr_offset = 256;
|
* ppc-linux-nat.c (right_fill_reg): Delete.
(supply_gregset): Use ppc_supply_gregset.
(supply_fpregset): Use ppc_supply_fpregset.
(fill_gregset): Use ppc_collect_gregset.
(fill_fpregset): Use ppc_collect_fpregset.
* ppc-linux-tdep.c (PPC_LINUX_PT_*): Don't define.
(right_supply_register, ppc_linux_supply_gregset): Delete.
(ppc32_linux_supply_gregset, ppc64_linux_supply_gregset): Delete.
(ppc_linux_supply_fpregset): Delete.
(ppc_linux_collect_gregset): New function.
(ppc32_linux_reg_offsets, ppc64_linux_reg_offsets): New.
(ppc32_linux_gregset, ppc64_linux_gregset): Update to use reg offsets,
ppc_linux_supply_gregset, and ppc_collect_gregset.
(ppc_linux_fpregset): Rename to ppc32_linux_fpregset and update.
(ppc_linux_gregset, ppc_linux_fpregset): New functions.
(ppc_linux_regset_from_core_section): Update.
* ppc-tdep.h (ppc_linux_gregset, ppc_linux_fpregset): Declare.
(ppc_linux_supply_gregset, ppc_linux_supply_fpregset): Delete.
(struct ppc_reg_offsets): Add gpr_size, xr_size, fpscr_size fields.
* ppcobsd-tdep.c (ppcobsd_supply_gregset): Delete FIXME and assert.
(ppcobsd_collect_gregset): Likewise.
(_initialize_ppcnbsd_tdep): Init gpr_size, xr_size, fpscr_size.
* ppcnbsd-tdep.c (_initialize_ppcobsd_tdep): Likewise.
* ppcobsd-nat.c (_initialize_ppcobsd_nat): Likewise.
* rs6000-aix-tdep.c (rs6000_aix32_reg_offsets): Likewise.
(rs6000_aix64_reg_offsets): Likewise.
(rs6000_aix_supply_regset): Call ppc_supply_fpregset without testing
ppc_floating_point_unit_p.
(rs6000_aix_collect_regset): Similarly.
* rs6000-tdep.c (ppc_supply_reg): Add regsize param. Adjust offset
when regsize is larger than regcache register size.
(ppc_collect_reg): Similarly zero pad when regsize is larger than
regcache register size.
(ppc_greg_offset): New function, split out from..
(ppc_supply_gregset): ..here. Separate code handling all regs from
single reg case. Correct xer offset.
(ppc_fpreg_offset): New function, split out from..
(ppc_supply_fpregset): ..here. Separate code handling all regs from
single reg case.
(ppc_collect_gregset, ppc_collect_fpregset): Likewise.
(ppc_supply_fpregset, ppc_collect_fpregset): Don't assert we have
a fp unit, instead return if no fp.
2007-08-30 13:13:59 +00:00
|
|
|
|
ppcobsd_reg_offsets.fpscr_size = 4;
|
2006-05-15 21:53:20 +00:00
|
|
|
|
}
|
2004-04-22 21:13:06 +00:00
|
|
|
|
}
|