Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/scripts/libmakepkg
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2016-09-01 16:37:50 +1000
committerAllan McRae <allan@archlinux.org>2016-11-02 15:03:57 +1000
commita79c0038ae84c38fe063bd7426a839f3c01c10e8 (patch)
tree5b0871b1b712f75fded16d5354aa4845a23be2bf /scripts/libmakepkg
parentfa06951d90fee028ece95fc7caab39fc7d35d55f (diff)
[RFC] Provide source files for useful debug packages
Debug packages are fairly useless currently because the soucre files needed for stepping through code etc are not packaged with them. This patch adds the needed source files to the debug package and adjusts the debug info to look at the /usr/src/debug/ directory for them rather than the build location. This requires using the "debugedit" program which is provided as part of the RPM sources. Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'scripts/libmakepkg')
-rw-r--r--scripts/libmakepkg/tidy/strip.sh.in20
1 files changed, 19 insertions, 1 deletions
diff --git a/scripts/libmakepkg/tidy/strip.sh.in b/scripts/libmakepkg/tidy/strip.sh.in
index 1c7aacfd..bd5c79a0 100644
--- a/scripts/libmakepkg/tidy/strip.sh.in
+++ b/scripts/libmakepkg/tidy/strip.sh.in
@@ -35,6 +35,11 @@ build_id() {
LANG=C readelf -n $1 | sed -n '/Build ID/ { s/.*: //p; q; }'
}
+source_files() {
+ LANG=C readelf $1 --debug-dump | \
+ awk '/DW_AT_name +:/{name=$8}/DW_AT_comp_dir +:/{print $8 "/" name}'
+}
+
strip_file() {
local binary=$1; shift
@@ -50,6 +55,18 @@ strip_file() {
return
fi
+ # copy source files to debug directory
+ local f t
+ for f in $(source_files "$binary"); do
+ t=${f/$srcdir/$dbgsrc}
+ mkdir -p "${t%/*}"
+ cp "$f" "$t"
+ done
+
+ # adjust debug symbols to point at sources
+ debugedit -b "${srcdir}" -d /usr/src/debug/ -i "$binary" &> /dev/null
+
+ # copy debug symbols to debug directory
mkdir -p "$dbgdir/${binary%/*}"
objcopy --only-keep-debug "$binary" "$dbgdir/$binary.debug"
objcopy --add-gnu-debuglink="$dbgdir/${binary#/}.debug" "$binary"
@@ -89,7 +106,8 @@ tidy_strip() {
if check_option "debug" "y"; then
dbgdir="$pkgdir-@DEBUGSUFFIX@/usr/lib/debug"
- mkdir -p "$dbgdir"
+ dbgsrc="$pkgdir-@DEBUGSUFFIX@/usr/src/debug"
+ mkdir -p "$dbgdir" "$dbgsrc"
fi
local binary strip_flags