bpo-30345: Add -g to LDFLAGS to ease debug by vstinner · Pull Request #7709 · python/cpython (original) (raw)

We already always pass -g to CFLAGS, even in release mode.

Extract of gcc manual page:

       -g  Produce debugging information in the operating system's native
           format (stabs, COFF, XCOFF, or DWARF).  GDB can work with this
           debugging information.

           On most systems that use stabs format, -g enables use of extra
           debugging information that only GDB can use; this extra information
           makes debugging work better in GDB but probably makes other
           debuggers crash or refuse to read the program.  If you want to
           control for certain whether to generate the extra information, use
           -gstabs+, -gstabs, -gxcoff+, -gxcoff, or -gvms (see below).

It's unrelated to optimizations. It's just an option to ask to include also debug symbols in the produced binary file (like ELF file on Linux).

If you want to get ride of them, just run "strip python". Linux vendors are able to distribute these debug symbols in a different package, like python-debuginfo on Fedora.

I'm not 100% sure, that's why I'm asking for a review :-)