tizen: Use unique directory prefix for baselibs packages
[platform/kernel/linux-rpi.git] / scripts / decode_stacktrace.sh
index 564c563..bfe5a40 100755 (executable)
@@ -16,6 +16,21 @@ elif type c++filt >/dev/null 2>&1 ; then
        cppfilt_opts=-i
 fi
 
+UTIL_SUFFIX=
+if [[ -z ${LLVM:-} ]]; then
+       UTIL_PREFIX=${CROSS_COMPILE:-}
+else
+       UTIL_PREFIX=llvm-
+       if [[ ${LLVM} == */ ]]; then
+               UTIL_PREFIX=${LLVM}${UTIL_PREFIX}
+       elif [[ ${LLVM} == -* ]]; then
+               UTIL_SUFFIX=${LLVM}
+       fi
+fi
+
+READELF=${UTIL_PREFIX}readelf${UTIL_SUFFIX}
+ADDR2LINE=${UTIL_PREFIX}addr2line${UTIL_SUFFIX}
+
 if [[ $1 == "-r" ]] ; then
        vmlinux=""
        basepath="auto"
@@ -75,7 +90,7 @@ find_module() {
 
        if [[ "$modpath" != "" ]] ; then
                for fn in $(find "$modpath" -name "${module//_/[-_]}.ko*") ; do
-                       if readelf -WS "$fn" | grep -qwF .debug_line ; then
+                       if ${READELF} -WS "$fn" | grep -qwF .debug_line ; then
                                echo $fn
                                return
                        fi
@@ -169,7 +184,7 @@ parse_symbol() {
        if [[ $aarray_support == true && "${cache[$module,$address]+isset}" == "isset" ]]; then
                local code=${cache[$module,$address]}
        else
-               local code=$(${CROSS_COMPILE}addr2line -i -e "$objfile" "$address" 2>/dev/null)
+               local code=$(${ADDR2LINE} -i -e "$objfile" "$address" 2>/dev/null)
                if [[ $aarray_support == true ]]; then
                        cache[$module,$address]=$code
                fi