aboutsummaryrefslogtreecommitdiff
path: root/gdb/sparc64-linux-tdep.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@redhat.com>2010-02-24 15:14:31 +0000
committerDavid S. Miller <davem@redhat.com>2010-02-24 15:14:31 +0000
commit09de9781bdd949cdd00adec6e0693a0d79d70463 (patch)
treef013dfddf91d156bb093b2521f4c5fa0090f194d /gdb/sparc64-linux-tdep.c
parentc060226ad07dc40da26ecf8483a911cf3f18cb81 (diff)
downloadgdb-09de9781bdd949cdd00adec6e0693a0d79d70463.zip
gdb-09de9781bdd949cdd00adec6e0693a0d79d70463.tar.gz
gdb-09de9781bdd949cdd00adec6e0693a0d79d70463.tar.bz2
gdb: Add sparc*-*-linux catch syscall support.
2010-02-24 David S. Miller <davem@davemloft.net> * gdb_ptrace.h (PT_SYSCALL): If PTRACE_SYSCALL is available, use it. * syscalls/sparc-linux.xml: New. * syscalls/sparc64-linux.xml: New. * Makefile.in (XML_SYSCALL_FILES): Add new syscall XML files. * sparc-linux-tdep.c (XML_SYSCALL_FILENAME_SPARC32): Define. (sparc32_linux_get_syscall_number): New function. (sparc32_linux_init_abi): Set syscall XML file name and hook up syscall number fetcher. * sparc64-linux-tdep.c (XML_SYSCALL_FILENAME_SPARC64): Define. (sparc64_linux_get_syscall_number): New function. (sparc64_linux_init_abi): Set syscall XML file name and hook up syscall number fetcher.
Diffstat (limited to 'gdb/sparc64-linux-tdep.c')
-rw-r--r--gdb/sparc64-linux-tdep.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/gdb/sparc64-linux-tdep.c b/gdb/sparc64-linux-tdep.c
index 8b7e908..72bbb32 100644
--- a/gdb/sparc64-linux-tdep.c
+++ b/gdb/sparc64-linux-tdep.c
@@ -31,6 +31,10 @@
#include "symtab.h"
#include "trad-frame.h"
#include "tramp-frame.h"
+#include "xml-syscall.h"
+
+/* The syscall's XML filename for sparc 64-bit. */
+#define XML_SYSCALL_FILENAME_SPARC64 "syscalls/sparc64-linux.xml"
#include "sparc64-tdep.h"
@@ -205,6 +209,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;
+}
+
static void
@@ -244,6 +269,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);
}