Revised the debug info patches...
cover Revised the debug info patches...
After talking with Richard a bit, I've revised the configuration of the debug info, patch 2 of 4. 1, 3 and 4 remain unchanged.
The primary difference is to change the naming from "debian style", and "fedora style" to a more accurate representation based on the GDB documentation and usage I recently found. In addition to the simple name changing, the source code copying is now defined for both styles and simply places the code in /usr/src/debug.
Pull URL: git://git.pokylinux.org/poky-contrib.git
Branch: mhatle/debuginfo
Browse: http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=mhatle/debuginfo
Thanks,
Mark Hatle <[email protected]>
---
Mark Hatle (4):
package.bbclass: Breakout the strip from the populate_packages Revise stripping and splitting of debug information package.bbclass: Refactor split and strip function
recipes: pre/post actions
meta/classes/insane.bbclass | 4 +- meta/classes/package.bbclass | 325 +++++++++++++++++--- meta/conf/bitbake.conf | 9 +- meta/conf/local.conf.sample | 31 ++ meta/recipes-bsp/hostap/hostap-conf_1.0.bb | 4 +- meta/recipes-bsp/lrzsz/lrzsz_0.12.20.bb | 4 +- meta/recipes-bsp/orinoco/orinoco-conf_1.0.bb | 4 +- .../libnss-mdns/libnss-mdns_0.10.bb | 4 +- .../ppp-dialin/ppp-dialin_0.1.bb | 4 +- .../recipes-core/base-passwd/base-passwd_3.5.22.bb | 2 +- meta/recipes-core/dropbear/dropbear.inc | 4 +- .../sgml-common/sgml-common_0.6.3.bb | 4 +- meta/recipes-extended/bash/bash.inc | 2 +- meta/recipes-extended/bash/bash_3.2.48.bb | 2 +- meta/recipes-extended/sudo/sudo.inc | 2 +- .../ttf-fonts/liberation-fonts_1.04.bb | 2 +- .../ttf-fonts/liberation-fonts_1.06.bb | 2 +- .../ttf-fonts/ttf-bitstream-vera_1.10.bb | 2 +- .../update-modules/update-modules_1.0.bb | 2 +- 19 files changed, 344 insertions(+), 69 deletions(-)
Signature · 1 line
1.7.3.4
PATCH 2/4 Revise stripping and splitting of debug information
We now support two styles of debug information generation, the '.debug' style, which is the same as previously implemented. This style simply splits the debug information and makes it available in the same general directory.
/bin/foo -> /bin/.debug/foo
The new 'debug-file-directory' style splits the debug information and places it into the single debug-file-directory, /usr/lib/debug:
/bin/foo -> /usr/lib/debug/bin/foo.debug
Both also find and copy all referenced source code to a new /usr/src/debug directory. This allows the -dbg files to be used for stand-a-lone debugging on or off the target device.
File stripping is now handled as a seperate operation from file splitting. This allows us to split the debug information, but also leave it in the original file -- or prevent the debug information from being split.
Also enhance the comments within local.conf.sample to provide a better understanding of the control the user has over debug file generation.
--- meta/classes/insane.bbclass | 4 +- meta/classes/package.bbclass | 233 +++++++++++++++++++++++++++++++++++++----- meta/conf/bitbake.conf | 9 ++- meta/conf/local.conf.sample | 31 ++++++ 4 files changed, 246 insertions(+), 31 deletions(-)
meta/classes/insane.bbclass +2 -2
@@ -192,8 +192,8 @@ def package_qa_check_dev(path, name,d, elf): sane = True - if not name.endswith("-dev") and path.endswith(".so") and os.path.islink(path): - error_msg = "non -dev package contains symlink .so: %s path '%s'" % \ + if not name.endswith("-dev") and not name.endswith("-dbg") and path.endswith(".so") and os.path.islink(path): + error_msg = "non -dev/-dbg package contains symlink .so: %s path '%s'" % \ (name, package_qa_clean_path(path,d)) sane = package_qa_handle_error(0, error_msg, name, path, d)
meta/classes/package.bbclass +205 -26
291 lines not on this page · raw message
meta/conf/bitbake.conf +7 -2
@@ -242,9 +242,14 @@ SECTION_${PN}-dev = "devel" ALLOW_EMPTY_${PN}-dev = "1" RDEPENDS_${PN}-dev = "${PN} (= ${EXTENDPV})" -FILES_${PN}-dbg = "${bindir}/.debug ${sbindir}/.debug ${libexecdir}/.debug ${libdir}/.debug \ +DOTDEBUG-dbg = "${bindir}/.debug ${sbindir}/.debug ${libexecdir}/.debug ${libdir}/.debug \ ${base_bindir}/.debug ${base_sbindir}/.debug ${base_libdir}/.debug ${libdir}/${PN}/.debug \ - ${libdir}/matchbox-panel/.debug" + ${libdir}/matchbox-panel/.debug /usr/src/debug" + +DEBUGFILEDIRECTORY-dbg = "/usr/lib/debug /usr/src/debug" + +FILES_${PN}-dbg = "${@bb.data.getVar(['DOTDEBUG-dbg', 'DEBUGFILEDIRECTORY-dbg'][bb.data.getVar('PACKAGE_DEBUG_SPLIT_STYLE', d, 1) == 'debug-file-directory'], d, 1)}" + SECTION_${PN}-dbg = "devel" ALLOW_EMPTY_${PN}-dbg = "1" RRECOMMENDS_${PN}-dbg = "${PN} (= ${EXTENDPV})"
meta/conf/local.conf.sample +31 -0
@@ -106,6 +106,37 @@ USER_CLASSES ?= "image-mklibs image-prelink" # <build directory>/tmp #TMPDIR = "${POKYBASE}/build/tmp" +# The following are used to control options related to debugging. +# +# Uncomment this to change the optimization to make debugging easer, at the +# possible cost of performance. +# DEBUG_BUILD = "1" +# +# Uncomment this to disable the stripping of the installed binaries +# INHIBIT_PACKAGE_STRIP = "1" +# +# Uncomment this to disable the split of the debug information into -dbg files +# INHIBIT_PACKAGE_DEBUG_SPLIT = "1" +# +# When splitting debug information, the following controls the results of the +# file splitting. +# +# .debug (default): +# When splitting the debug information will be placed into +# a .debug directory in the same dirname of the binary produced: +# /bin/foo -> /bin/.debug/foo +# +# debug-file-directory: +# When splitting the debug information will be placed into +# a central debug-file-directory, /usr/lib/debug: +# /bin/foo -> /usr/lib/debug/bin/foo.debug +# +# Any source code referenced in the debug symbols will be copied +# and made available within the /usr/src/debug directory +# +PACKAGE_DEBUG_SPLIT_STYLE = '.debug' +# PACKAGE_DEBUG_SPLIT_STYLE = 'debug-file-directory' + # Uncomment these to build a package such that you can use gprof to profile it. # NOTE: This will only work with 'linux' targets, not # 'linux-uclibc', as uClibc doesn't provide the necessary
Signature · 1 line
1.7.3.4
Op 11 feb 2011, om 16:44 heeft Mark Hatle het volgende geschreven:
Quoted 8 lines
After talking with Richard a bit, I've revised the configuration of the debug info, patch 2 of 4. 1, 3 and 4 remain unchanged.
The primary difference is to change the naming from "debian style", and "fedora style" to a more accurate representation based on the GDB documentation and usage I recently found. In addition to the simple name changing, the source code copying is now defined for both styles and simply places the code in
/usr/src/debug.
Is there a bbclass planned to populate /usr/src(/debug)? It would help people wanting to do external rebuilds of our (patched) sources.
regards,
Koen
Quoted 6 lines · Koen Kooi
Op 11 feb 2011, om 16:44 heeft Mark Hatle het volgende geschreven:
Quoted 3 lines
After talking with Richard a bit, I've revised the configuration of the debug info, patch 2 of 4. 1, 3 and 4 remain unchanged.
Quoted 7 lines
Quoted 5 lines
The primary difference is to change the naming from "debian style", and "fedora style" to a more accurate representation based on the GDB documentation and usage I recently found. In addition to the simple name changing, the source code copying is now defined for both styles and simply places the code in
/usr/src/debug.Is there a bbclass planned to populate /usr/src(/debug)? It would help people wanting to do external rebuilds of our (patched) sources.
The two halves of the splitfile function (splitfile and splitfile2) generate the /usr/src/debug.
In the splitfile, before the files are actually split, a component called "debugedit" (a standard part of rpm) is run.
os.system("%s'%s' -b '%s' -d '%s' -i -l '%s' '%s'" % (pathprefix, debugedit, workdir, debugsrcdir, sourcefile, file))
debugedit -b ${WORKDIR} -d '/usr/src/debug' -i -l '${WORKDIR}/debugsources.list' '<file>'
The debugedit program does two things. The first is it scans the <file> looking for dwarf source references. Upon finding those references it captures the original file name (places it into the ${WORKDIR}/debugsources.list), and then replaces the ${WORKDIR} part of the file name with the /usr/src/debug path.
Later after everything is processed and the debugsources.list contains a full list of referenced sources the following script is executed:
processdebugsrc = "LC_ALL=C ; sort -z -u '%s' | egrep -v -z '(<internal>|<built-in>)$' | "
processdebugsrc += "(cd '%s' ; cpio -pd0mL '%s%s' 2>/dev/null)"
os.system(processdebugsrc % (sourcefile, workdir, dvar, debugsrcdir))
In otherwords, we sort the list (null separated), and remove references to gcc internal and builtin functions. The result of the list is passed to cpio which performs a copy of all of the referenced files to the dvar/usr/src/debug directory.
----
So that's how it works, and what it does.. As far as a bbclass, it's part of the standard packaging BBCLASS, I would have thought this could be used, even by external people given the right inputs to package/repackage external files. There is nothing Poky specific in this code -- other then it expects the binaries coming in to not be stripped. (If they are, a warning is issues.)
--Mark
Quoted 3 lines
regards,
Koen
Quoted 9 lines · Mark Hatle
After talking with Richard a bit, I've revised the configuration of the debug info, patch 2 of 4. 1, 3 and 4 remain unchanged.
The primary difference is to change the naming from "debian style", and "fedora style" to a more accurate representation based on the GDB documentation and usage I recently found. In addition to the simple name changing, the source code copying is now defined for both styles and simply places the code in
/usr/src/debug.
Quoted 3 lines
Pull URL:
git://git.pokylinux.org/poky-contrib.git
Branch: mhatle/debuginfo
Browse: http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=mhatle/debuginfo
I've taken patch 1 and 4, I'll leave 2 and 3 until after the weekend as they need a little more review.
Cheers,
Richard