aboutsummaryrefslogtreecommitdiff
path: root/gdb/sparc-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/sparc-linux-tdep.c
parentc060226ad07dc40da26ecf8483a911cf3f18cb81 (diff)
downloadbinutils-09de9781bdd949cdd00adec6e0693a0d79d70463.zip
binutils-09de9781bdd949cdd00adec6e0693a0d79d70463.tar.gz
binutils-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/sparc-linux-tdep.c')
-rw-r--r--gdb/sparc-linux-tdep.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/gdb/sparc-linux-tdep.c b/gdb/sparc-linux-tdep.c
index d65db6c..20644b4 100644
--- a/gdb/sparc-linux-tdep.c
+++ b/gdb/sparc-linux-tdep.c
@@ -32,6 +32,10 @@
#include "symtab.h"
#include "trad-frame.h"
#include "tramp-frame.h"
+#include "xml-syscall.h"
+
+/* The syscall's XML filename for sparc 32-bit. */
+#define XML_SYSCALL_FILENAME_SPARC32 "syscalls/sparc-linux.xml"
#include "sparc-tdep.h"
@@ -241,6 +245,27 @@ sparc_linux_write_pc (struct regcache *regcache, CORE_ADDR pc)
regcache_cooked_write_unsigned (regcache, SPARC32_PSR_REGNUM, psr);
}
+static LONGEST
+sparc32_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[4];
+ /* 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, 4, byte_order);
+
+ return ret;
+}
+
static void
@@ -279,6 +304,11 @@ sparc32_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
dwarf2_append_unwinders (gdbarch);
set_gdbarch_write_pc (gdbarch, sparc_linux_write_pc);
+
+ /* Functions for 'catch syscall'. */
+ set_xml_syscall_file_name (XML_SYSCALL_FILENAME_SPARC32);
+ set_gdbarch_get_syscall_number (gdbarch,
+ sparc32_linux_get_syscall_number);
}
/* Provide a prototype to silence -Wmissing-prototypes. */