* [PATCH] scripts/decode_stacktrace.sh: canonicalize basepath and modpath
@ 2016-11-21 11:29 Kirill A. Shutemov
2016-11-21 15:57 ` Konstantin Khlebnikov
0 siblings, 1 reply; 3+ messages in thread
From: Kirill A. Shutemov @ 2016-11-21 11:29 UTC (permalink / raw)
To: Andrew Morton
Cc: linux-kernel, Kirill A. Shutemov, Sasha Levin, Konstantin Khlebnikov
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] scripts/decode_stacktrace.sh: canonicalize basepath and modpath
2016-11-21 11:29 [PATCH] scripts/decode_stacktrace.sh: canonicalize basepath and modpath Kirill A. Shutemov
@ 2016-11-21 15:57 ` Konstantin Khlebnikov
2016-11-21 18:35 ` Kirill A. Shutemov
0 siblings, 1 reply; 3+ messages in thread
From: Konstantin Khlebnikov @ 2016-11-21 15:57 UTC (permalink / raw)
To: Kirill A. Shutemov; +Cc: Andrew Morton, Linux Kernel Mailing List, Sasha Levin
On Mon, Nov 21, 2016 at 2:29 PM, Kirill A. Shutemov
<kirill.shutemov@linux.intel.com> wrote:
> 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.
This doesn't work if basepath is some non-existenting directory.
In my case this usually path in pbulder container.
You could try to replace only "." to "$PWD/"
>
> Let's fix this.
>
> Canonicalize modepath too while I'm there.
This is redundant. =)
>
> 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
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] scripts/decode_stacktrace.sh: canonicalize basepath and modpath
2016-11-21 15:57 ` Konstantin Khlebnikov
@ 2016-11-21 18:35 ` Kirill A. Shutemov
0 siblings, 0 replies; 3+ messages in thread
From: Kirill A. Shutemov @ 2016-11-21 18:35 UTC (permalink / raw)
To: Konstantin Khlebnikov
Cc: Kirill A. Shutemov, Andrew Morton, Linux Kernel Mailing List,
Sasha Levin
On Mon, Nov 21, 2016 at 06:57:26PM +0300, Konstantin Khlebnikov wrote:
> On Mon, Nov 21, 2016 at 2:29 PM, Kirill A. Shutemov
> <kirill.shutemov@linux.intel.com> wrote:
> > 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.
>
> This doesn't work if basepath is some non-existenting directory.
> In my case this usually path in pbulder container.
What about "readlink -m"? It should be good enough for you too.
--
Kirill A. Shutemov
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-11-21 18:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-21 11:29 [PATCH] scripts/decode_stacktrace.sh: canonicalize basepath and modpath Kirill A. Shutemov
2016-11-21 15:57 ` Konstantin Khlebnikov
2016-11-21 18:35 ` Kirill A. Shutemov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).