如何在 Mac OS X 中跟踪程序的系统调用? [英] How to trace system calls of a program in Mac OS X?

查看:50
本文介绍了如何在 Mac OS X 中跟踪程序的系统调用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想跟踪 find 命令的系统调用 调试一些性能问题 但是我不知道如何在 Mac OS X Yosemite 上做到这一点.与 strace 在 FreeBSD 上所做的类似,如何跟踪任意程序的系统调用?我对跟踪文件系统相关调用特别感兴趣.

I wanted to trace the system calls made by the find command to debug some performance issues however I could not figure out how to do this on Mac OS X Yosemite. How can I trace system calls for an arbitrary program similarly to what strace does on FreeBSD? I am especially interested in tracing file-system related calls.

推荐答案

你可以像在

sudo dtruss find ~/repo -depth 2 -type d -name '.git'

手册页 该实用程序将帮助您根据需要调整该工具的使用.

The manual page of that utility will help you to tailor the use of the tool to your needs.

这篇关于如何在 Mac OS X 中跟踪程序的系统调用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆