Re: [ANNOUNCE] pahole and other DWARF2 utilities

Arnaldo Carvalho de Melo
2006-10-31T17:22:51Z

On Mon, Oct 30, 2006 at 08:33:34PM -0800, Andrew Morton wrote:
> On Mon, 30 Oct 2006 18:33:19 -0300
> Arnaldo Carvalho de Melo <acme@mandriva.com> wrote:
>
> > I've been working on some DWARF2 utilities and thought that it
> > is about time I announce it to the community, so that what is already
> > available can be used by people interested in reducing structure sizes
> > and otherwise taking advantage of the information available in the elf
> > sections of files compiled with 'gcc -g' or in the case of the kernel
> > with CONFIG_DEBUG_INFO enabled, so here it goes the description of said
> > tools:
> >
> > pahole: Poke-a-Hole is a tool to find out holes in structures, holes
> > being defined as the space between members of functions due to alignemnt
> > rules that could be used for new struct entries or to reorganize
> > existing structures to reduce its size, without more ado lets see what
> > that means:
> >
> > ...
> >
> > Further ideas on how to use the DWARF2 information include tools
> > that will show where inlines are being used, how much code is added by
> > inline functions,
>
> It would be quite useful to be able to identify inlined functions which are
> good candidates for uninlining.

I'm working on making good use of this information:

--------------- 8< --------------

3.3.8.2 Concrete Inlined Instances

Each inline expansion of an inlinable subroutine is represented by a
debugging information entry with the tag DW_TAG_inlined_subroutine.
Each such entry should be a direct child of the entry that represents
the scope with in which the inlining occurs.

--------------- 8< --------------

To write this tool:

<Ralf> So imagine a tool which says function x was inlined y times
bloating the code by z bytes :)

:-)

- Arnaldo