All of lore.kernel.org
 help / color / mirror / Atom feed
From: Carlos Llamas <cmllamas@google.com>
To: "Matthieu Baerts (NGI0)" <matttbe@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Elliot Berman <quic_eberman@quicinc.com>,
	Stephen Boyd <swboyd@chromium.org>,
	Breno Leitao <leitao@debian.org>,
	Luca Ceresoli <luca.ceresoli@bootlin.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] scripts/decode_stacktrace.sh: code: preserve alignment
Date: Mon, 8 Sep 2025 16:33:08 +0000	[thread overview]
Message-ID: <aL8FROiSovQDRpsm@google.com> (raw)
In-Reply-To: <20250908-decode_strace_indent-v1-3-28e5e4758080@kernel.org>

On Mon, Sep 08, 2025 at 05:41:59PM +0200, Matthieu Baerts (NGI0) wrote:
> With lines having a code to decode, the alignment was not preserved for
> the first line.
> 
> With this sample ...
> 
>   [   52.238089][   T55] RIP: 0010:__ip_queue_xmit+0x127c/0x1820
>   [   52.238401][   T55] Code: c1 83 e0 07 48 c1 e9 03 83 c0 03 (...)
> 
> ... the script was producing the following output:
> 
>   [   52.238089][   T55] RIP: 0010:__ip_queue_xmit (...)
>   [ 52.238401][ T55] Code: c1 83 e0 07 48 c1 e9 03 83 c0 03 (...)
> 
> That's because scripts/decodecode doesn't preserve the alignment. No
> need to modify it, it is enough to give only the "Code: (...)" part to
> this script, and print the prefix without modifications.
> 
> With the same sample, we now have:
> 
>   [   52.238089][   T55] RIP: 0010:__ip_queue_xmit (...)
>   [   52.238401][   T55] Code: c1 83 e0 07 48 c1 e9 03 83 c0 03 (...)
> 
> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
> ---
>  scripts/decode_stacktrace.sh | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/decode_stacktrace.sh b/scripts/decode_stacktrace.sh
> index 0c92d6a7f777e1b2d5452dd894a13a71e3d58051..c73cb802a0a3fc6559c5f53ff844e5cc6e433615 100755
> --- a/scripts/decode_stacktrace.sh
> +++ b/scripts/decode_stacktrace.sh
> @@ -242,8 +242,10 @@ debuginfod_get_vmlinux() {
>  
>  decode_code() {
>  	local scripts=`dirname "${BASH_SOURCE[0]}"`
> +	local lim="Code: "
>  
> -	echo "$1" | $scripts/decodecode
> +	echo -n "${1%%${lim}*}"
> +	echo "${lim}${1##*${lim}}" | $scripts/decodecode
>  }
>  
>  handle_line() {
> 
> -- 
> 2.51.0
> 

This also worked for me. From this:

  [  143.815379][ T5218] kernel BUG at rust/helpers/bug.c:7!
  [  143.815970][ T5218] Oops: invalid opcode: 0000 [#1] PREEMPT SMP KASAN PTI
  [...]
  [ 143.842198][ T5218] RIP: 0010:rust_helper_BUG (rust/helpers/bug.c:7 (discriminator 4)) 
  [ 143.842231][ T5218] Code: cc cc cc cc cc 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 b8 (...)

... to now:

  [  143.815379][ T5218] kernel BUG at rust/helpers/bug.c:7!
  [  143.815970][ T5218] Oops: invalid opcode: 0000 [#1] PREEMPT SMP KASAN PTI
  [...]
  [  143.842198][ T5218] RIP: 0010:rust_helper_BUG (rust/helpers/bug.c:7 (discriminator 4))
  [  143.842231][ T5218] Code: cc cc cc cc cc 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 b8 (...)

Tested-by: Carlos Llamas <cmllamas@google.com>

      reply	other threads:[~2025-09-08 16:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-08 15:41 [PATCH 0/3] scripts/decode_stacktrace.sh: preserve alignment Matthieu Baerts (NGI0)
2025-09-08 15:41 ` [PATCH 1/3] scripts/decode_stacktrace.sh: symbol: avoid trailing whitespaces Matthieu Baerts (NGI0)
2025-09-08 16:18   ` Carlos Llamas
2025-09-10  9:15   ` Luca Ceresoli
2025-09-10 13:07   ` Breno Leitao
2025-09-08 15:41 ` [PATCH 2/3] scripts/decode_stacktrace.sh: symbol: preserve alignment Matthieu Baerts (NGI0)
2025-09-08 16:22   ` Carlos Llamas
2025-09-08 15:41 ` [PATCH 3/3] scripts/decode_stacktrace.sh: code: " Matthieu Baerts (NGI0)
2025-09-08 16:33   ` Carlos Llamas [this message]

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=aL8FROiSovQDRpsm@google.com \
    --to=cmllamas@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=leitao@debian.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luca.ceresoli@bootlin.com \
    --cc=matttbe@kernel.org \
    --cc=quic_eberman@quicinc.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.