mirror of
https://github.com/torvalds/linux.git
synced 2024-12-25 20:32:22 +00:00
scripts/decode_stacktrace.sh: guess basepath if not specified
Guess path to kernel sources using known location of symbol "kernel_init". Make basepath argument optional. Before: $ echo 'vfs_open+0x0/0x0' | ./scripts/decode_stacktrace.sh vmlinux "" vfs_open (home/khlebnikov/src/linux/fs/open.c:912) After: $ echo 'vfs_open+0x0/0x0' | ./scripts/decode_stacktrace.sh vmlinux vfs_open (fs/open.c:912) Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Cc: Sasha Levin <sashal@kernel.org> Link: http://lkml.kernel.org/r/159282922803.248444.2379229451667913634.stgit@buzz Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
f643b9ee97
commit
ecda6e27fa
@ -3,14 +3,14 @@
|
|||||||
# (c) 2014, Sasha Levin <sasha.levin@oracle.com>
|
# (c) 2014, Sasha Levin <sasha.levin@oracle.com>
|
||||||
#set -x
|
#set -x
|
||||||
|
|
||||||
if [[ $# < 2 ]]; then
|
if [[ $# < 1 ]]; then
|
||||||
echo "Usage:"
|
echo "Usage:"
|
||||||
echo " $0 [vmlinux] [base path] [modules path]"
|
echo " $0 <vmlinux> [base path] [modules path]"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
vmlinux=$1
|
vmlinux=$1
|
||||||
basepath=$2
|
basepath=${2-auto}
|
||||||
modpath=$3
|
modpath=$3
|
||||||
declare -A cache
|
declare -A cache
|
||||||
declare -A modcache
|
declare -A modcache
|
||||||
@ -152,6 +152,14 @@ handle_line() {
|
|||||||
echo "${words[@]}" "$symbol $module"
|
echo "${words[@]}" "$symbol $module"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if [[ $basepath == "auto" ]] ; then
|
||||||
|
module=""
|
||||||
|
symbol="kernel_init+0x0/0x0"
|
||||||
|
parse_symbol
|
||||||
|
basepath=${symbol#kernel_init (}
|
||||||
|
basepath=${basepath%/init/main.c:*)}
|
||||||
|
fi
|
||||||
|
|
||||||
while read line; do
|
while read line; do
|
||||||
# Let's see if we have an address in the line
|
# Let's see if we have an address in the line
|
||||||
if [[ $line =~ \[\<([^]]+)\>\] ]] ||
|
if [[ $line =~ \[\<([^]]+)\>\] ]] ||
|
||||||
|
Loading…
Reference in New Issue
Block a user