Index: gdb/mips-linux-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/mips-linux-tdep.c,v retrieving revision 1.86 diff -u -p -r1.86 mips-linux-tdep.c --- gdb/mips-linux-tdep.c 9 Jan 2011 03:20:33 -0000 1.86 +++ gdb/mips-linux-tdep.c 21 Jan 2011 18:48:16 -0000 @@ -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; @@ -1206,6 +1207,40 @@ mips_linux_syscall_next_pc (struct 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); + struct cleanup *cleanbuf; + /* The content of a register */ + gdb_byte *buf; + /* 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); + + buf = (gdb_byte *) xmalloc (regsize * sizeof (gdb_byte)); + + cleanbuf = make_cleanup (xfree, 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); + do_cleanups (cleanbuf); + + return ret; +} /* Initialize one of the GNU/Linux OS ABIs. */ @@ -1219,6 +1254,9 @@ mips_linux_init_abi (struct gdbarch_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 +1266,7 @@ mips_linux_init_abi (struct gdbarch_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 +1280,7 @@ mips_linux_init_abi (struct gdbarch_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 +1294,7 @@ mips_linux_init_abi (struct gdbarch_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; Index: gdb/data-directory/Makefile.in =================================================================== RCS file: /cvs/src/src/gdb/data-directory/Makefile.in,v retrieving revision 1.7 diff -u -p -r1.7 Makefile.in --- gdb/data-directory/Makefile.in 1 Jan 2011 15:33:22 -0000 1.7 +++ gdb/data-directory/Makefile.in 21 Jan 2011 18:48:16 -0000 @@ -46,7 +46,8 @@ SYSCALLS_FILES = \ gdb-syscalls.dtd \ ppc-linux.xml ppc64-linux.xml \ i386-linux.xml amd64-linux.xml \ - sparc-linux.xml sparc64-linux.xml + sparc-linux.xml sparc64-linux.xml \ + mips-o32-linux.xml mips-n32-linux.xml mips-n64-linux.xml PYTHON_DIR = python PYTHON_INSTALL_DIR = $(DESTDIR)$(GDB_DATADIR)/$(PYTHON_DIR) Index: gdb/syscalls/mips-n32-linux.xml =================================================================== RCS file: gdb/syscalls/mips-n32-linux.xml diff -N gdb/syscalls/mips-n32-linux.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gdb/syscalls/mips-n32-linux.xml 21 Jan 2011 18:48:16 -0000 @@ -0,0 +1,319 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: gdb/syscalls/mips-n64-linux.xml =================================================================== RCS file: gdb/syscalls/mips-n64-linux.xml diff -N gdb/syscalls/mips-n64-linux.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gdb/syscalls/mips-n64-linux.xml 21 Jan 2011 18:48:16 -0000 @@ -0,0 +1,312 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: gdb/syscalls/mips-o32-linux.xml =================================================================== RCS file: gdb/syscalls/mips-o32-linux.xml diff -N gdb/syscalls/mips-o32-linux.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gdb/syscalls/mips-o32-linux.xml 21 Jan 2011 18:48:16 -0000 @@ -0,0 +1,347 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: gdb/testsuite/gdb.base/catch-syscall.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.base/catch-syscall.exp,v retrieving revision 1.11 diff -u -p -r1.11 catch-syscall.exp --- gdb/testsuite/gdb.base/catch-syscall.exp 1 Jan 2011 15:33:41 -0000 1.11 +++ gdb/testsuite/gdb.base/catch-syscall.exp 21 Jan 2011 18:48:16 -0000 @@ -54,7 +54,8 @@ if {![istarget "hppa*-hp-hpux*"] && ![is #if { ![istarget "i\[34567\]86-*-linux*"] if { ![istarget "x86_64-*-linux*"] && ![istarget "i\[34567\]86-*-linux*"] && ![istarget "powerpc-*-linux*"] && ![istarget "powerpc64-*-linux*"] - && ![istarget "sparc-*-linux*"] && ![istarget "sparc64-*-linux*"] } { + && ![istarget "sparc-*-linux*"] && ![istarget "sparc64-*-linux*"] + && ![istarget "mips*-linux*"] } { continue }