如何查看ELF文件中包含的函数名称和参数? [英] How can I view function names and parameters contained in an ELF file?

查看:1358
本文介绍了如何查看ELF文件中包含的函数名称和参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我看看文件的字节,我可以看到一些函数名称。
是否有任何工具将列出他们为我?

这应该打印对象文件或库中的所有定义的符号。

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆