Difference between nm and objdump

邮差的信 提交于 2019-12-03 06:04:44

问题


Looking at the manuals, objdump and nm have overlapping features.

When would you use each one? What was the original purpose of each command?


回答1:


They have no similar parameters. nm lists file symbols, while objdump 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."




回答2:


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.



来源:https://stackoverflow.com/questions/7219845/difference-between-nm-and-objdump

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!