[cfe-commits] [PATCH] "-gline-tables-only" flag for Clang

Chris Lattner clattner at apple.com
Wed Apr 25 10:49:09 PDT 2012


On Apr 25, 2012, at 4:51 AM, Alexey Samsonov wrote:

> Hi, cfe-commits!
> 
> This patch adds a new Clang compiler flag "-gline-tables-only". It should reduce the amount of emitted debug information:
> 1) DIEs in .debug_info should only have types DW_TAG_compile_unit, DW_TAG_subprogram, DW_TAG_inlined_subroutine (for opt builds), DW_TAG_lexical_block.
> 2) .debug_str should only contain function names
> 3) No debug data for types/namespaces/variables should be emitted.
> 4) The data in .debug_line should be enough to produce valid stack traces with function names and line numbers.
> 
> This flag can reduce the size of the binary by some factor, but still allow to obtain valid stack traces (both for debug and opt builds, and for inlined functions).
> Results of measurements on SPEC CPU 2006 benchmarks (for Clang r155349):
> 
> binary size increase factor for:
> "-O0 -g": average - 2x, max - 5.85x
> "-O0 -gline-tables-only": average - 1.2x, max - 1.44x
> "-O2 -g": average - 3.45x, max - 11x
> "-O2 -gline-tables-only": average - 1.47x, max - 2.76x

I really like this approach.  One question about the internal modeling of this: instead of treating this as another bool  in CodeGenOpts, should it turn into an enum along the lines of  { NoDebugInfo, LineTablesOnly, LimitedDebug, Full Debug }?

-Chris



More information about the cfe-commits mailing list