From Debian's DebugPackage, I know the debug information file for an executable goes in /usr/lib/debug
when creating two part executables (i.e., stripping the executable of its symbols and placing them in a separate file).
However, the symbol file will refer to source files, and I don't see where the source files are supposed to be placed. On Red Hat/Fedora, I know they are located in /usr/src/debug
(according to Fedora's Packaging:Debuginfo).
Where do I put source files for debugging on Debian?
A concrete example is Crypto++. I have a patch for its GNUMakefile
that adds the following:
IS_DEBIAN = $(shell uname -a 2>&1 | $(EGREP) -i -c "debian|ubuntu|mint")
...
# http://ift.tt/1ECVxs0
ifeq ($(IS_DEBIAN),1)
DEBUG_SYM_DIR ?= /usr/lib/debug/cryptopp
DEBUG_SRC_DIR ?= /usr/src/debug/cryptopp
endif
...
And then there's a symbol recipe that looks like so:
symbol symbols:
$(MKDIR) -p $(DEBUG_SYM_DIR) $(DEBUG_SRC_DIR)
-objcopy --only-keep-debug cryptest.exe cryptest.exe.debug
-objcopy --only-keep-debug libcryptopp.so libcryptopp.so.debug
-strip --strip-debug --strip-unneeded cryptest.exe
-strip --strip-debug --strip-unneeded libcryptopp.so
-$(CP) cryptest.exe.debug $(DEBUG_SYM_DIR)/
-$(CP) libcryptopp.so.debug $(DEBUG_SYM_DIR)/
-objcopy --add-gnu-debuglink=$(DEBUG_SYM_DIR)/cryptest.exe.debug cryptest.exe
-objcopy --add-gnu-debuglink=$(DEBUG_SYM_DIR)/libcryptopp.so.debug libcryptopp.so
-$(CP) *.h *.cpp $(DEBUG_SRC_DIR)/
So the workflow is:
cd cryptopp
make static dynamic test
sudo make symbols
sudo make install
Related, but not relevant (in case someone wants to comment): I can't add symbols as a dependency to another recipe or just make symbols
because of a bug in objcopy
(I believe its a bug - see Binutil Bug 18064 - objcopy, add-gnu-debuglink and "cannot fill debug link section").
Aucun commentaire:
Enregistrer un commentaire