Valgrind: r16211 - in /trunk: coregrind/m_syswrap/syswrap-mips32-linux.c memcheck/tests/linux/getregset.vgtest

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Valgrind: r16211 - in /trunk: coregrind/m_syswrap/syswrap-mips32-linux.c memcheck/tests/linux/getregset.vgtest

svn-2
Author: petarj
Date: Fri Jan 27 17:01:49 2017
New Revision: 16211

Log:
mips32: add support for ptrace syscall

Add wrapers for ptrace syscall for mips32.

Patch by Aleksandra Karadzic.

Modified:
    trunk/coregrind/m_syswrap/syswrap-mips32-linux.c
    trunk/memcheck/tests/linux/getregset.vgtest

Modified: trunk/coregrind/m_syswrap/syswrap-mips32-linux.c
==============================================================================
--- trunk/coregrind/m_syswrap/syswrap-mips32-linux.c (original)
+++ trunk/coregrind/m_syswrap/syswrap-mips32-linux.c Fri Jan 27 17:01:49 2017
@@ -437,7 +437,58 @@
                 int, prot, int, flags, int, fd, unsigned long, offset);
   r = mips_PRE_sys_mmap(tid, ARG1, ARG2, ARG3, ARG4, ARG5, (Off64T) ARG6);
   SET_STATUS_from_SysRes(r);
-}
+}
+
+PRE(sys_ptrace)
+{
+   PRINT("sys_ptrace ( %ld, %ld, %#lx, %#lx )", SARG1, SARG2, ARG3, ARG4);
+   PRE_REG_READ4(int, "ptrace",
+                 long, request, long, pid, unsigned long, addr,
+                 unsigned long, data);
+   switch (ARG1) {
+      case VKI_PTRACE_PEEKTEXT:
+      case VKI_PTRACE_PEEKDATA:
+      case VKI_PTRACE_PEEKUSR:
+         PRE_MEM_WRITE("ptrace(peek)", ARG4, sizeof(long));
+         break;
+      case VKI_PTRACE_GETEVENTMSG:
+         PRE_MEM_WRITE("ptrace(geteventmsg)", ARG4, sizeof(unsigned long));
+         break;
+      case VKI_PTRACE_GETSIGINFO:
+         PRE_MEM_WRITE("ptrace(getsiginfo)", ARG4, sizeof(vki_siginfo_t));
+         break;
+      case VKI_PTRACE_SETSIGINFO:
+         PRE_MEM_READ("ptrace(setsiginfo)", ARG4, sizeof(vki_siginfo_t));
+         break;
+      case VKI_PTRACE_GETREGSET:
+         ML_(linux_PRE_getregset)(tid, ARG3, ARG4);
+         break;
+      default:
+        break;
+   }
+}
+
+POST(sys_ptrace)
+{
+   switch (ARG1) {
+      case VKI_PTRACE_PEEKTEXT:
+      case VKI_PTRACE_PEEKDATA:
+      case VKI_PTRACE_PEEKUSR:
+         POST_MEM_WRITE (ARG4, sizeof(long));
+         break;
+      case VKI_PTRACE_GETEVENTMSG:
+         POST_MEM_WRITE (ARG4, sizeof(unsigned long));
+      break;
+      case VKI_PTRACE_GETSIGINFO:
+         POST_MEM_WRITE (ARG4, sizeof(vki_siginfo_t));
+         break;
+      case VKI_PTRACE_GETREGSET:
+         ML_(linux_POST_getregset)(tid, ARG3, ARG4);
+         break;
+      default:
+      break;
+   }
+}
 
 // XXX: lstat64/fstat64/stat64 are generic, but not necessarily
 // applicable to every architecture -- I think only to 32-bit archs.
@@ -690,7 +741,7 @@
    GENX_ (__NR_setuid,                 sys_setuid),                  // 23
    GENX_ (__NR_getuid,                 sys_getuid),                  // 24
    LINX_ (__NR_stime,                  sys_stime),                   // 25
-   //..    PLAXY(__NR_ptrace,            sys_ptrace),            // 26
+   PLAXY(__NR_ptrace,                  sys_ptrace),                  // 26
    GENX_ (__NR_alarm,                  sys_alarm),                   // 27
    //..    //   (__NR_oldfstat,          sys_fstat),  // 28
    GENX_ (__NR_pause,                  sys_pause),                   // 29

Modified: trunk/memcheck/tests/linux/getregset.vgtest
==============================================================================
--- trunk/memcheck/tests/linux/getregset.vgtest (original)
+++ trunk/memcheck/tests/linux/getregset.vgtest Fri Jan 27 17:01:49 2017
@@ -1,4 +1,4 @@
 prog: getregset
 vgopts: -q
-prereq: ../../../tests/os_test linux 2.6.33 && ! ../../../tests/arch_test mips32 && ! ../../../tests/arch_test ppc64
+prereq: ((../../../tests/os_test linux 2.6.33 && ! ../../../tests/arch_test mips32) || ../../../tests/os_test linux 3.10.0 ) && ! ../../../tests/arch_test ppc64
 


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Valgrind-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/valgrind-developers
Loading...