Missing debug symbols in release archives
I was looking into PyPy's debugging information, and it seems that PyPy release tarballs for Linux ( like https://downloads.python.org/pypy/pypy3.7-v7.3.5-linux64.tar.bz2 ) do not contain DWARF debug information, even though "debug" files are provided. The provided debug files only contain the
.symtab section, which does not allow for debugging / single-stepping / and do not contain function & line information.
Notice the "No debugging symbols found in ./bin/libpypy3-c.so.debug" output in the GDB invocation below:
vic@lapdog: /tmp/tmp.jUIt3BCVdR/pypy3.7-v7.3.5-linux64$ gdb ./bin/libpypy3-c.so.debug GNU gdb (Debian 10.1-2) 10.1.90.20210103-git [...] Reading symbols from ./bin/libpypy3-c.so.debug... (No debugging symbols found in ./bin/libpypy3-c.so.debug)
Would it be possible to add the
-g flag to the build? It seems that the rest of the release tooling already does the right thing: see https://foss.heptapod.net/pypy/pypy/-/blob/branch/default/pypy/tool/release/smartstrip.py#L18 - by invoking
objcopy --only-keep-debug. The resulting (stripped) executable should be the same, but the debug file would also contain additional sections like .debug_info, which allows tools like GDB and symbolizers to work nicely.
I am entirely new to PyPy so I'm not quite sure how best to approach that. As far as I understand (not much yet :) ) it looks like there are 2 options for this:
CFLAGSenvironment variable in the release build environment (not sure how it looks like / where it is defined)
-gto the compiler parameters explicitly (here: https://foss.heptapod.net/pypy/pypy/-/blob/branch/default/rpython/translator/platform/linux.py#L16 unless I'm completely mistaken)
What would be recommended here?