Skip to content

Commit f643b9e

Browse files
koct9itorvalds
authored andcommitted
scripts/decode_stacktrace.sh: skip missing symbols
For now script turns missing symbols into '0' and make bogus decode. Skip them instead. Also simplify parsing output of 'nm'. Before: $ echo 'xxx+0x0/0x0' | ./scripts/decode_stacktrace.sh vmlinux "" xxx (home/khlebnikov/src/linux/./arch/x86/include/asm/processor.h:398) After: $ echo 'xxx+0x0/0x0' | ./scripts/decode_stacktrace.sh vmlinux "" xxx+0x0/0x0 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/159282922499.248444.4883465570858385250.stgit@buzz Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 1d35b60 commit f643b9e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

scripts/decode_stacktrace.sh

+5-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,11 @@ parse_symbol() {
5656
if [[ "${cache[$module,$name]+isset}" == "isset" ]]; then
5757
local base_addr=${cache[$module,$name]}
5858
else
59-
local base_addr=$(nm "$objfile" | grep -i ' t ' | awk "/ $name\$/ {print \$1}" | head -n1)
59+
local base_addr=$(nm "$objfile" | awk '$3 == "'$name'" && ($2 == "t" || $2 == "T") {print $1; exit}')
60+
if [[ $base_addr == "" ]] ; then
61+
# address not found
62+
return
63+
fi
6064
cache[$module,$name]="$base_addr"
6165
fi
6266
# Let's start doing the math to get the exact address into the

0 commit comments

Comments
 (0)