Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scripts/decode_stacktrace.sh: add '-h' flag

When no parameters are passed, the usage instructions are presented only
when debuginfod-find is not found. This makes sense because with
debuginfod none of the positional parameters are needed. However it means
that users having debuginfod-find installed will have no chance of reading
the usage text without opening the file.

Many programs have a '-h' flag to get the usage, so add such a flag.
Invoking 'scripts/decode_stacktrace.sh -h' will now show the usage text
and exit.

Link: https://lkml.kernel.org/r/20240823-decode_stacktrace-find_module-improvements-v2-3-d7a57d35558b@bootlin.com
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Cc: Alexis Lothoré (eBPF Foundation) <alexis.lothore@bootlin.com>
Cc: Konstantin Khlebnikov <koct9i@gmail.com>
Cc: Sasha Levin <sashal@kernel.org>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Luca Ceresoli and committed by
Andrew Morton
7e108359 a6d05e82

+5 -1
+5 -1
scripts/decode_stacktrace.sh
··· 7 7 echo "Usage:" 8 8 echo " $0 -r <release>" 9 9 echo " $0 [<vmlinux> [<base_path>|auto [<modules_path>]]]" 10 + echo " $0 -h" 10 11 } 11 12 12 13 # Try to find a Rust demangler ··· 34 33 ADDR2LINE=${UTIL_PREFIX}addr2line${UTIL_SUFFIX} 35 34 NM=${UTIL_PREFIX}nm${UTIL_SUFFIX} 36 35 37 - if [[ $1 == "-r" ]] ; then 36 + if [[ $1 == "-h" ]] ; then 37 + usage 38 + exit 0 39 + elif [[ $1 == "-r" ]] ; then 38 40 vmlinux="" 39 41 basepath="auto" 40 42 modpath=""