nm 和 objdump 之间的区别
查看手册,objdump
和 nm
具有重叠的功能。
你什么时候会使用每一个?每个命令的最初目的是什么?
Looking at the manuals, objdump
and nm
have overlapping features.
When would you use each one? What was the original purpose of each command?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
它们没有相似的参数。
nm
列出文件符号,而objdump
可以显示有关文件的许多不同信息。objdump
也可以显示符号,并且在联机帮助页中明确指出“这与 nm 程序提供的信息类似,尽管显示格式不同。”They have no similar parameters.
nm
lists file symbols, whileobjdump
can show a lot of different information about files.objdump
can shows symbols too, and it is explicitly noted in the manpage that "This is similar to the information provided by the nm program, although the display format is different."nm 似乎是 posix,因此可以在非 gnu 平台上使用。
http://pubs.opengroup.org/onlinepubs/000095399/utilities/nm.html
例如,我看到 OSX 默认情况下不附带 objdump,但提供了“otool”,它提供了“objdump”提供的一些相同功能linux。
所以我想如果您真正想要的只是查看符号表或类似任务,并且您关心脚本的可移植性,那么您会使用 nm。对于其他一些任务,例如查看文件的调试信息,objdump 可能更合适。
It seems like nm is posix, so available in non-gnu platforms.
http://pubs.opengroup.org/onlinepubs/000095399/utilities/nm.html
I see for example that OSX doesn't come by default with objdump, but provides "otool" , which offers some of the same features "objdump" offers on linux.
So I guess you would use nm if really all you want is look at symbol tables or similar tasks, and you care about portability of your script. For some other tasks, such as looking into the debug info of a file, objdump might be more appropriate.