Dwarves debugging tools
 help / color / mirror / Atom feed
From: "Alexei Starovoitov" <alexei.starovoitov@gmail.com>
To: "Yonghong Song" <yonghong.song@linux.dev>,
	"Alan Maguire" <alan.maguire@oracle.com>,
	"Arnaldo Carvalho de Melo" <arnaldo.melo@gmail.com>,
	<dwarves@vger.kernel.org>
Cc: "Andrii Nakryiko" <andrii@kernel.org>, <bpf@vger.kernel.org>,
	<kernel-team@fb.com>, "Tejun Heo" <tj@kernel.org>
Subject: Re: [PATCH dwarves 1/2] dwarf_loader: Trust the entry value register over the first location entry
Date: Tue, 29 Sep 2026 06:11:43 +0000	[thread overview]
Message-ID: <DLRKT5MG6W2P.2V1P0QD4GQEKY@gmail.com> (raw)
In-Reply-To: <e3f30691-a5d8-41b8-a075-10cf8cf4bd95@linux.dev>

On Sat, Sep 26, 2026 at 10:49 PM Yonghong Song <yonghong.song@linux.dev> wrote:
> Maybe we need to poke into locations to get precise parameter register.
> For example, for argument 'b', we have
> 	[0x0000000000000000, 0x0000000000000000): DW_OP_reg4 RSI
> 	...
> 	[0x0000000000000008, 0x0000000000000015): DW_OP_entry_value(DW_OP_reg5 RDI), DW_OP_stack_value)
> RSI has location starts from 0x0, RDI starts from 0x8 although it has DW_OP_entry_value.
>
> But this makes things complicated, and there is no garantee across different compilers due to
> code gen.

I don't think it has to be complicated.
In your gcc 14 dump the first entry of 'b' starts at low_pc and it's RSI.
In scx_bpf_task_set_lazy_resched() low_pc is ...d70 and the first entry
of 'lazy' starts at ...d8b. RBP there says nothing about the register
'lazy' was passed in.
parameter__decode_location() already has 'start' of every entry.
Can it take the register of the first entry only when that entry
starts at low_pc and use the entry value otherwise?

There is no guarantee, right, but when the guess is wrong the function
is dropped. It's not encoded with a wrong signature.

> One possible workaround is change 'lazy' type from 'bool' to say 'int'.
> As Alexei mentioned in the above, clang didn't handle 'bool' well
> in debug info.

That works for this kfunc and for pahole that is already released,
but every other function with a bool arg is still dropped.
Can clang be fixed to keep the entry range?

  parent reply	other threads:[~2026-09-29  6:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-25 21:36 [PATCH dwarves 1/2] dwarf_loader: Trust the entry value register over the first location entry Yonghong Song
2026-09-25 21:36 ` [PATCH dwarves 2/2] tests: Add test for parameters described by entry values Yonghong Song
2026-09-26  7:45 ` [PATCH dwarves 1/2] dwarf_loader: Trust the entry value register over the first location entry Alexei Starovoitov
2026-09-27  5:49   ` Yonghong Song
2026-09-27  8:37     ` Tejun Heo
2026-09-29  6:11     ` Alexei Starovoitov [this message]
2026-09-29 17:59       ` Yonghong Song

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=DLRKT5MG6W2P.2V1P0QD4GQEKY@gmail.com \
    --to=alexei.starovoitov@gmail.com \
    --cc=alan.maguire@oracle.com \
    --cc=andrii@kernel.org \
    --cc=arnaldo.melo@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=dwarves@vger.kernel.org \
    --cc=kernel-team@fb.com \
    --cc=tj@kernel.org \
    --cc=yonghong.song@linux.dev \
    /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