Package: python3.7 Version: 3.7.4-2 Severity: normal Hi. Currently the build flags the 'sysconfig' module reports for building extension modules contain '-flto'. Presumably this speeds something up somewhere, but it breaks debugging: when built this way gdb isn't able to step through the C code of the extension module. This is a known and documented side-effect of link-time optimization (see the gcc manpage, for instance). Can we not do -flto for extension modules? To be clear, this bug report is about building extension modules, not the python interpreter itself.
There're a number of sysconfig variables that mention flto: dima@scrawny:~$ python3 -msysconfig | grep flto CFLAGS = "-Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -flto -fuse-linker-plugin -ffat-lto-objects" PY_BUILTIN_MODULE_CFLAGS = "-Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -flto -fuse-linker-plugin -ffat-lto-objects -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wno-cast-function-type -Werror=implicit-function-declaration -IObjects -IInclude -IPython -I. -I../Include -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DPy_BUILD_CORE_BUILTIN" PY_CFLAGS = "-Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -flto -fuse-linker-plugin -ffat-lto-objects" PY_CORE_CFLAGS = "-Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -flto -fuse-linker-plugin -ffat-lto-objects -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wno-cast-function-type -Werror=implicit-function-declaration -IObjects -IInclude -IPython -I. -I../Include -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DPy_BUILD_CORE" I want to say CFLAGS is the one used for extension modules, but I'm not 100% sure. Is there currently a mechanism for using different flags for extension modules as opposed to the interpreter guts? If not, I guess I'm asking for those. Thanks -- System Information: Debian Release: bullseye/sid APT prefers unstable APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental') Architecture: amd64 (x86_64) Foreign Architectures: armhf Kernel: Linux 4.19.0-5-amd64 (SMP w/2 CPU cores) Kernel taint flags: TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968) (ignored: LC_ALL set to C), LANGUAGE=C (charmap=ANSI_X3.4-1968) (ignored: LC_ALL set to C) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled Versions of packages python3.7 depends on: ii libpython3.7-stdlib 3.7.4-2 ii mime-support 3.62 ii python3.7-minimal 3.7.4-2 python3.7 recommends no packages. Versions of packages python3.7 suggests: ii binutils 2.32.51.20190707-1 ii python3.7-doc 3.7.4-2 pn python3.7-venv <none> -- no debconf information