dumping C structure sizes from ELF object file

前端 未结 4 2006
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-01 09:16

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

Individual struct sizes can be obtained from GDB using \"print sizeof(s

4条回答
  •  天命终不由人
    2021-02-01 09:28

    You will have to dig in .debug_info section, objdump will dump it for you if you run it with --dwarf parameter.

    You will see your structures there as *DW_TAG_structure_type* and *DW_AT_byte_size* attribute is equivalent to sizeof. Standard Unix tool should be enough to format this data into more readable list.

提交回复
热议问题