[patch] better dwarf2 debug info for inlined functions

James E Wilson wilson@specifix.com
Tue Jul 26 02:57:00 GMT 2005

James E Wilson wrote:
> This patch improves the debug info generated for inlined function
> calls.  This is related to the binutils bug 947 and the gcc bug 20967.

Testing showed a problem, and I had to revise the patch.  I only needed 
a one line change which I should have had in the first place.  Anyways, 
this has been tested with bootstrap and regression tests on x86_64-linux 
and x86-freebsd.  It has also been tested with a bootstrap on 
powerpc-darwin, though that was a couple of weeks ago.

I tried looking at the effects of the patch as a few people asked.  I 
configured with --enable-gather-detailed-mem-stats and added a little 
debugging code.  I used the libraries, primarily libiberty and 
libstdc++, as testcases.  The percentage of blocks that are inline 
function blocks ranges from 0% to about 25%.  The additional memory 
allocation due to the increased size of the block trees worst case works 
out to about 0.1%.  That is, for a compile that allocates 50MB of ggc 
data, worst case we allocate about 50KB extra for the block trees.

Dan Berlin's suggestion of reorganizing the data structures to reduce 
the memory usage has merit, but I don't see any easy way to implement 
it, as we don't already have unique ids in the block trees.  If people 
think this is a good idea to look into, I think it should be a separate 

I have gone ahead and checked in the patch.

As mentioned before, addr2line in binutils already knows how to use the 
extra debug info, but gdb as yet does not.
Jim Wilson, GNU Tools Support, http://www.specifix.com

More information about the Gcc-patches mailing list