Pahole: using debug symbols to examine data structures and their layout
Pahole is a nice utility that illustrates data structure layout for binaries that have debugging info (e.g. DWARF or CTF). Exceptionally useful for finding alignment/padding problems when you're trying to save a few extra bytes. Also helps determine structure size/member offsets.
Should be included in most distributions (often included in a package named 'dwarves' or some variation thereof).
Side note: objdump and readelf can also read DWARF data, albeit with somewhat less useful output.
Man page http://linux.die.net/man/1/pahole
Source is here http://git.kernel.org/?p=devel/pahole/pahole.git;a=summary
Original announcement http://lwn.net/Articles/206805/
0 comments · 100% upvoted · other discussions