9 echo "bt: $0 -c core_path [-d distro] [-C directory] [-v]"
14 if [ -n "$verbose" ]; then
19 function get_machine() {
21 local machine=${core_path%/coredump/*}
22 echo $(basename $machine)
25 function get_t_dir() {
27 echo ${core_path%/remote/*}
30 while getopts "c:C:d:v" opt
33 c) core_path=$OPTARG;;
41 if [ -z $core_path ]; then
45 sha1=$(strings $core_path | gawk 'BEGIN{ FS = "=" } /^CEPH_REF/{print $2}')
47 teuthology_log=$(get_t_dir $core_path)/teuthology.log
48 sha1=$(grep -m1 -A1 "Running command: sudo ceph --version" ${teuthology_log} | tail -n1 | grep -oP "ceph version [^ ]+ \(\K[^\) ]+")
51 if [ -z $distro ]; then
52 machine=$(get_machine $core_path)
53 teuthology_log=$(get_t_dir $core_path)/teuthology.log
54 if [ ! -r ${teuthology_log} ]; then
55 die "missing distro, and unable to read it from ${teuthology_log}"
57 ld=$(grep -m1 -A1 "${machine}:Running.*linux_distribution" ${teuthology_log} | tail -n1 | grep -oP "\(\K[^\)]+")
58 distro=$(echo $ld | gawk -F ", " '{print $1}' | sed s/\'//g)
59 distro=$(echo $distro | tr '[:upper:]' '[:lower:]')
60 distro_ver=$(echo $ld | gawk -F ", " '{print $2}' | sed s/\'//g)
61 codename=$(echo $ld | gawk -F ", " '{print $3}' | sed s/\'//g)
62 if [ "$distro" == "centos linux" ]; then
63 # there is chance that it's actually something different,
64 # but we take it as centos7 anyway.
83 die "unknown distro: $distro"
88 # try to figure out a name for working directory
90 run=${core_path%/remote/*}
92 if [ $job_id != $core_path ]; then
93 # use the run/job for the working dir
99 wd=$(basename $core_path)
101 echo "unable to figure out the working directory, using ${wd}"
108 prog=$(file $core_path | grep -oP "from '\K[^']+" | cut -d' ' -f1)
111 pkgs="ceph-test librados2"
117 prog=$(basename $prog)
121 pkgs="ceph-common librados2 libradosstriper1"
124 die "unknown prog: $prog"
131 release=$(strings $core_path | grep -m1 -oP '/build/ceph-\K[^/]+')
132 if [ -z $release ]; then
133 teuthology_log=$(get_t_dir $core_path)/teuthology.log
134 release=$(grep -m1 -A1 "Running command: sudo ceph --version" ${teuthology_log} | tail -n1 | grep -oP "ceph version \K[^ ]+")
139 pkg_path=pool/main/c/ceph/%s_%s-1${codename}_amd64.deb
146 pkg_path=${arch}/%s-%s.el7.x86_64.rpm
147 # 11.0.2-1022-g5b25cd3 => 11.0.2-1022.g5b25cd3
148 release=$(echo $release | sed s/-/./2)
149 pkgs="$pkgs ceph-debuginfo"
152 die "unknown distro: $distro"
156 query_url="https://shaman.ceph.com/api/search?status=ready&project=ceph&flavor=${flavor}&distros=${distro}%2F${distro_ver}%2F${arch}&sha1=${sha1}"
157 repo_url=`curl -L -s "${query_url}" | jq -r '.[0] | .url'`
158 pkg_url=${repo_url}/${pkg_path}
159 log "repo url is ${repo_url}"
161 for pkg in ${pkgs}; do
162 url=`printf $pkg_url $pkg $release`
163 log "downloading ${url}"
164 curl -O -L -C - --silent --fail --insecure $url
165 fname=`basename $url`
168 ar p `basename $fname` data.tar.xz | tar xJv;;
170 rpm2cpio < $fname | cpio -id;;
175 cat > preclude.gdb <<EOF
177 set debug-file-directory ./usr/lib/debug
178 set solib-search-path ./usr/lib64