As part of https://fedoraproject.org/wiki/Features/EasierPythonDebugging
I needed to drop a python file into the location where gdb 7 can
autoload it (same absolute path as the ELF file with a -gdb.py suffix)
I didn't know of a way to add custom content to the debuginfo package,
so I first tried putting the file here:
but doing so generated lots of noise from ldconfig of the form:
"/usr/lib/libpython2.6.so.1.0-gdb.py is not an ELF file - it has the
wrong magic bytes at the start."
(I filed this as bug 562980)
Given that these .py files are only really usable when the .debug files
are available (they use the DWARF debug data), I tried putting them
(note that the debug path is /usr/lib/debug for both 32/64 bit)
and it turned out that doing so adds the .py file to the debuginfo
Digging into this, my reading is that /usr/lib/rpm/redhat/macros defines
%__debug_package to use "debugfiles.list", and it appears
that /usr/lib/rpm/find-debuginfo.sh adds everything below /usr/lib/debug
(and /usr/src/debug) this file (via "LISTFILES").
Hence by installing the .py file below /usr/lib/debug it seems to ensure
that it is added to the -debuginfo subpackage (if it doesn't, then the
rpmbuild ought to fail since the debug-gdb.py payload file would be
How sane is this? It seems to work, sidesteps the ldconfig issue, and
the end result seems like the right result, but the method feels a
little like a hack; I stumbled on this by accident. Is this a
reasonable thing to do going forward? can this be supported in rpm?
Arguably I may need to ensure the files get byte-compiled as well (using
the same version of python as gdb is linked against).