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.
Showing the changes to scripts/decode_stacktrace.sh (1 of 1 file). Show all
Unified · Split
| @@ -7,6 +7,7 @@ usage() { · 6 unmodified lines | |||
| 7 | echo "Usage:" | 7 | echo "Usage:" |
| 8 | echo " $0 -r <release>" | 8 | echo " $0 -r <release>" |
| 9 | echo " $0 [<vmlinux> [<base_path>|auto [<modules_path>]]]" | 9 | echo " $0 [<vmlinux> [<base_path>|auto [<modules_path>]]]" |
| 10 | echo " $0 -h" | ||
| 10 | } | 11 | } |
| 11 | 12 | ||
| 12 | # Try to find a Rust demangler | 13 | # Try to find a Rust demangler |
| @@ -33,7 +34,10 @@ READELF=${UTIL_PREFIX}readelf${UTIL_SUFFIX} · 20 unmodified lines | |||
| 33 | ADDR2LINE=${UTIL_PREFIX}addr2line${UTIL_SUFFIX} | 34 | ADDR2LINE=${UTIL_PREFIX}addr2line${UTIL_SUFFIX} |
| 34 | NM=${UTIL_PREFIX}nm${UTIL_SUFFIX} | 35 | NM=${UTIL_PREFIX}nm${UTIL_SUFFIX} |
| 35 | 36 | ||
| 36 | if [[ $1 == "-r" ]] ; then | 37 | if [[ $1 == "-h" ]] ; then |
| 38 | usage | ||
| 39 | exit 0 | ||
| 40 | elif [[ $1 == "-r" ]] ; then | ||
| 37 | vmlinux="" | 41 | vmlinux="" |
| 38 | basepath="auto" | 42 | basepath="auto" |
| 39 | modpath="" | 43 | modpath="" |