DWARF question about size of a variable

Eric Botcazou botcazou@adacore.com
Wed Jun 8 22:57:22 GMT 2022

> Is there dwarf information that gives the size of a variable?  I have a
> test case which when run on Intel gdb can print the size of an
> optimized out variable.  However on PowerPC, gdb says the size
> information for the variable is optimized out.  Is there some DWARF
> information that I can print on the Intel binary that shows the size
> information for the variable even though the variable is optimized out?
> Then by comparison on PowerPC I would expect the DWARF information
> would either say the size of the variable is optimized out or there is
> no information available.

If you try to debug at an optimization level higher than -Og, your mileage may 
vary and depend on various factors; that's apparently an example where the 
debug info is slightly less damaged at -O3 on x86 than on PowerPC, but there 
are probably cases where this will be the other way around.

Eric Botcazou

More information about the Gcc mailing list