summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Douglas <william.douglas@intel.com>2013-03-06 15:18:17 -0800
committerWilliam Douglas <william.douglas@intel.com>2013-03-06 15:18:17 -0800
commit343c985ee3f8e027386fec73da1c63f827e48a03 (patch)
tree64656cd217114286d179ec51f4f4c515d3415783
parent999ee984d8081e82a06dcedd928b40f9d63818ce (diff)
downloadrpm-343c985ee3f8e027386fec73da1c63f827e48a03.tar.gz
rpm-343c985ee3f8e027386fec73da1c63f827e48a03.tar.bz2
rpm-343c985ee3f8e027386fec73da1c63f827e48a03.zip
In order to get minimal backtraces in gdb without installing debug-info packages strip packages with eu-strip -g. Also check for kernel modules and strip them without attempting to leave minimal function symbols in place (as this does not work correctly). Signed-off-by: William Douglas <william.douglas@intel.com>
-rw-r--r--scripts/find-debuginfo.sh41
1 files changed, 16 insertions, 25 deletions
diff --git a/scripts/find-debuginfo.sh b/scripts/find-debuginfo.sh
index 82dd150f4..50ceb18ef 100644
--- a/scripts/find-debuginfo.sh
+++ b/scripts/find-debuginfo.sh
@@ -95,13 +95,18 @@ debugdir="${RPM_BUILD_ROOT}/usr/lib/debug"
strip_to_debug()
{
- local g=
local r=
$strip_r && r=--reloc-debug-sections
- $strip_g && case "$(file -bi "$2")" in
- application/x-sharedlib*) g=-g ;;
+ case $2 in
+ *.ko)
+ # don't attempt to create a minimal backtrace binary for
+ # kernel modules as this just causes the stripping process
+ # to be skipped entirely
+ eu-strip --remove-comment $r -f "$1" "$2" || exit
+ ;;
+ *)
+ eu-strip --remove-comment -g -f "$1" "$2" || exit
esac
- eu-strip --remove-comment $r $g -f "$1" "$2" || exit
chmod 444 "$1" || exit
}
@@ -267,8 +272,6 @@ while read nlinks inum f; do
fi
echo "extracting debug info from $f"
- mode=$(stat -c %a "$f")
- chmod +w "$f"
id=$($(DEBUGEDIT=$(which debugedit 2>/dev/null); \
echo ${DEBUGEDIT:-/usr/lib/rpm/debugedit}) -b "$RPM_BUILD_DIR" \
-d /usr/src/debug -i -l "$SOURCEFILE" "$f") || exit
@@ -291,25 +294,13 @@ while read nlinks inum f; do
esac
mkdir -p "${debugdn}"
- objcopy --only-keep-debug $f $debugfn || :
- (
- shopt -s extglob
- strip_option="--strip-all"
- case "$f" in
- *.ko)
- strip_option="--strip-debug" ;;
- *$STRIP_KEEP_SYMTAB*)
- if test -n "$STRIP_KEEP_SYMTAB"; then
- strip_option="--strip-debug"
- fi
- ;;
- esac
- if test "$NO_DEBUGINFO_STRIP_DEBUG" = true ; then
- strip_option=
- fi
- objcopy --add-gnu-debuglink=$debugfn -R .comment -R .GCC.command.line $strip_option $f
- chmod $mode $f
- ) || :
+ if test -w "$f"; then
+ strip_to_debug "${debugfn}" "$f"
+ else
+ chmod u+w "$f"
+ strip_to_debug "${debugfn}" "$f"
+ chmod u-w "$f"
+ fi
if [ -n "$id" ]; then
make_id_link "$id" "$dn/$(basename $f)"