从ELF目标文件中转储C结构大小 [英] dumping C structure sizes from ELF object file

查看:107
本文介绍了从ELF目标文件中转储C结构大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从带有调试符号的ELF对象文件中提取所有C结构的大小?

How can you extract the sizes of all C structures from an ELF object file with debugging symbols?

可以通过GDB使用 print sizeof( some_struct),但我需要获取所有结构的清单。

Individual struct sizes can be obtained from GDB using "print sizeof(some_struct)", but what I need is to get a listing of all structures.

我看过 nm和 objdump,但我没有查看执行我要寻找的选项。有没有办法使用标准的Unix工具来做到这一点,还是我需要从ELF文件中提取调试符号部分并自己处理?我希望不是后者。

I've looked at "nm" and "objdump", but I don't see options to do what I'm looking for. Is there a way to do this with standard Unix tools, or do I need to extract the debug symbol section from the ELF file and process it myself? I'm hoping it's not the latter.

在此先感谢您的任何建议。
Ray

Thanks in advance for any advice. Ray

推荐答案

pahole 显示了有关此结构的其他信息。它的git仓库位于 http:/ /www.kernel.org/git/?p=linux/kernel/git/acme/pahole.git;a=summary

pahole shows this and other details about structs. Its git repo is at http://www.kernel.org/git/?p=linux/kernel/git/acme/pahole.git;a=summary.

这篇关于从ELF目标文件中转储C结构大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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