Skip to content

Commit 436efd9

Browse files
quic-bjorandeakpm00
authored andcommitted
scripts/decode_stacktrace.sh: strip unexpected CR from lines
When the kernel log is acquired over a serial cable it is not uncommon for the log to contain carriage return characters, in addition to the expected line feeds. When this output is feed into decode_stacktrace.sh, handle_line() fails to strip the trailing ']' off the module name, which results in find_module() not being able to find the referred to kernel module. This is reported to the user as: WARNING! Modules path isn't set, but is needed to parse this symbol The solution is to reconfigure the serial port, or to strip the carriage returns from the log, but this isn't obvious from the error reported by the script. Instead, make decode_stacktrace.sh more user friendly by stripping the trailing carriage return. Link: https://lkml.kernel.org/r/20231225-decode-stacktrace-cr-v1-1-9f306f38cdde@quicinc.com Signed-off-by: Bjorn Andersson <quic_bjorande@quicinc.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 55efe4a commit 436efd9

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

scripts/decode_stacktrace.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,9 @@ handle_line() {
291291
}
292292

293293
while read line; do
294+
# Strip unexpected carriage return at end of line
295+
line=${line%$'\r'}
296+
294297
# Let's see if we have an address in the line
295298
if [[ $line =~ \[\<([^]]+)\>\] ]] ||
296299
[[ $line =~ [^+\ ]+\+0x[0-9a-f]+/0x[0-9a-f]+ ]]; then

0 commit comments

Comments
 (0)