ltrace equivalent for osx?

狂风中的少年 提交于 2019-12-18 11:45:30

问题


osx has the really powerful dtrace/ktrace/dtruss tools - however i'm not willing to invest the time necessary to learn dealing with them right now.

what's the easiest way to get the equivalent functionality of linux ltrace (and possibly strace) on OSX?


回答1:


No answer for ltrace (except perhaps "work out how to use dtrace" :-) ), but for system call tracing ala strace, dtruss is a pretty good front end to dtrace.

e.g.

dtruss df -h     # run and examine the "df -h" command

dtruss -p 1871   # examine PID 1871

dtruss -n tar    # examine all processes called "tar"



回答2:


you don't need to learn dtrace to use it. there are quite a few dtrace scripts that come with OSX. To see an (incomplete) list:

man -k dtrace

In your case dapptrace might do the job.




回答3:


I'd suggest that DTrace is not as complex as you think it is. I just wrote a two-part tutorial on using DTrace to tune Cocoa applications for the Mac or iPhone, which can be found here and here. I came into it thinking that DTrace would be extremely difficult to work with, but it turns out to be reasonably straightforward to use.



来源:https://stackoverflow.com/questions/1258481/ltrace-equivalent-for-osx

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!