From: Alan Maguire <alan.maguire@oracle.com>
To: ast@kernel.org, andrii@kernel.org, eddyz87@gmail.com, qmo@kernel.org
Cc: jolsa@kernel.org, daniel@iogearbox.net, ihor.solodrai@linux.dev,
yonghong.song@linux.dev, song@kernel.org, martin.lau@linux.dev,
memxor@gmail.com, emil@etsalapatis.com, bpf@vger.kernel.org,
nsc@kernel.org, puranjay@kernel.org, yatsenko@meta.com,
Alan Maguire <alan.maguire@oracle.com>
Subject: [PATCH v3 bpf-next 3/3] selftests/bpf: Fix up bpftool btf dump test for signatures
Date: Sat, 26 Sep 2026 18:51:13 +0100 [thread overview]
Message-ID: <20260926175113.2368566-4-alan.maguire@oracle.com> (raw)
In-Reply-To: <20260926175113.2368566-1-alan.maguire@oracle.com>
Now we show a function signature, fix up the test to expect it.
Also fix the fact that we did not add the right number of parameters
to the FUNC_PROTO, and ensure consts/addresses are prefixed
appropriately.
Fixes: 321562c34d5b ("bpftool: Add ability to dump LOC_PARAM, LOC_PROTO and LOCSEC")
Signed-off-by: Alan Maguire <alan.maguire@oracle.com>
---
.../selftests/bpf/prog_tests/bpftool_btf_dump.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/tools/testing/selftests/bpf/prog_tests/bpftool_btf_dump.c b/tools/testing/selftests/bpf/prog_tests/bpftool_btf_dump.c
index bed506badc75..abc62958b6ed 100644
--- a/tools/testing/selftests/bpf/prog_tests/bpftool_btf_dump.c
+++ b/tools/testing/selftests/bpf/prog_tests/bpftool_btf_dump.c
@@ -72,6 +72,7 @@ static struct btf *mk_loc_btf(void)
btf__add_func_param(btf, "arg3", 1);
btf__add_func_param(btf, "arg4", 1);
btf__add_func_param(btf, "arg5", 1);
+ btf__add_func_param(btf, "arg6", 1);
btf__add_func(btf, "foo", BTF_FUNC_STATIC, 2);
btf__add_loc_param(btf, 4, BTF_LOC_PARAM_REG);
@@ -230,28 +231,29 @@ static void test_loc_dump(const char *btf_path)
{
const char expected[] =
"[1] INT 'int' size=4 bits_offset=0 nr_bits=32 encoding=SIGNED\n"
- "[2] FUNC_PROTO '(anon)' ret_type_id=1 vlen=5\n"
+ "[2] FUNC_PROTO '(anon)' ret_type_id=1 vlen=6\n"
"\t'arg1' type_id=1\n"
"\t'arg2' type_id=1\n"
"\t'arg3' type_id=1\n"
"\t'arg4' type_id=1\n"
"\t'arg5' type_id=1\n"
+ "\t'arg6' type_id=1\n"
"[3] FUNC 'foo' type_id=2 linkage=static\n"
"[4] LOC_PARAM '(anon)' size=4 flags=0x8 vlen=1 values='reg1'\n"
"[5] LOC_PARAM '(anon)' size=8 flags=0x38 vlen=2 values='*(reg2 + 0x10)'\n"
"[6] LOC_PARAM '(anon)' size=8 flags=0x29 vlen=2 values='fbreg - 0x10'\n"
- "[7] LOC_PARAM '(anon)' size=8 flags=0x6 vlen=2 values='0x123456789abcdef0 (addr)'\n"
- "[8] LOC_PARAM '(anon)' size=8 flags=0x2 vlen=2 values='0xdeadbeeffeedface'\n"
+ "[7] LOC_PARAM '(anon)' size=8 flags=0x6 vlen=2 values='address 0x123456789abcdef0'\n"
+ "[8] LOC_PARAM '(anon)' size=8 flags=0x2 vlen=2 values='const 0xdeadbeeffeedface'\n"
"[9] LOC_PARAM '(anon)' size=8 flags=0x39 vlen=2 values='*(fbreg - 0x20)'\n"
"[10] LOC_PROTO '(anon)' vlen=6\n"
"\ttype_id=4 value='reg1'\n"
"\ttype_id=5 value='*(reg2 + 0x10)'\n"
"\ttype_id=6 value='fbreg - 0x10'\n"
- "\ttype_id=7 value='0x123456789abcdef0 (addr)'\n"
- "\ttype_id=8 value='0xdeadbeeffeedface'\n"
+ "\ttype_id=7 value='address 0x123456789abcdef0'\n"
+ "\ttype_id=8 value='const 0xdeadbeeffeedface'\n"
"\ttype_id=9 value='*(fbreg - 0x20)'\n"
"[11] LOCSEC 'inline.text' vlen=1\n"
- "\tname='foo' func_type_id=3 loc_proto_type_id=10 offset=64\n";
+ "\tfunc='foo(arg1 [reg1], arg2 [*(reg2 + 0x10)], arg3 [fbreg - 0x10], arg4 [address 0x123456789abcdef0], arg5 [const 0xdeadbeeffeedface], arg6 [*(fbreg - 0x20)])' func_type_id=3 loc_proto_type_id=10 offset=64\n";
char *dump;
dump = dump_raw(btf_path);
--
2.43.5
next prev parent reply other threads:[~2026-09-26 17:51 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-26 17:51 [PATCH v3 bpf-next 0/3] BTF inline functionality followups Alan Maguire
2026-09-26 17:51 ` [PATCH v3 bpf-next 1/3] bpf: Verify BTF_KIND_LOC_PARAM vlen, flags Alan Maguire
2026-09-29 10:43 ` Alexei Starovoitov
2026-09-29 10:50 ` Alan Maguire
2026-09-26 17:51 ` [PATCH v3 bpf-next 2/3] bpftool: Update func representation to include function signature Alan Maguire
2026-09-28 9:39 ` Jiri Olsa
2026-09-28 9:50 ` Alan Maguire
2026-09-28 11:46 ` Quentin Monnet
2026-09-26 17:51 ` Alan Maguire [this message]
2026-09-28 9:39 ` [PATCH v3 bpf-next 0/3] BTF inline functionality followups Jiri Olsa
2026-09-28 11:46 ` Quentin Monnet
2026-09-29 10:50 ` patchwork-bot+netdevbpf
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=20260926175113.2368566-4-alan.maguire@oracle.com \
--to=alan.maguire@oracle.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=emil@etsalapatis.com \
--cc=ihor.solodrai@linux.dev \
--cc=jolsa@kernel.org \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--cc=nsc@kernel.org \
--cc=puranjay@kernel.org \
--cc=qmo@kernel.org \
--cc=song@kernel.org \
--cc=yatsenko@meta.com \
--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