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")
...
# https://wiki.debian.org/DebugPackage
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").
make install
, I often find I need to step into library code to figure to how to work with it. And GDB expects things in certain places (which is often platform specific). So you can think of it as a packaging question, but its really a question of "where do things go so I can debug it after installation". – jww Mar 1 at 2:36dbg
packages. Maybe take a look at some of those to check out the locaion of things? – Faheem Mitha Mar 1 at 2:44