scripts/decode_stacktrace: only strip base path when a prefix of the path

Running something like:

	decodecode vmlinux .

leads to interested results where not only the leading "." gets stripped
from the displayed paths, but also anywhere in the string, displaying
something like:

	kvm_vcpu_check_block (arch/arm64/kvm/virt/kvm/kvm_mainc:2141)

which doesn't help further processing.

Fix it by only stripping the base path if it is a prefix of the path.

Link: http://lkml.kernel.org/r/20181210174659.31054-3-marc.zyngier@arm.com
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Marc Zyngier 2018-12-28 00:31:25 -08:00 коммит произвёл Linus Torvalds
Родитель c5cfb62f2b
Коммит 67a28de47f
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -78,7 +78,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'/' '}