]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
scripts/decode_stacktrace: strip basepath from all paths
authorPi-Hsun Shih <pihsun@chromium.org>
Fri, 24 Jul 2020 04:15:43 +0000 (21:15 -0700)
committerKhalid Elmously <khalid.elmously@canonical.com>
Sat, 8 Aug 2020 05:53:12 +0000 (01:53 -0400)
BugLink: https://bugs.launchpad.net/bugs/1889669
[ Upstream commit d178770d8d21489abf5bafefcbb6d5243b482e9a ]

Currently the basepath is removed only from the beginning of the string.
When the symbol is inlined and there's multiple line outputs of
addr2line, only the first line would have basepath removed.

Change to remove the basepath prefix from all lines.

Fixes: 31013836a71e ("scripts/decode_stacktrace: match basepath using shell prefix operator, not regex")
Co-developed-by: Shik Chen <shik@chromium.org>
Signed-off-by: Pi-Hsun Shih <pihsun@chromium.org>
Signed-off-by: Shik Chen <shik@chromium.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Cc: Sasha Levin <sashal@kernel.org>
Cc: Nicolas Boichat <drinkcat@chromium.org>
Cc: Jiri Slaby <jslaby@suse.cz>
Link: http://lkml.kernel.org/r/20200720082709.252805-1-pihsun@chromium.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
scripts/decode_stacktrace.sh

index 13e5fbafdf2f71573a4d098e246e8545a7a0ea8c..fe7076fdac8a37e4fd7255cf2d2ee98ae7c2d5a8 100755 (executable)
@@ -84,8 +84,8 @@ parse_symbol() {
                return
        fi
 
-       # Strip out the base of the path
-       code=${code#$basepath/}
+       # Strip out the base of the path on each line
+       code=$(while read -r line; do echo "${line#$basepath/}"; done <<< "$code")
 
        # In the case of inlines, move everything to same line
        code=${code//$'\n'/' '}