[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Makefile: create a splitdebug target ?
From: |
CdeMills |
Subject: |
Makefile: create a splitdebug target ? |
Date: |
Tue, 12 Jul 2011 02:41:21 -0700 (PDT) |
Hello,
in order to reduce the size of the binaries but keeping the ability to debug
generated code, an option is to use the technique explained in strip manual,
i.e.
- compile everything with the -g flag
- for each file containing executable code, install it as
# extract the debug information only
objcopy --only-keep-debug ${file}
${DEBUG_PREFIX}${DEBUG_BINDIR}${file}.dbg
# transfer the file to its final location
cp ${file} ${BINDIR}${file}
# strip it
objcopy --strip-debug ${BINDIR}${file}
# tell gdb how to find the DEBUG info
objcopy --add-gnu-debuglink=${DEBUG_PREFIX}${DEBUG_BINDIR}${file}.dbg
${BINDIR}${file}
The example is given with sh-like syntax, I'm not a wizard in "make" syntax.
The hierarchy would be
${PREFIX}: the base install dir, f.i. /usr
${DEBUG_PREFIX}: ${PREFIX} plus something specific, like "debug"
${DEBUG_BINDIR}: concatenation of ${DEBUG_PREFIX} and ${BINDIR}:
/usr/debug/usr/bin
${BINDIR}: {PREFIX}/bin as usual
this way, stripped version would go in /usr/bin and debug info in
/usr/debug/usr/bin, the last objcopy operation ensuring that gdb can find
the required debug info to interpret a core dump. Same thing for libs.
To implement this:
- add a target '--enable-splitdebug' in the config file, default false
- if this target is enabled, add a target 'install_splitdebug' in the
Makefile(s)
This should go into m4/aclocal.m4. I never went this deep into m4 details,
could someone give hints about implementing the idea ?
Regards
Pascal
--
View this message in context:
http://octave.1599824.n4.nabble.com/Makefile-create-a-splitdebug-target-tp3661851p3661851.html
Sent from the Octave - Maintainers mailing list archive at Nabble.com.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Makefile: create a splitdebug target ?,
CdeMills <=