]> sourceware.org Git - systemtap.git/commitdiff
step-prep: check for debuginfod capability
authorFrank Ch. Eigler <fche@redhat.com>
Tue, 27 Oct 2020 02:01:24 +0000 (22:01 -0400)
committerFrank Ch. Eigler <fche@redhat.com>
Tue, 27 Oct 2020 02:04:08 +0000 (22:04 -0400)
Test /usr/bin/debuginfod-find for a vdso*so in the kernel.  If
successful, avoid downloading big kernel debuginfo files now,
assuming that the debuginfo server(s) will remain available.

NEWS
man/stap-prep.1
stap-prep

diff --git a/NEWS b/NEWS
index 6fc62b0f4f4223590aa69f95c614a9e2729e5dc5..f92551488f437f1f4842d271efa1539e90958572 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,8 @@
 * What's new in version 4.4
 
+- stap-prep now avoids downloading kernel debuginfo if a successful
+  connection to debuginfod server is made. 
+
 - The locks required to protect concurrent access to global variables
   has been optimized with a "pushdown" algorithm, so that they span
   the smallest possible critical region.  Formerly, and with
index 3da64da6976d4d78d61806a36eb7d13c47656dbd..da71a6aa4f481bb3f9b4538168727d26f101a5f4 100644 (file)
@@ -36,6 +36,11 @@ installing kernel headers, debug symbols and build tools that match
 the currently running kernel or optionally the kernel version given by
 the user.
 
+If the debuginfod\-find tool is installed and is able to fetch
+debuginfo for a kernel component, it is assumed to remain available
+later.  In this case, no debug symbols will be downloaded during
+stap\-prep.
+
 The exact behavior of stap\-prep may be customized by the
 distribution maintainers. It might for example only give suggestions
 and not actually install the required packages if that is difficult to
@@ -49,6 +54,7 @@ Please install linux-image-3.2.0-2-amd64-dbg
 
 .SH SEE ALSO
 .nh
+.BR http://sourceware.org/elfutils/Debuginfod.html
 .nf
 .IR stap (1)
 
index ec061a828ccd8510eea6348efc59b438fb0fc54e..fd0c7e83b26546efe6b06732941ae250c5a2c930 100755 (executable)
--- a/stap-prep
+++ b/stap-prep
@@ -4,18 +4,34 @@ PATH=/usr/sbin:/sbin:/usr/bin:/bin:$PATH; export PATH
 
 check_error() { if test $1 != 0; then printf "\n$2\n"; exit $1; fi }
 
-prep_rpm_based() {
-# uname -r can produce different kinds of output:
-# 2.6.32-30.el6.x86_64 (no variant, but including ".arch")
-# 2.6.18-194.3.1.el5debug ("variant", without dot, no arch)
-# 2.6.33.4-95.fc13.i686.PAE (".arch.variant", two dots)
-# 3.18.6-100.fc20.i686+PAE (".arch+variant", dot, plus)
+
 if [ "$#" -lt 1 ]; then
     UNAME=`uname -r` # determine the kernel running on the machine
 else
     UNAME=$1 #user passed in uname value
 fi
 UNAME=`echo $UNAME | sed "s/ //"` #strip out any whitespace
+echo "Configuring for kernel release $UNAME"
+
+
+# See if the configured debuginfod
+DEBUGINFOD=0
+prep_debuginfod() {
+    # choose a part of the kernel that elfutils 0.181 can decode
+    vdso=`ls -1 /lib/modules/$UNAME/vdso/*.so 2>/dev/null | head -1` # vdso32.so and/or vdso64.so or whatever
+    if debuginfod-find debuginfo "$vdso" > /dev/null 2>&1; then
+        DEBUGINFOD=1
+        echo "Will use debuginfod DEBUGINFOD_URLS=$DEBUGINFOD_URLS to fetch debuginfo."
+    fi
+}
+
+
+prep_rpm_based() {
+# uname -r can produce different kinds of output:
+# 2.6.32-30.el6.x86_64 (no variant, but including ".arch")
+# 2.6.18-194.3.1.el5debug ("variant", without dot, no arch)
+# 2.6.33.4-95.fc13.i686.PAE (".arch.variant", two dots)
+# 3.18.6-100.fc20.i686+PAE (".arch+variant", dot, plus)
 KERNEL="kernel"
 for VARIANT in debug kdump PAE xen; do
   # strip out ".variant" or else "+variant" or else "variant" at end.
@@ -37,8 +53,10 @@ else
 fi
 CANDIDATES="$KERNEL-$KERN_REV.$KERN_ARCH \
   $KERNEL-devel-$KERN_REV.$KERN_ARCH \
-  $DI_DEPS \
-  $KERNEL-debuginfo-$KERN_REV.$KERN_ARCH"
+  $DI_DEPS"
+if [ "$DEBUGINFOD" -eq 0 ]; then # add debuginfo search if not already 
+    CANDIDATES="$CANDIDATES $KERNEL-debuginfo-$KERN_REV.$KERN_ARCH"
+fi
 NEEDED=`rpm --qf "%{name}-%{version}-%{release}.%{arch}\n" \
     -q $CANDIDATES | grep "is not installed" | awk '{print $2}'`
 if [ "$NEEDED" != "" ]; then
@@ -56,6 +74,8 @@ if [ "$NEEDED" != "" ]; then
 fi
 }
 
+
+
 prep_deb_based() {
 if [ $# -ne 0 ]; then
     echo "Specifying kernel version is not yet support on deb based systems." 1>&2
@@ -93,7 +113,9 @@ esac
     echo "make >= 0"
     echo "linux-image-$ABINAME = $VERSION"
     echo "linux-headers-$ABINAME = $VERSION"
-       echo "linux-image-$ABINAME-dbgsym = $VERSION"
+    if [ "$DEBUGINFOD" -eq 0 ]; then # add dbgsym search if not already 
+        echo "linux-image-$ABINAME-dbgsym = $VERSION"
+    fi
 ) | while read package relation requiredversion; do
     installedversion="$(dpkg-query -W "$package" 2> /dev/null | cut -f 2)"
     if [ "$installedversion" = "" ]; then
@@ -130,6 +152,8 @@ if [ "$user" != "root" ]; then
 fi
 }
 
+
+prep_debuginfod "$@"
 DISTRO="$(lsb_release --id --short 2> /dev/null)"
 case "$DISTRO" in
 Debian|Ubuntu)
This page took 0.032584 seconds and 5 git commands to generate.