diff options
| author | Konstantin Khlebnikov <[email protected]> | 2020-08-07 06:17:38 +0000 |
|---|---|---|
| committer | Linus Torvalds <[email protected]> | 2020-08-07 18:33:21 +0000 |
| commit | ecda6e27fa834b2aa37fc9ad49f89b80e9ee8f97 (patch) | |
| tree | f8e69cde4288ee3d240b7bee480fd74e18413b90 /scripts/decode_stacktrace.sh | |
| parent | scripts/decode_stacktrace.sh: skip missing symbols (diff) | |
| download | kernel-ecda6e27fa834b2aa37fc9ad49f89b80e9ee8f97.tar.gz kernel-ecda6e27fa834b2aa37fc9ad49f89b80e9ee8f97.zip | |
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 <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Cc: Sasha Levin <[email protected]>
Link: http://lkml.kernel.org/r/159282922803.248444.2379229451667913634.stgit@buzz
Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'scripts/decode_stacktrace.sh')
| -rwxr-xr-x | scripts/decode_stacktrace.sh | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/scripts/decode_stacktrace.sh b/scripts/decode_stacktrace.sh index b157037af6df..62a70ede7f3e 100755 --- a/scripts/decode_stacktrace.sh +++ b/scripts/decode_stacktrace.sh @@ -3,14 +3,14 @@ # (c) 2014, Sasha Levin <[email protected]> #set -x -if [[ $# < 2 ]]; then +if [[ $# < 1 ]]; then echo "Usage:" - echo " $0 [vmlinux] [base path] [modules path]" + echo " $0 <vmlinux> [base path] [modules path]" exit 1 fi vmlinux=$1 -basepath=$2 +basepath=${2-auto} modpath=$3 declare -A cache declare -A modcache @@ -152,6 +152,14 @@ handle_line() { 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 # Let's see if we have an address in the line if [[ $line =~ \[\<([^]]+)\>\] ]] || |
