How can I view function names and parameters contained in an ELF file?

微笑、不失礼 提交于 2019-12-22 08:44:42

问题


If I look at the file's bytes I can definately see some of the function names in there. Is there any tool that will list them for me? Maybe even their parameters too?


回答1:


This should print all defined symbols within your object file or library.

nm -C --defined-only file.o

nm has quite a lot of options that you could use to filter out the symbols like -g for displaying only global symbols, -l for printing the line number (if you had used gcc -g to enable debug symbols) and so on.

If you have an ELF format binary (looks to be your case), you could also use readelf

readelf -Ws file.o

The column number 8 in this output contains the symbol name which is of interest. You could use c++filt to demangle the name:

readelf -Ws file.o | awk '{print $8}' | c++filt


来源:https://stackoverflow.com/questions/15193416/how-can-i-view-function-names-and-parameters-contained-in-an-elf-file

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