macos 等价于 osx 的 ltrace?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1258481/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 06:19:41  来源:igfitidea点击:

ltrace equivalent for osx?

linuxmacosdtracestrace

提问by Enki

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.

osx 拥有非常强大的 dtrace/ktrace/dtruss 工具 - 但是我现在不愿意投入必要的时间来学习处理它们。

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

在 OSX 上获得 linux ltrace(可能还有 strace)的等效功能的最简单方法是什么?

回答by Dean Povey

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.

ltrace 没有答案(除了“弄清楚如何使用 dtrace”:-)),但是对于系统调用跟踪 ala strace,dtruss 是 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"

回答by Vitaly Kushner

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:

您无需学习 dtrace 即可使用它。OSX 附带了很多 dtrace 脚本。查看(不完整的)列表:

man -k dtrace

man -k dtrace

In your case dapptracemight do the job.

在你的情况下dapptrace可能会完成这项工作。

回答by Brad Larson

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 hereand 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.

我建议 DTrace 并不像您想象的那么复杂。我刚刚写了一篇关于使用 DTrace 为 Mac 或 iPhone 调整 Cocoa 应用程序的两部分教程,可在此处此处找到。我开始认为 DTrace 很难使用,但结果证明它使用起来相当简单。