The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Bjorn Andersson <quic_bjorande@quicinc.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: <linux-arm-msm@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	"Bjorn Andersson" <quic_bjorande@quicinc.com>
Subject: [PATCH] scripts/decode_stacktrace.sh: Strip unexpected CR from lines
Date: Mon, 25 Dec 2023 09:40:35 -0800	[thread overview]
Message-ID: <20231225-decode-stacktrace-cr-v1-1-9f306f38cdde@quicinc.com> (raw)

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.

Signed-off-by: Bjorn Andersson <quic_bjorande@quicinc.com>
---
 scripts/decode_stacktrace.sh | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/scripts/decode_stacktrace.sh b/scripts/decode_stacktrace.sh
index 564c5632e1a2..cb980b144ca1 100755
--- a/scripts/decode_stacktrace.sh
+++ b/scripts/decode_stacktrace.sh
@@ -291,6 +291,9 @@ handle_line() {
 }
 
 while read line; do
+	# Strip unexpected carriage return at end of line
+	line=${line%$'\r'}
+
 	# Let's see if we have an address in the line
 	if [[ $line =~ \[\<([^]]+)\>\] ]] ||
 	   [[ $line =~ [^+\ ]+\+0x[0-9a-f]+/0x[0-9a-f]+ ]]; then

---
base-commit: 39676dfe52331dba909c617f213fdb21015c8d10
change-id: 20231225-decode-stacktrace-cr-3fb9e13afc96

Best regards,
-- 
Bjorn Andersson <quic_bjorande@quicinc.com>


                 reply	other threads:[~2023-12-25 17:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231225-decode-stacktrace-cr-v1-1-9f306f38cdde@quicinc.com \
    --to=quic_bjorande@quicinc.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox