/* Target-dependent code for GDB, the GNU debugger.
Copyright (C) 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
- 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
Free Software Foundation, Inc.
This file is part of GDB.
#include "exceptions.h"
#include "arch-utils.h"
#include "spu-tdep.h"
+#include "xml-syscall.h"
#include "features/rs6000/powerpc-32l.c"
#include "features/rs6000/powerpc-altivec32l.c"
#include "features/rs6000/powerpc-isa205-vsx64l.c"
#include "features/rs6000/powerpc-e500l.c"
+/* The syscall's XML filename for PPC and PPC64. */
+#define XML_SYSCALL_FILENAME_PPC "syscalls/ppc-linux.xml"
+#define XML_SYSCALL_FILENAME_PPC64 "syscalls/ppc64-linux.xml"
/* ppc_linux_memory_remove_breakpoints attempts to remove a breakpoint
in much the same fashion as memory_remove_breakpoint in mem-break.c,
static struct core_regset_section ppc_linux_vsx_regset_sections[] =
{
- { ".reg", 268 },
- { ".reg2", 264 },
- { ".reg-ppc-vmx", 544 },
- { ".reg-ppc-vsx", 256 },
+ { ".reg", 268, "general-purpose" },
+ { ".reg2", 264, "floating-point" },
+ { ".reg-ppc-vmx", 544, "ppc Altivec" },
+ { ".reg-ppc-vsx", 256, "POWER7 VSX" },
{ NULL, 0}
};
static struct core_regset_section ppc_linux_vmx_regset_sections[] =
{
- { ".reg", 268 },
- { ".reg2", 264 },
- { ".reg-ppc-vmx", 544 },
+ { ".reg", 268, "general-purpose" },
+ { ".reg2", 264, "floating-point" },
+ { ".reg-ppc-vmx", 544, "ppc Altivec" },
{ NULL, 0}
};
static struct core_regset_section ppc_linux_fp_regset_sections[] =
{
- { ".reg", 268 },
- { ".reg2", 264 },
+ { ".reg", 268, "general-purpose" },
+ { ".reg2", 264, "floating-point" },
{ NULL, 0}
};
&& register_size (gdbarch, PPC_TRAP_REGNUM) > 0;
}
+/* Return the current system call's number present in the
+ r0 register. When the function fails, it returns -1. */
+static LONGEST
+ppc_linux_get_syscall_number (struct gdbarch *gdbarch,
+ ptid_t ptid)
+{
+ struct regcache *regcache = get_thread_regcache (ptid);
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
+ struct cleanup *cleanbuf;
+ /* The content of a register */
+ gdb_byte *buf;
+ /* The result */
+ LONGEST ret;
+
+ /* Make sure we're in a 32- or 64-bit machine */
+ gdb_assert (tdep->wordsize == 4 || tdep->wordsize == 8);
+
+ buf = (gdb_byte *) xmalloc (tdep->wordsize * sizeof (gdb_byte));
+
+ cleanbuf = make_cleanup (xfree, buf);
+
+ /* Getting the system call number from the register.
+ When dealing with PowerPC architecture, this information
+ is stored at 0th register. */
+ regcache_cooked_read (regcache, tdep->ppc_gp0_regnum, buf);
+
+ ret = extract_signed_integer (buf, tdep->wordsize, byte_order);
+ do_cleanups (cleanbuf);
+
+ return ret;
+}
+
static void
ppc_linux_write_pc (struct regcache *regcache, CORE_ADDR pc)
{
{
if (strstr (so->so_original_name, "/libspe") != NULL)
{
- solib_read_symbols (so, so->from_tty ? SYMFILE_VERBOSE : 0);
+ solib_read_symbols (so, 0);
ppc_linux_spe_context_lookup (so->objfile);
}
}
struct ppu2spu_cache *cache
= FRAME_OBSTACK_CALLOC (1, struct ppu2spu_cache);
- struct regcache *regcache = regcache_xmalloc (data.gdbarch);
+ struct address_space *aspace = get_frame_address_space (this_frame);
+ struct regcache *regcache = regcache_xmalloc (data.gdbarch, aspace);
struct cleanup *cleanups = make_cleanup_regcache_xfree (regcache);
regcache_save (regcache, ppu2spu_unwind_register, &data);
discard_cleanups (cleanups);
/* Handle inferior calls during interrupted system calls. */
set_gdbarch_write_pc (gdbarch, ppc_linux_write_pc);
+ /* Get the syscall number from the arch's register. */
+ set_gdbarch_get_syscall_number (gdbarch, ppc_linux_get_syscall_number);
+
if (tdep->wordsize == 4)
{
/* Until November 2001, gcc did not comply with the 32 bit SysV
set_solib_svr4_fetch_link_map_offsets
(gdbarch, svr4_ilp32_fetch_link_map_offsets);
+ /* Setting the correct XML syscall filename. */
+ set_xml_syscall_file_name (XML_SYSCALL_FILENAME_PPC);
+
/* Trampolines. */
tramp_frame_prepend_unwinder (gdbarch, &ppc32_linux_sigaction_tramp_frame);
tramp_frame_prepend_unwinder (gdbarch, &ppc32_linux_sighandler_tramp_frame);
set_solib_svr4_fetch_link_map_offsets
(gdbarch, svr4_lp64_fetch_link_map_offsets);
+ /* Setting the correct XML syscall filename. */
+ set_xml_syscall_file_name (XML_SYSCALL_FILENAME_PPC64);
+
/* Trampolines. */
tramp_frame_prepend_unwinder (gdbarch, &ppc64_linux_sigaction_tramp_frame);
tramp_frame_prepend_unwinder (gdbarch, &ppc64_linux_sighandler_tramp_frame);