Mac OS X 上的ldd和strace的替代
来源:互联网 发布:马自达 mx5 rf 知乎 编辑:程序博客网 时间:2024/06/06 15:51
本文转载至:http://www.linuxsong.org/2015/04/mac-os-x-ldd-strace/
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还有很多其它参数:
-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 size
eg,
dtruss df -h # run and examine “df -h”
dtruss -p 1871 # examine PID 1871
dtruss -n tar # examine all processes called “tar”
dtruss -f test.sh # run test.sh and follow children
详细请参考手册。
- 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的经过
- 道德经全文用字分析
- GCD,@synchronized 实现生产者-消费者模型
- git 初步使用 -- 提交代码
- 10014---CentOS6.5下kafka+ZooKeeper下载与安装详细教程-多机版本1
- VS2012 Error:不存在从“——”到“——*”的适当转换函数—已解决
- Mac OS X 上的ldd和strace的替代
- Mybatis 示例之 foreach
- 会场安排问题
- 在Eclipse上安装BuildShip Gradle插件,并创建Java Web项目
- 最优合并问题
- codeforces contest 355
- 小无聊————————Auticompelete TextView动态匹配输入的内容
- 汽车加油问题
- eclipse创建maven项目报错