-g3 currently produces huge objects as it contains many unused macros.
-g2 produces no macros debug info so GDB cannot provide its expansion.

There is no way to store just the used macros.

(debuginfo compression driven by Roland McGrath may eliminate them but
still...)

While even a macro never used by a program can be helpful in most cases IMO it
is enough to provide the macro definitions touched by the code being debugged.

-feliminate-unused-debug-symbols -feliminate-unused-debug-types have no effect.

-------------------------------------------------------------------------------
#define NOT used
#define USED(x) x
int main (void) { return USED (0); }
-------------------------------------------------------------------------------

Getting:
gcc -g3 -o unusedmacro unusedmacro.c -Wall; readelf -wm unusedmacro
 DW_MACINFO_define - lineno : 1 macro : NOT used
 DW_MACINFO_define - lineno : 2 macro : USED(x) x

or:
gcc -g2 -o unusedmacro unusedmacro.c -Wall; readelf -wm unusedmacro
<nothing printed>

Expected output:
gcc -g3 -o unusedmacro unusedmacro.c -Wall; readelf -wm unusedmacro
 DW_MACINFO_define - lineno : 2 macro : USED(x) x


-- 
           Summary: DWARF .debug_macinfo contains unused macros
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: debug
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jan dot kratochvil at redhat dot com
GCC target triplet: x86_64-unknown-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42065

Reply via email to