* [PATCH v3 0/2] scripts/decode_stacktrace.sh: better support to ARM32
@ 2024-05-24 4:25 Xiong Nandi
2024-05-24 4:25 ` [PATCH v3 1/2] scripts/decode_stacktrace.sh: wrap nm with UTIL_PREFIX and UTIL_SUFFIX Xiong Nandi
2024-05-24 4:26 ` [PATCH v3 2/2] scripts/decode_stacktrace.sh: better support to ARM32 module stack trace Xiong Nandi
0 siblings, 2 replies; 3+ messages in thread
From: Xiong Nandi @ 2024-05-24 4:25 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel, quic_bjorande, cmllamas, quic_eberman, Xiong Nandi
v2 -> v3:
- Change to only strip the right parenthesis
v1 -> v2:
- Split the patch into two.
Xiong Nandi (2):
scripts/decode_stacktrace.sh: wrap nm with UTIL_PREFIX and UTIL_SUFFIX
scripts/decode_stacktrace.sh: better support to ARM32 module stack
trace
scripts/decode_stacktrace.sh | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
--
2.34.1
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH v3 1/2] scripts/decode_stacktrace.sh: wrap nm with UTIL_PREFIX and UTIL_SUFFIX
2024-05-24 4:25 [PATCH v3 0/2] scripts/decode_stacktrace.sh: better support to ARM32 Xiong Nandi
@ 2024-05-24 4:25 ` Xiong Nandi
2024-05-24 4:26 ` [PATCH v3 2/2] scripts/decode_stacktrace.sh: better support to ARM32 module stack trace Xiong Nandi
1 sibling, 0 replies; 3+ messages in thread
From: Xiong Nandi @ 2024-05-24 4:25 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel, quic_bjorande, cmllamas, quic_eberman, Xiong Nandi
Since System.map is generated by cross-compile nm tool, we should use it here
too. Otherwise host nm may not recognize ARM Thumb-2 instruction address well.
Signed-off-by: Xiong Nandi <xndchn@gmail.com>
Reviewed-by: Elliot Berman <quic_eberman@quicinc.com>
---
scripts/decode_stacktrace.sh | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/scripts/decode_stacktrace.sh b/scripts/decode_stacktrace.sh
index fa5be6f57..2bc3a54ff 100755
--- a/scripts/decode_stacktrace.sh
+++ b/scripts/decode_stacktrace.sh
@@ -30,6 +30,7 @@ fi
READELF=${UTIL_PREFIX}readelf${UTIL_SUFFIX}
ADDR2LINE=${UTIL_PREFIX}addr2line${UTIL_SUFFIX}
+NM=${UTIL_PREFIX}nm${UTIL_SUFFIX}
if [[ $1 == "-r" ]] ; then
vmlinux=""
@@ -158,7 +159,7 @@ parse_symbol() {
if [[ $aarray_support == true && "${cache[$module,$name]+isset}" == "isset" ]]; then
local base_addr=${cache[$module,$name]}
else
- local base_addr=$(nm "$objfile" 2>/dev/null | awk '$3 == "'$name'" && ($2 == "t" || $2 == "T") {print $1; exit}')
+ local base_addr=$(${NM} "$objfile" 2>/dev/null | awk '$3 == "'$name'" && ($2 == "t" || $2 == "T") {print $1; exit}')
if [[ $base_addr == "" ]] ; then
# address not found
return
--
2.34.1
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH v3 2/2] scripts/decode_stacktrace.sh: better support to ARM32 module stack trace
2024-05-24 4:25 [PATCH v3 0/2] scripts/decode_stacktrace.sh: better support to ARM32 Xiong Nandi
2024-05-24 4:25 ` [PATCH v3 1/2] scripts/decode_stacktrace.sh: wrap nm with UTIL_PREFIX and UTIL_SUFFIX Xiong Nandi
@ 2024-05-24 4:26 ` Xiong Nandi
1 sibling, 0 replies; 3+ messages in thread
From: Xiong Nandi @ 2024-05-24 4:26 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel, quic_bjorande, cmllamas, quic_eberman, Xiong Nandi
Sometimes there is special characters around module name in stack trace,
such as ARM32 with BACKTRACE_VERBOSE in "(%pS)" format, such as:
[<806e4845>] (dump_stack_lvl) from [<7f806013>] (hello_init+0x13/0x1000 [test])
In this case, $module will be "[test])", the trace can be decoded by stripping
the right parenthesis firstly:
(dump_stack_lvl) from hello_init (/foo/test.c:10) test
Signed-off-by: Xiong Nandi <xndchn@gmail.com>
Suggested-by: Elliot Berman <quic_eberman@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 2bc3a54ff..a0f50a5b4 100755
--- a/scripts/decode_stacktrace.sh
+++ b/scripts/decode_stacktrace.sh
@@ -283,6 +283,9 @@ handle_line() {
if [[ ${words[$last]} =~ \[([^]]+)\] ]]; then
module=${words[$last]}
+ # some traces format is "(%pS)", which like "(foo+0x0/0x1 [bar])"
+ # so $module may like "[bar])". Strip the right parenthesis firstly
+ module=${module%\)}
module=${module#\[}
module=${module%\]}
modbuildid=${module#* }
--
2.34.1
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-05-24 4:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-24 4:25 [PATCH v3 0/2] scripts/decode_stacktrace.sh: better support to ARM32 Xiong Nandi
2024-05-24 4:25 ` [PATCH v3 1/2] scripts/decode_stacktrace.sh: wrap nm with UTIL_PREFIX and UTIL_SUFFIX Xiong Nandi
2024-05-24 4:26 ` [PATCH v3 2/2] scripts/decode_stacktrace.sh: better support to ARM32 module stack trace Xiong Nandi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®