* MAINTAINERS: Add rx to target ISA section.
[deliverable/binutils-gdb.git] / gdb / sparc64-linux-tdep.c
index 8b7e9081b37837079a7a59c819562b20a9500f9b..019af2b8a59c2c44db6fb5c52a566eea57dc5c80 100644 (file)
@@ -1,7 +1,6 @@
 /* Target-dependent code for GNU/Linux UltraSPARC.
 
-   Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009, 2010
-   Free Software Foundation, Inc.
+   Copyright (C) 2003-2005, 2007-2012 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
 #include "symtab.h"
 #include "trad-frame.h"
 #include "tramp-frame.h"
+#include "xml-syscall.h"
+#include "linux-tdep.h"
+
+/* The syscall's XML filename for sparc 64-bit.  */
+#define XML_SYSCALL_FILENAME_SPARC64 "syscalls/sparc64-linux.xml"
 
 #include "sparc64-tdep.h"
 
@@ -152,7 +156,8 @@ sparc64_linux_supply_core_gregset (const struct regset *regset,
                                   struct regcache *regcache,
                                   int regnum, const void *gregs, size_t len)
 {
-  sparc64_supply_gregset (&sparc64_linux_core_gregset, regcache, regnum, gregs);
+  sparc64_supply_gregset (&sparc64_linux_core_gregset,
+                         regcache, regnum, gregs);
 }
 
 static void
@@ -160,7 +165,8 @@ sparc64_linux_collect_core_gregset (const struct regset *regset,
                                    const struct regcache *regcache,
                                    int regnum, void *gregs, size_t len)
 {
-  sparc64_collect_gregset (&sparc64_linux_core_gregset, regcache, regnum, gregs);
+  sparc64_collect_gregset (&sparc64_linux_core_gregset,
+                          regcache, regnum, gregs);
 }
 
 static void
@@ -205,6 +211,27 @@ sparc64_linux_write_pc (struct regcache *regcache, CORE_ADDR pc)
   regcache_cooked_write_unsigned (regcache, SPARC64_STATE_REGNUM, state);
 }
 
+static LONGEST
+sparc64_linux_get_syscall_number (struct gdbarch *gdbarch,
+                                 ptid_t ptid)
+{
+  struct regcache *regcache = get_thread_regcache (ptid);
+  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
+  /* The content of a register.  */
+  gdb_byte buf[8];
+  /* The result.  */
+  LONGEST ret;
+
+  /* Getting the system call number from the register.
+     When dealing with the sparc architecture, this information
+     is stored at the %g1 register.  */
+  regcache_cooked_read (regcache, SPARC_G1_REGNUM, buf);
+
+  ret = extract_signed_integer (buf, 8, byte_order);
+
+  return ret;
+}
+
 \f
 
 static void
@@ -212,6 +239,8 @@ sparc64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 {
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
+  linux_init_abi (info, gdbarch);
+
   tdep->gregset = regset_alloc (gdbarch, sparc64_linux_supply_core_gregset,
                                sparc64_linux_collect_core_gregset);
   tdep->sizeof_gregset = 288;
@@ -244,6 +273,11 @@ sparc64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
   tdep->step_trap = sparc64_linux_step_trap;
 
   set_gdbarch_write_pc (gdbarch, sparc64_linux_write_pc);
+
+  /* Functions for 'catch syscall'.  */
+  set_xml_syscall_file_name (XML_SYSCALL_FILENAME_SPARC64);
+  set_gdbarch_get_syscall_number (gdbarch,
+                                  sparc64_linux_get_syscall_number);
 }
 \f
 
This page took 0.024687 seconds and 4 git commands to generate.