如何查看ELF文件中包含的函数名称和参数? [英] How can I view function names and parameters contained in an ELF file?
问题描述
如果我看看文件的字节,我可以看到一些函数名称。
是否有任何工具将列出他们为我?
这应该打印对象文件或库中的所有定义的符号。
p> nm -C --defined- only file.o
nm
有很多选项可以用来过滤掉 -g
仅显示全局符号
, -l </ code>使用
gcc -g
启用调试符号)等。
如果你有一个ELF格式二进制你也可以使用 readelf
readelf - Ws file.o
此输出中的列号8包含感兴趣的符号名称。您可以使用 c ++ filt
解构名称:
-Ws file.o | awk'{print $ 8}'| c ++ filt
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?
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
这篇关于如何查看ELF文件中包含的函数名称和参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!