LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Evan Green <evgreen@chromium.org>
To: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Douglas Anderson <dianders@chromium.org>,
	Evan Green <evgreen@chromium.org>,
	Konstantin Khlebnikov <khlebnikov@yandex-team.ru>,
	linux-kernel@vger.kernel.org,
	Nicolas Boichat <drinkcat@chromium.org>,
	Marc Zyngier <marc.zyngier@arm.com>,
	Manuel Traut <manut@linutronix.de>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH] scripts/decode_stacktrace: Accept dash/underscore in modules
Date: Fri, 31 May 2019 13:59:26 -0700	[thread overview]
Message-ID: <20190531205926.42474-1-evgreen@chromium.org> (raw)

The manpage for modprobe mentions that dashes and underscores are
treated interchangeably in module names. The stack trace dumps seem
to print module names with underscores. Use bash to replace _ with
the pattern [-_] so that file names with dashes or underscores can be
found.

For example, this line:
[   27.919759]  hda_widget_sysfs_init+0x2b8/0x3a5 [snd_hda_core]

should find a module named snd-hda-core.ko.

Signed-off-by: Evan Green <evgreen@chromium.org>
---

Note: This should apply atop linux-next.

Thanks to Doug for showing me the bash string substitution magic.

---
 scripts/decode_stacktrace.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/decode_stacktrace.sh b/scripts/decode_stacktrace.sh
index fa704f17275e..13e5fbafdf2f 100755
--- a/scripts/decode_stacktrace.sh
+++ b/scripts/decode_stacktrace.sh
@@ -28,7 +28,7 @@ parse_symbol() {
 		local objfile=${modcache[$module]}
 	else
 		[[ $modpath == "" ]] && return
-		local objfile=$(find "$modpath" -name "$module.ko*" -print -quit)
+		local objfile=$(find "$modpath" -name "${module//_/[-_]}.ko*" -print -quit)
 		[[ $objfile == "" ]] && return
 		modcache[$module]=$objfile
 	fi
-- 
2.20.1


             reply	other threads:[~2019-05-31 20:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-31 20:59 Evan Green [this message]
2019-05-31 21:01 ` Doug Anderson
2019-06-03  7:51 ` Konstantin Khlebnikov

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=20190531205926.42474-1-evgreen@chromium.org \
    --to=evgreen@chromium.org \
    --cc=akpm@linux-foundation.org \
    --cc=dianders@chromium.org \
    --cc=drinkcat@chromium.org \
    --cc=khlebnikov@yandex-team.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manut@linutronix.de \
    --cc=marc.zyngier@arm.com \
    --cc=sfr@canb.auug.org.au \
    --subject='Re: [PATCH] scripts/decode_stacktrace: Accept dash/underscore in modules' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).