On 24/09/12 00:44, Allan McRae wrote:
This patchset allows makepkg to automatically create packages from the stripped debugging symbols.
Patches 1, 4 and 6 are only mildly related... but a fixes that were "needed" along the way.
The idea is to add options=('debug') to your PKGBUILD or in makepkg.conf and then makepkg will add DEBUG_CFLAGS and DEBUG_CXXFLAGS (defined in makepkg.conf) to their buildflag counterparts.
When both "debug" and "strip" are specified in the options, the debug symbols are copied into a separate folder before the files are stripped. The main debugging symbols are in /usr/lib/debug/path/to/file (e.g. /usr/lib/debug/usr/bin/pacman) and are hardlinked if required. If the binary was linked with a build ID, the relevant symlinks in /usr/lib/debug/.build_id are created.
Testing is needed...
valgrind without debug package installed: ==27108== Invalid free() / delete / delete[] / realloc() ==27108== at 0x4029F8C: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) ==27108== by 0x8048760: ??? (in /usr/bin/foo) ==27108== by 0x41AD604: (below main) (in /usr/lib/libc-2.16.so) ==27108== Address 0x4342028 is 0 bytes inside a block of size 4 free'd ==27108== at 0x4029F8C: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) ==27108== by 0x8048754: ??? (in /usr/bin/foo) ==27108== by 0x41AD604: (below main) (in /usr/lib/libc-2.16.so) valgrind with debug package: ==27142== Invalid free() / delete / delete[] / realloc() ==27142== at 0x4029F8C: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) ==27142== by 0x8048760: main (test.cpp:8) ==27142== Address 0x4342028 is 0 bytes inside a block of size 4 free'd ==27142== at 0x4029F8C: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) ==27142== by 0x8048754: main (test.cpp:7) Similar things happen with gdb! Allan