Code Bloat g++

Martin v. Loewis
Fri Feb 18 13:23:00 GMT 2000

> Consider one of my .s files generated with GCC 2.95.2 with -O -g. The
> following random snippet is not an exception there, it is common! :-(

I've considered it. However, from my (probably shallow) analysis, it
seems that every line below is necessary.

> .stabn 192,0,0,.LLBB51616-CreatePTs__11HeuristicPT
> .stabn 192,0,0,.LLBB51617-CreatePTs__11HeuristicPT
> .stabn 224,0,0,.LLBE51617-CreatePTs__11HeuristicPT
> .stabn 224,0,0,.LLBE51616-CreatePTs__11HeuristicPT

For example, this means there is a lexical block starting at
.LLBB51617, going up to .LLBE51617. Around this block, there is
another block going from .LLBB51616 to .LLBE51616

> That is definitely not very compact and it's well possible that the
> project you mentioned experiences the same problem.

Maybe you've been confused by the fact that '192' and '224' above are
specific debugging constants, indicating LBRAC and RBRAC, so these
lines (and all the others) are certainly not meaningless.

Also, in the object file, each line translates to a 16-byte block: The
expressions '.LLBB51616-CreatePTs__11HeuristicPT' are evaluated by the
assembler, and don't appear there as text - so it is only in the
assembler file that you have to deal with the mangled names of
functions; to get the relative offset in the function.

Now, of course, I'm somewhat confused that this bracketing is included
in the debug information. I'd guess that the original function
(i.e. HeuristicPT::CreatePTs(void)) indeed contains as many left and
right brackets, as indicated above.

>From looking at binutil's stab.def, one purpose of left and right
bracket indication is to explain visibility of local variables to the
debugger. The local variables would normally precede the LBRAC, and
would be indicated by a stabs 128 (LSYM). In this case, they certainly
don't serve this purpose - the blocks in questions don't have any

Perhaps the LBRAC and RBRAC records serve an additional purpose even
in absence of any local variables? Or, would it be possible to
eliminate these records of there are no automatic variables in a
block? Any comments appreciated.


More information about the Gcc mailing list