summaryrefslogtreecommitdiffstats
path: root/extras/devel-tools
diff options
context:
space:
mode:
authorMilind Changire <mchangir@redhat.com>2017-08-30 09:29:49 +0530
committerAmar Tumballi <amarts@redhat.com>2018-09-18 09:11:30 +0000
commit86f1aa94c15c6c2a95a96155e8d6e4ab953b3a50 (patch)
treedf82b6d5ddefc4e738d124819d27a0f577e93d64 /extras/devel-tools
parentd2b42668e779c31eb421f8b93be695d5eab65e6f (diff)
extras/devel-tools: script to resolve backtraces
print-backtrace.sh script to resolve backtraces Change-Id: I24688ae5160cc706d9f4794521d17290bef6765b BUG: 1486532 Signed-off-by: Milind Changire <mchangir@redhat.com>
Diffstat (limited to 'extras/devel-tools')
-rwxr-xr-xextras/devel-tools/print-backtrace.sh27
1 files changed, 16 insertions, 11 deletions
diff --git a/extras/devel-tools/print-backtrace.sh b/extras/devel-tools/print-backtrace.sh
index 72b93c1353f..33fbae288bc 100755
--- a/extras/devel-tools/print-backtrace.sh
+++ b/extras/devel-tools/print-backtrace.sh
@@ -40,9 +40,11 @@ if [ ! $debuginfo_rpm ] || [ ! $backtrace_file ]; then
exit 1
fi
-if [ $debuginfo_rpm != "none" ] && [ ! -f $debuginfo_rpm ]; then
- echo "no such rpm file: $debuginfo_rpm"
- exit 1
+if [ $debuginfo_rpm != "none" ]; then
+ if [ ! -f $debuginfo_rpm ]; then
+ echo "no such rpm file: $debuginfo_rpm"
+ exit 1
+ fi
fi
if [ ! -f $backtrace_file ]; then
@@ -50,9 +52,11 @@ if [ ! -f $backtrace_file ]; then
exit 1
fi
-if ! file $debuginfo_rpm | grep RPM >/dev/null 2>&1 ; then
- echo "file does not look like an rpm: $debuginfo_rpm"
- exit 1
+if [ "$debuginfo_rpm" != "none" ]; then
+ if ! file $debuginfo_rpm | grep RPM >/dev/null 2>&1 ; then
+ echo "file does not look like an rpm: $debuginfo_rpm"
+ exit 1
+ fi
fi
cpio_version=$(cpio --version|grep cpio|cut -f 2 -d ')'|sed -e 's/^[[:space:]]*//')
@@ -92,15 +96,16 @@ else
fi
# NOTE: backtrace file should contain only the lines which need to be resolved
-for bt in $(grep glusterfs $backtrace_file)
+for bt in $(cat $backtrace_file)
do
libname=$(echo $bt | cut -f 1 -d '(')
addr=$(echo $bt | cut -f 2 -d '(' | cut -f 1 -d ')')
- # only unresolved addresses start with a '+'
- if echo $addr | egrep '^\+' >/dev/null 2>&1 ; then
- newbt=( $(eu-addr2line --functions --exe=${debuginfo_path}${libname}${debuginfo_extension} $addr) )
- echo "$bt ${newbt[*]}"
+ libpath=${debuginfo_path}${libname}${debuginfo_extension}
+ if [ ! -f $libpath ]; then
+ continue
fi
+ newbt=( $(eu-addr2line --functions --exe=$libpath $addr) )
+ echo "$bt ${newbt[*]}"
done
# remove the temporary directory