public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Elliot Berman <quic_eberman@quicinc.com>
To: Nathan Chancellor <nathan@kernel.org>,
	Nick Desaulniers <ndesaulniers@google.com>,
	Bill Wendling <morbo@google.com>,
	Justin Stitt <justinstitt@google.com>,
	Manuel Traut <manut@linutronix.de>
Cc: <linux-arm-msm@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<llvm@lists.linux.dev>, Elliot Berman <quic_eberman@quicinc.com>
Subject: [PATCH] scripts/decode_stacktrace.sh: Use LLVM environment variable
Date: Fri, 15 Dec 2023 10:26:40 -0800	[thread overview]
Message-ID: <20231215-llvm-decode-stacktrace-v1-1-201cb86f4879@quicinc.com> (raw)

When using LLVM as the compiler, decode_stacktrace should also use
llvm-addr2line. Check if LLVM is set and add the appropriate
suffix/prefix.

Signed-off-by: Elliot Berman <quic_eberman@quicinc.com>
---
 scripts/decode_stacktrace.sh | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/scripts/decode_stacktrace.sh b/scripts/decode_stacktrace.sh
index 564c5632e1a2..189b00f4e120 100755
--- a/scripts/decode_stacktrace.sh
+++ b/scripts/decode_stacktrace.sh
@@ -16,6 +16,16 @@ elif type c++filt >/dev/null 2>&1 ; then
 	cppfilt_opts=-i
 fi
 
+if [[ "${LLVM}" == "1" ]] ; then
+	addr2line="llvm-addr2line"
+elif [[ "${LLVM}" == */ ]] ; then
+	addr2line="${LLVM}llvm-addr2line"
+elif [[ "${LLVM}" == -* ]] ; then
+	addr2line="llvm-addr2line${LLVM}"
+else
+	addr2line="${CROSS_COMPILE}addr2line"
+fi
+
 if [[ $1 == "-r" ]] ; then
 	vmlinux=""
 	basepath="auto"
@@ -169,7 +179,7 @@ parse_symbol() {
 	if [[ $aarray_support == true && "${cache[$module,$address]+isset}" == "isset" ]]; then
 		local code=${cache[$module,$address]}
 	else
-		local code=$(${CROSS_COMPILE}addr2line -i -e "$objfile" "$address" 2>/dev/null)
+		local code=$(${addr2line} -i -e "$objfile" "$address" 2>/dev/null)
 		if [[ $aarray_support == true ]]; then
 			cache[$module,$address]=$code
 		fi

---
base-commit: 3f7168591ebf7bbdb91797d02b1afaf00a4289b1
change-id: 20231214-llvm-decode-stacktrace-09538979006d

Best regards,
-- 
Elliot Berman <quic_eberman@quicinc.com>


             reply	other threads:[~2023-12-15 18:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-15 18:26 Elliot Berman [this message]
2023-12-15 21:19 ` [PATCH] scripts/decode_stacktrace.sh: Use LLVM environment variable Justin Stitt
2023-12-18 16:37 ` Nick Desaulniers
2023-12-19  0:16   ` Justin Stitt
2023-12-19 16:49     ` Nick Desaulniers
2023-12-19 21:12       ` Justin Stitt

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=20231215-llvm-decode-stacktrace-v1-1-201cb86f4879@quicinc.com \
    --to=quic_eberman@quicinc.com \
    --cc=justinstitt@google.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=manut@linutronix.de \
    --cc=morbo@google.com \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    /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