Skip to content

Commit f290de3

Browse files
Carlos Llamasgregkh
authored andcommitted
scripts/decode_stacktrace.sh: fix build ID and PC source parsing
commit 7d9f7d390f6af3a29614e81e802e2b9c238eb7b2 upstream. Support for parsing PC source info in stacktraces (e.g. '(P)') was added in commit 2bff77c ("scripts/decode_stacktrace.sh: fix decoding of lines with an additional info"). However, this logic was placed after the build ID processing. This incorrect order fails to parse lines containing both elements, e.g.: drm_gem_mmap_obj+0x114/0x200 [drm 03d0564e0529947d67bb2008c3548be77279fd27] (P) This patch fixes the problem by extracting the PC source info first and then processing the module build ID. With this change, the line above is now properly parsed as such: drm_gem_mmap_obj (./include/linux/mmap_lock.h:212 ./include/linux/mm.h:811 drivers/gpu/drm/drm_gem.c:1177) drm (P) While here, also add a brief explanation the build ID section. Link: https://lkml.kernel.org/r/[email protected] Fixes: 2bff77c ("scripts/decode_stacktrace.sh: fix decoding of lines with an additional info") Signed-off-by: Carlos Llamas <[email protected]> Reviewed-by: Matthieu Baerts (NGI0) <[email protected]> Reviewed-by: Luca Ceresoli <[email protected]> Cc: Breno Leitao <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Marc Rutland <[email protected]> Cc: Mark Brown <[email protected]> Cc: Matthieu Baerts <[email protected]> Cc: Miroslav Benes <[email protected]> Cc: Puranjay Mohan <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 6ca8437 commit f290de3

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

scripts/decode_stacktrace.sh

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -275,12 +275,6 @@ handle_line() {
275275
fi
276276
done
277277

278-
if [[ ${words[$last]} =~ ^[0-9a-f]+\] ]]; then
279-
words[$last-1]="${words[$last-1]} ${words[$last]}"
280-
unset words[$last] spaces[$last]
281-
last=$(( $last - 1 ))
282-
fi
283-
284278
# Extract info after the symbol if present. E.g.:
285279
# func_name+0x54/0x80 (P)
286280
# ^^^
@@ -293,6 +287,14 @@ handle_line() {
293287
last=$(( $last - 1 ))
294288
fi
295289

290+
# Join module name with its build id if present, as these were
291+
# split during tokenization (e.g. "[module" and "modbuildid]").
292+
if [[ ${words[$last]} =~ ^[0-9a-f]+\] ]]; then
293+
words[$last-1]="${words[$last-1]} ${words[$last]}"
294+
unset words[$last] spaces[$last]
295+
last=$(( $last - 1 ))
296+
fi
297+
296298
if [[ ${words[$last]} =~ \[([^]]+)\] ]]; then
297299
module=${words[$last]}
298300
# some traces format is "(%pS)", which like "(foo+0x0/0x1 [bar])"

0 commit comments

Comments
 (0)