public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Sasha Levin <alexander.levin@verizon.com>,
	Konstantin Khlebnikov <koct9i@gmail.com>
Subject: [PATCH] scripts/decode_stacktrace.sh: canonicalize basepath and modpath
Date: Mon, 21 Nov 2016 14:29:56 +0300	[thread overview]
Message-ID: <20161121112956.44948-1-kirill.shutemov@linux.intel.com> (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

             reply	other threads:[~2016-11-21 11:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-21 11:29 Kirill A. Shutemov [this message]
2016-11-21 15:57 ` [PATCH] scripts/decode_stacktrace.sh: canonicalize basepath and modpath Konstantin Khlebnikov
2016-11-21 18:35   ` Kirill A. Shutemov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161121112956.44948-1-kirill.shutemov@linux.intel.com \
    --to=kirill.shutemov@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=alexander.levin@verizon.com \
    --cc=koct9i@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox