]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Add a handler for syscall proc_info, 64-bit Darwin only atm.
authorJulian Seward <jseward@acm.org>
Thu, 1 Jul 2010 10:47:23 +0000 (10:47 +0000)
committerJulian Seward <jseward@acm.org>
Thu, 1 Jul 2010 10:47:23 +0000 (10:47 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11202

coregrind/m_syswrap/syswrap-darwin.c

index e7fa3f4c2f754066cb7b267c822adc3549ac9b7f..c299efe369e5325c9020d012bd7f675e269c34d4 100644 (file)
@@ -3606,6 +3606,38 @@ PRE(sigsuspend)
    PRE_REG_READ1(int, "sigsuspend", int, sigmask);
 }
 
+/* NB: 64-bit version only!  If this needs to be supported
+   on 32-bit Darwin too, be careful about the 4th arg, since
+   that is a uint64_t. 
+
+   ARG5 and ARG6 (buffer, buffersize) specify a buffer start and
+   length in the usual way.  I have seen values NULL, 0 passed in some
+   cases.  I left the calls to PRE_MEM_WRITE/READ unconditional on the
+   basis that they don't do anything if the length is zero, so it's OK
+   for the buffer pointer to be NULL in that case (meaning they don't
+   complain). */
+#if defined(VGP_amd64_darwin)
+PRE(proc_info)
+{
+   /* int proc_info(int32_t callnum, int32_t pid,
+                    uint32_t flavor, uint64_t arg,
+                    user_addr_t buffer, int32_t buffersize)
+   */
+   PRINT("proc_info(%d, %d, %u, %llu, %#lx, %d)",
+         (Int)ARG1, (Int)ARG2, (UInt)ARG3, ARG4, ARG5, (Int)ARG6);
+   PRE_REG_READ6(int, "proc_info",
+                 int, callnum, int, pid, unsigned int, flavor,
+                 unsigned long long int, arg,
+                 void*, buffer, int, buffersize);
+   PRE_MEM_WRITE("proc_info(buffer)", ARG5, ARG6);
+}
+POST(proc_info)
+{
+   vg_assert(SUCCESS);
+   POST_MEM_WRITE(ARG5, ARG6);
+}
+#endif
+
 /* ---------------------------------------------------------------------
    aio_*
    ------------------------------------------------------------------ */
@@ -7836,7 +7868,9 @@ const SyscallTableEntry ML_(syscall_table)[] = {
    MACX_(__NR___pthread_canceled,      __pthread_canceled),
    MACX_(__NR___semwait_signal,        __semwait_signal), 
    _____(VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(335)),   // old utrace
-// _____(__NR_proc_info), 
+#if DARWIN_VERS >= DARWIN_10_6 && defined(VGP_amd64_darwin)
+   MACXY(__NR_proc_info,               proc_info),  // 336
+#endif
    MACXY(__NR_sendfile,    sendfile), 
    MACXY(__NR_stat64,      stat64), 
    MACXY(__NR_fstat64,     fstat64),