summaryrefslogtreecommitdiff
path: root/gdb/mips-linux-tdep.c
diff options
context:
space:
mode:
authorDavid Daney <ddaney@avtrex.com>2011-02-04 18:34:41 +0000
committerDavid Daney <ddaney@avtrex.com>2011-02-04 18:34:41 +0000
commit2da4355e0fc7ff79b16dbba9d79783cf96e50ec7 (patch)
treec4efd31c983f53002d3f1540754f3427c76c16d2 /gdb/mips-linux-tdep.c
parent8939062d83880f1d9da3988a2e4066814ec30fc5 (diff)
downloadgdb-2da4355e0fc7ff79b16dbba9d79783cf96e50ec7.tar.gz
gdb/
2011-02-04 David Daney <ddaney@caviumnetworks.com> * mips-linux-tdep.c: Include xml-syscall.h. (mips_linux_get_syscall_number): New function. (mips_linux_init_abi): Add calls to mips_linux_get_syscall_number() and set_xml_syscall_file_name(). * data-directory/Makefile.in (SYSCALLS_FILES): Add mips-o32-linux.xml, mips-n32-linux.xml and mips-n64-linux.xml * syscalls/mips-n32-linux.xml: New file. * syscalls/mips-n64-linux.xml: New file. * syscalls/mips-o32-linux.xml: New file. gdb/testsuite/ 2011-02-04 David Daney <ddaney@caviumnetworks.com> * gdb.base/catch-syscall.exp: Enable for mips*-linux*.
Diffstat (limited to 'gdb/mips-linux-tdep.c')
-rw-r--r--gdb/mips-linux-tdep.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/gdb/mips-linux-tdep.c b/gdb/mips-linux-tdep.c
index be346d75844..c78d5d649f1 100644
--- a/gdb/mips-linux-tdep.c
+++ b/gdb/mips-linux-tdep.c
@@ -40,6 +40,7 @@
#include "mips-linux-tdep.h"
#include "glibc-tdep.h"
#include "linux-tdep.h"
+#include "xml-syscall.h"
static struct target_so_ops mips_svr4_so_ops;
@@ -1207,6 +1208,38 @@ mips_linux_syscall_next_pc (struct frame_info *frame)
return pc + 4;
}
+/* Return the current system call's number present in the
+ v0 register. When the function fails, it returns -1. */
+
+static LONGEST
+mips_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);
+ int regsize = register_size (gdbarch, MIPS_V0_REGNUM);
+ /* The content of a register */
+ gdb_byte buf[8];
+ /* The result */
+ LONGEST ret;
+
+ /* Make sure we're in a known ABI */
+ gdb_assert (tdep->mips_abi == MIPS_ABI_O32
+ || tdep->mips_abi == MIPS_ABI_N32
+ || tdep->mips_abi == MIPS_ABI_N64);
+
+ gdb_assert (regsize <= sizeof (buf));
+
+ /* Getting the system call number from the register.
+ syscall number is in v0 or $2. */
+ regcache_cooked_read (regcache, MIPS_V0_REGNUM, buf);
+
+ ret = extract_signed_integer (buf, regsize, byte_order);
+
+ return ret;
+}
+
/* Initialize one of the GNU/Linux OS ABIs. */
static void
@@ -1219,6 +1252,9 @@ mips_linux_init_abi (struct gdbarch_info info,
linux_init_abi (info, gdbarch);
+ /* Get the syscall number from the arch's register. */
+ set_gdbarch_get_syscall_number (gdbarch, mips_linux_get_syscall_number);
+
switch (abi)
{
case MIPS_ABI_O32:
@@ -1228,6 +1264,7 @@ mips_linux_init_abi (struct gdbarch_info info,
(gdbarch, svr4_ilp32_fetch_link_map_offsets);
tramp_frame_prepend_unwinder (gdbarch, &mips_linux_o32_sigframe);
tramp_frame_prepend_unwinder (gdbarch, &mips_linux_o32_rt_sigframe);
+ set_xml_syscall_file_name ("syscalls/mips-o32-linux.xml");
break;
case MIPS_ABI_N32:
set_gdbarch_get_longjmp_target (gdbarch,
@@ -1241,6 +1278,7 @@ mips_linux_init_abi (struct gdbarch_info info,
does not distinguish between quiet and signalling NaNs). */
set_gdbarch_long_double_format (gdbarch, floatformats_ia64_quad);
tramp_frame_prepend_unwinder (gdbarch, &mips_linux_n32_rt_sigframe);
+ set_xml_syscall_file_name ("syscalls/mips-n32-linux.xml");
break;
case MIPS_ABI_N64:
set_gdbarch_get_longjmp_target (gdbarch,
@@ -1254,6 +1292,7 @@ mips_linux_init_abi (struct gdbarch_info info,
does not distinguish between quiet and signalling NaNs). */
set_gdbarch_long_double_format (gdbarch, floatformats_ia64_quad);
tramp_frame_prepend_unwinder (gdbarch, &mips_linux_n64_rt_sigframe);
+ set_xml_syscall_file_name ("syscalls/mips-n64-linux.xml");
break;
default:
break;