问题描述
在linux上,为了在给定的时间查看进程堆栈,我们通常使用
On linux in order to view the process stack at a given time we generally use
pstack< >
pstack <pid
>
我想知道osx中的等效功能是什么.
I am wondering what is the equivalent of the same in osx.
谢谢
推荐答案
sudo /usr/libexec/stackshot -i -u -p <pid>
这会将有关进程的所有线程的堆栈跟踪附加到文件/Library/Logs/stackshot-syms.log中.考虑在调用stackshot之前删除文件stackshot-syms.log.另请:stackshot(1)
This appends a stack trace of all threads of the process in question to the file /Library/Logs/stackshot-syms.log . Consider to remove the file stackshot-syms.log before calling stackshot. See: stackshot(1)
注意:OS X 10.11 EL Capitan不再包含stackshot.改用lldb调试器:
Note: stackshot is no longer included with OS X 10.11 EL Capitan.Use the lldb debugger instead:
echo "thread backtrace all" | lldb -p <pid>
lldb是命令行开发人员工具的一部分.如果您的计算机上没有lldb,则弹出窗口将帮助您安装XCode.
lldb is part of the command line developer tools. If you don't have lldb on your machine, a popup will help with installing XCode.
这篇关于在OSX 10.9上Pstack一个进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!