From: Fabian Holler Date: Thu, 22 Aug 2013 09:34:05 +0000 (+0200) Subject: add script to create liveboot kernel debug archives X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=6cef563017c72059d0b04444135bee2ae699b8d0;p=profitbricks%2Fjenkins-build-scripts.git add script to create liveboot kernel debug archives The script downloads the sources and debug symbols for ethoip6 and the profitbricks-linux-pserver kernel that are installed on a liveboot. From the extracted files a tar.xz archive is created that contains everything what is needed to debug kernel oopses. The archives is stored at /srv/liveboot/debug_archives on the jenkins build server --- diff --git a/liveboot-dbg-tar/README b/liveboot-dbg-tar/README new file mode 100644 index 0000000..eb2bf52 --- /dev/null +++ b/liveboot-dbg-tar/README @@ -0,0 +1,8 @@ +How to debug with gdb +===================== +* Load the module with debugging symbols into gdb: + $ gdb liveboot-123-kernel-dbg/ethoip6-8.0.36-dbg/vhost_net.ko +* Make the source code directories known to gdb: + gdb) directory liveboot-123-kernel-dbg/ethoip6-8.0.36/ + gdb) directory liveboot-123-kernel-dbg/linux-3.4.51-4-pserver/ +* Happy debugging! :) diff --git a/liveboot-dbg-tar/create_debug_archive.sh b/liveboot-dbg-tar/create_debug_archive.sh new file mode 100755 index 0000000..64cb22e --- /dev/null +++ b/liveboot-dbg-tar/create_debug_archive.sh @@ -0,0 +1,56 @@ +#!/bin/bash + +set -eux + +script_dir="$( cd "$( dirname "$0" )" && pwd )" +workdir="$(mktemp -d)" +liveboot_id="$LIVEBOOT_BUILD_NUMBER" +assembledir="$workdir/liveboot-$liveboot_id-kernel-dbg" + + +cidb_query() { + local qry="$1" + export PGPASSWORD="cidb" + psql -t -A -q -U cidb -h jenkins --command "$qry" +} + +liveboot_name="$(cidb_query "SELECT l.build_name from liveboot AS l JOIN jenkins_build AS j ON l.jenkins_build_id = j.id WHERE j.jenkins_build_number = $liveboot_id;")" +kernel_ver="$(cidb_query "SELECT p.version from package_list_view AS p JOIN liveboot AS l ON l.package_list_id = p.package_list_id JOIN jenkins_build AS j ON l.jenkins_build_id = j.id WHERE j.jenkins_build_number = $liveboot_id AND p.name = 'profitbricks-linux-image-pserver';")" +ethoip6_ver="$(cidb_query "SELECT p.version from package_list_view AS p JOIN liveboot AS l ON l.package_list_id = p.package_list_id JOIN jenkins_build AS j ON l.jenkins_build_id = j.id WHERE j.jenkins_build_number = $liveboot_id AND p.name = 'profitbricks-ethoip6-modules-pserver';")" +resultfile="/srv/liveboot/debug_archives/$liveboot_name-kernel-dbg.tar.xz" + +[ -e $resultfile ] && { + echo "Error: $resultfile already exists" + exit 1 +} + +mkdir -p "$assembledir" +cd "$workdir" + +sudo aptitude update + +# assemble ethoip6 debug directory +aptitude download profitbricks-linux-source-pserver=$kernel_ver +dpkg -x profitbricks-linux-source-pserver_$kernel_ver*.deb kernel_source +mv kernel_source/usr/src/linux-*-pserver $assembledir/ + +aptitude download profitbricks-linux-image-pserver-dbg=$kernel_ver +dpkg -x profitbricks-linux-image-pserver-dbg_$kernel_ver*.deb kernel_dbg +mkdir -p $assembledir/linux-$kernel_ver-pserver-dbg +mv kernel_dbg/usr/lib/debug/vmlinux* kernel_dbg/usr/lib/debug/lib/modules/*-pserver $assembledir/linux-$kernel_ver-pserver-dbg + +# assemble ethoip6 debug directory + +aptitude download ethoip6-sources=$ethoip6_ver +dpkg -x ethoip6-sources_$ethoip6_ver*.deb ethoip6_src +mv ethoip6_src/usr/src/ethoip6* $assembledir/ + +aptitude download profitbricks-ethoip6-modules-pserver-dbg=$ethoip6_ver +dpkg -x profitbricks-ethoip6-modules-pserver-dbg_$ethoip6_ver*.deb ethoip6_dbg +mkdir -p $assembledir/ethoip6-$ethoip6_ver-dbg +find ethoip6_dbg -name "*.ko" -exec mv {} $assembledir/ethoip6-$ethoip6_ver-dbg/ \; + +cp "$script_dir/README" $assembledir/ +tar --owner=root -Ipixz -cf "$resultfile" liveboot-$liveboot_id-kernel-dbg -C $workdir + +rm -rf "$workdir"