From 385203ed4dec8e3515f691f497c9134d39f70e82 Mon Sep 17 00:00:00 2001 From: David Daney Date: Fri, 4 Feb 2011 18:34:43 +0000 Subject: [PATCH] gdb/ 2011-02-04 David Daney * 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 * gdb.base/catch-syscall.exp: Enable for mips*-linux*. --- gdb/ChangeLog | 12 + gdb/data-directory/Makefile.in | 3 +- gdb/mips-linux-tdep.c | 39 +++ gdb/syscalls/mips-n32-linux.xml | 319 +++++++++++++++++++++ gdb/syscalls/mips-n64-linux.xml | 312 ++++++++++++++++++++ gdb/syscalls/mips-o32-linux.xml | 347 +++++++++++++++++++++++ gdb/testsuite/ChangeLog | 4 + gdb/testsuite/gdb.base/catch-syscall.exp | 3 +- 8 files changed, 1037 insertions(+), 2 deletions(-) create mode 100644 gdb/syscalls/mips-n32-linux.xml create mode 100644 gdb/syscalls/mips-n64-linux.xml create mode 100644 gdb/syscalls/mips-o32-linux.xml diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 96224831828..f7a433c9a0b 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,15 @@ +2011-02-04 David Daney + + * 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. + 2011-02-04 Ulrich Weigand * dwarf2read.c (dwarf2_ranges_read): Skip empty range entries. diff --git a/gdb/data-directory/Makefile.in b/gdb/data-directory/Makefile.in index 565a8378423..11cf2e6736c 100644 --- a/gdb/data-directory/Makefile.in +++ b/gdb/data-directory/Makefile.in @@ -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) 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; diff --git a/gdb/syscalls/mips-n32-linux.xml b/gdb/syscalls/mips-n32-linux.xml new file mode 100644 index 00000000000..da4aba2b757 --- /dev/null +++ b/gdb/syscalls/mips-n32-linux.xml @@ -0,0 +1,319 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gdb/syscalls/mips-n64-linux.xml b/gdb/syscalls/mips-n64-linux.xml new file mode 100644 index 00000000000..fc951c8f8de --- /dev/null +++ b/gdb/syscalls/mips-n64-linux.xml @@ -0,0 +1,312 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gdb/syscalls/mips-o32-linux.xml b/gdb/syscalls/mips-o32-linux.xml new file mode 100644 index 00000000000..939ed4eebec --- /dev/null +++ b/gdb/syscalls/mips-o32-linux.xml @@ -0,0 +1,347 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index a287e4b862e..e4db48bc473 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2011-02-04 David Daney + + * gdb.base/catch-syscall.exp: Enable for mips*-linux*. + 2011-02-03 Andrew Burgess * gdb.base/disasm-end-cu-1.c, gdb.base/disasm-end-cu-2.c, diff --git a/gdb/testsuite/gdb.base/catch-syscall.exp b/gdb/testsuite/gdb.base/catch-syscall.exp index 2d14e91bf40..d25df176a3c 100644 --- a/gdb/testsuite/gdb.base/catch-syscall.exp +++ b/gdb/testsuite/gdb.base/catch-syscall.exp @@ -54,7 +54,8 @@ if {![istarget "hppa*-hp-hpux*"] && ![istarget "*-linux*"]} then { #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 } -- 2.39.2