mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Jiri Slaby <jslaby@suse.cz>
Cc: linux-kernel@vger.kernel.org, Sasha Levin <sashal@kernel.org>,
	Pi-Hsun Shih <pihsun@chromium.org>, Shik Chen <shik@chromium.org>,
	Stephen Boyd <swboyd@chromium.org>,
	Nicolas Boichat <drinkcat@chromium.org>
Subject: Re: [PATCH] scripts/decode_stacktrace: strip all base path prefixes
Date: Mon, 20 Jul 2020 16:05:16 -0700	[thread overview]
Message-ID: <20200720160516.9e53d2c3cc4c68fb4a6d2dd4@linux-foundation.org> (raw)
In-Reply-To: <20200720074429.29359-1-jslaby@suse.cz>

On Mon, 20 Jul 2020 09:44:29 +0200 Jiri Slaby <jslaby@suse.cz> wrote:

> When addr2line returns more than one location, decode_stacktrace does
> not currently remove base path from the paths. So the result might look
> like (line wrapped here):
>  ptrace_stop (include/linux/freezer.h:57
>  /home/abuild/rpmbuild/BUILD/kernel-default-5.8.rc5/linux-5.8-rc5/linux-obj/../include/linux/freezer.h:67
>  /home/abuild/rpmbuild/BUILD/kernel-default-5.8.rc5/linux-5.8-rc5/linux-obj/../include/linux/freezer.h:128
>  /home/abuild/rpmbuild/BUILD/kernel-default-5.8.rc5/linux-5.8-rc5/linux-obj/../include/linux/freezer.h:173
>  /home/abuild/rpmbuild/BUILD/kernel-default-5.8.rc5/linux-5.8-rc5/linux-obj/../kernel/signal.c:2217)
> 
> Make sure all the lines are processed, so the result now looks like
> (line wrapped here again):
>  ptrace_stop (include/linux/freezer.h:57 include/linux/freezer.h:67
>  include/linux/freezer.h:128 include/linux/freezer.h:173
>  kernel/signal.c:2217)

hm, I just merged
http://lkml.kernel.org/r/20200720082709.252805-1-pihsun@chromium.org. 
Which is preferable?

> --- a/scripts/decode_stacktrace.sh
> +++ b/scripts/decode_stacktrace.sh
> @@ -140,14 +140,15 @@ parse_symbol() {
>  		return
>  	fi
>  
> -	# Strip out the base of the path
> -	code=${code#$basepath/}
> -
> -	# In the case of inlines, move everything to same line
> -	code=${code//$'\n'/' '}
> +	declare -a output
> +	while read LINE; do
> +		# Strip out the base of the path
> +		LINE=${LINE#$basepath/}
> +		output+=("$LINE")
> +	done <<< $code
>  
>  	# Replace old address with pretty line numbers
> -	symbol="$segment$name ($code)"
> +	symbol="$segment$name (${output[@]})"
>  }
>  
>  decode_code() {
> -- 
> 2.27.0

  reply	other threads:[~2020-07-20 23:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-20  7:44 Jiri Slaby
2020-07-20 23:05 ` Andrew Morton [this message]
2020-07-22  7:12   ` Jiri Slaby

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=20200720160516.9e53d2c3cc4c68fb4a6d2dd4@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=drinkcat@chromium.org \
    --cc=jslaby@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pihsun@chromium.org \
    --cc=sashal@kernel.org \
    --cc=shik@chromium.org \
    --cc=swboyd@chromium.org \
    /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

all inboxes | Powered by JetHome®