Mac OS X 上的ldd和strace的替代
来源:互联网 发布:国家人社局软件 编辑:程序博客网 时间:2024/06/07 16:55
Linux下经常会用到ldd查看程序使用了哪些共享链接库,很方便的一个工具,在Mac OS X上没有这个命令,如果想在Mac OS X查看程序使用了哪些链接库可以用otool 来代替。
例:
$ otool -L /usr/bin/vim /usr/bin/vim: /usr/lib/libncurses.5.4.dylib (compatibility version 5.4.0, current version 5.4.0) /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
otool还有很多其它参数:
-f print the fat headers-a print the archive header-h print the mach header-l print the load commands-L print shared libraries used-D print shared library id name-t print the text section (disassemble with -v)-p <routine name> start dissassemble from routine name-s <segname> <sectname> print contents of section-d print the data section-o print the Objective-C segment-r print the relocation entries-S print the table of contents of a library-T print the table of contents of a dynamic shared library-M print the module table of a dynamic shared library-R print the reference table of a dynamic shared library-I print the indirect symbol table-H print the two-level hints table-G print the data in code table-v print verbosely (symbolically) when possible-V print disassembled operands symbolically-c print argument strings of a core file-X print no leading addresses or headers-m don’t use archive(member) syntax-B force Thumb disassembly (ARM objects only)-q use llvm’s disassembler (the default)-Q use otool(1)’s disassembler-mcpu=arg use `arg’ as the cpu for disassembly-j print opcode bytes-C print linker optimization hints–version print the version of otool
详细使用请参看手册。
Linux中的strace可以查看程序运行时的系统调用,有时对于调试程序很有帮助,Mac OS X中可用dtruss (需要root)替代
例:
sudo dtruss df -h
其它参数:
-p PID # examine this PID-n name # examine this process name-t syscall # examine this syscall only-a # print all details-c # print syscall counts-d # print relative times (us)-e # print elapsed times (us)-f # follow children-l # force printing pid/lwpid-o # print on cpu times-s # print stack backtraces-L # don’t print pid/lwpid-b bufsize # dynamic variable buf sizeeg,dtruss df -h # run and examine “df -h”dtruss -p 1871 # examine PID 1871dtruss -n tar # examine all processes called “tar”dtruss -f test.sh # run test.sh and follow children
阅读全文
0 0
- Mac OS X 上的ldd和strace的替代
- Mac OS X 上的ldd和strace的替代
- Mac OS X下的ldd工具——otool
- Mac OS X下的ldd工具——otool
- Mac OS X 上用 otool 代替 ldd
- ANT在Mac OS X上的安装和设置
- osx 下的strace ldd
- 升级Mac OS X上的git
- os x 下的strace命令
- Mac OS X: XAMP在Mac上的实现
- Mac OS X背后的故事(十)Mac OS X文件系统的来龙去脉(上)
- 在Mac OS X上的XAMPP上安装PHPUnit
- Mac OS X 10.10上的SIP Server的安装和配置(kamailio)
- Mac OS X 上的 Informix Database 组合(IDS 和 CSDK)安装揭秘
- [Sqlite] --> Sqlite在Windows、Linux 和 Mac OS X 上的安装过程
- Mac OS X 10.10优胜美地如何完美接管iphone上的电话和短信
- Zorka和Zico在Mac OS X上部署应注意的事项
- Mac OS X 10.6.4上安装oracle10g的经过
- RN实现TabNavigator
- Linux下的rpm软件管理(管理软件的卸载、安装、更新)
- java二维码工具类:生成二维码和解析二维码
- Ubuntu配置Django+ Apache2+ mysql
- ajax 异步请求 async:true;// true为异步,默认异步,false为同步
- Mac OS X 上的ldd和strace的替代
- Mongo3.4.7与java1.8结合测试代码
- Java 反射初探
- Android零基础入门第47节:自动完成文本框AutoCompleteTextView
- 嵌入式篇---字符的编码方式
- vector容器与iterator迭代器-C++
- 面试干货!21个必知数据科学面试题和答案part2(12-21)
- 排序算法之-快速排序
- Android集成React Native 踩坑合集 (github 有demo)