Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1526590

[PATCH] scripts/decode_stacktrace.sh: canonicalize basepath and modpath

From "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Newsgroups linux.kernel
Subject [PATCH] scripts/decode_stacktrace.sh: canonicalize basepath and modpath
Date 2016-11-21 12:40 +0100
Message-ID <sFV73-yJ-11@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


I use decode_stacktrace.sh as

$ ./scripts/decode_stacktrace.sh vmlinux . .

It means basepath is equal to "." and decode_stacktrace stips dot from
the filepath instead of actual basepath. Not very helpful.

Let's fix this.

Canonicalize modepath too while I'm there.

Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Sasha Levin <alexander.levin@verizon.com>
Cc: Konstantin Khlebnikov <koct9i@gmail.com>
---
 scripts/decode_stacktrace.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/scripts/decode_stacktrace.sh b/scripts/decode_stacktrace.sh
index c332684e1b5a..27e3cb7a14e8 100755
--- a/scripts/decode_stacktrace.sh
+++ b/scripts/decode_stacktrace.sh
@@ -9,8 +9,8 @@ if [[ $# < 2 ]]; then
 fi
 
 vmlinux=$1
-basepath=$2
-modpath=$3
+basepath=$(readlink -ev "$2")
+modpath=$(readlink -ev "$3")
 declare -A cache
 declare -A modcache
 
@@ -77,7 +77,7 @@ parse_symbol() {
 	fi
 
 	# Strip out the base of the path
-	code=${code//$basepath/""}
+	code=${code//$basepath\//""}
 
 	# In the case of inlines, move everything to same line
 	code=${code//$'\n'/' '}
-- 
2.10.2

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] scripts/decode_stacktrace.sh: canonicalize basepath and modpath "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2016-11-21 12:40 +0100
  Re: [PATCH] scripts/decode_stacktrace.sh: canonicalize basepath and modpath Konstantin Khlebnikov <koct9i@gmail.com> - 2016-11-21 17:00 +0100
    Re: [PATCH] scripts/decode_stacktrace.sh: canonicalize basepath and  modpath "Kirill A. Shutemov" <kirill@shutemov.name> - 2016-11-21 19:50 +0100

csiph-web