Thread (42 messages) flat view 42 messages, 3 authors, 5d ago

Re: [PATCH v2 bpf-next 11/18] bpftool: Add ability to dump LOC_PARAM, LOC_PROTO and LOCSEC

From: bot+bpf-ci@kernel.org
Date: 2026-09-01 17:55:46
Also in: bpf

quoted hunk ↗ jump to hunk
diff --git a/tools/bpf/bpftool/btf.c b/tools/bpf/bpftool/btf.c
index bca0a3982f09..4d8991c99b48 100644
--- a/tools/bpf/bpftool/btf.c
+++ b/tools/bpf/bpftool/btf.c
[ ... ]
quoted hunk ↗ jump to hunk
@@ -415,6 +418,88 @@ static int dump_btf_type(const struct btf *btf, __u32 id,
 		}
 		break;
 	}
+	case BTF_KIND_LOC_PARAM: {
+		const struct btf_loc_param *p = btf_loc_param(t);
+		__u32 *v = (__u32 *)(p + 1);
+		__u32 i, vlen = btf_vlen(t);
+
+		if (json_output) {
+			jsonw_uint_field(w, "size", t->size);
+			jsonw_uint_field(w, "flags", p->flags);
+			jsonw_uint_field(w, "vlen", vlen);
+			jsonw_name(w, "values");
+			jsonw_start_array(w);
+		} else {
+			printf(" size=%u flags=0x%x vlen=%u", t->size, p->flags, vlen);
+		}
+		for (i = 0; i < vlen; i++, v++) {
+			if (json_output) {
+				jsonw_start_object(w);
+				jsonw_uint_field(w, "value", *v);
+				jsonw_end_object(w);
+			} else {
+				printf("\n\t value=%u", *v);
                                              ^^^^^

This isn't a bug, but was the extra space after '\n\t' in the format
strings intentional? Looking at the existing dump_btf_type() arms,
DATASEC prints "\n\ttype_id=%u offset=%u size=%u" with just '\n\t' and
no leading space. The new LOC_PARAM, LOC_PROTO, and LOCSEC arms all use
'\n\t ' (tab followed by a space), which indents the output one column
further than the rest of the function's raw dump lines. Could the space
be dropped to align with the DATASEC style?
+			}
+		}
+		if (json_output)
+			jsonw_end_array(w);
+		break;
+	}
+	case BTF_KIND_LOC_PROTO: {
[ ... ]
+	case BTF_KIND_LOCSEC: {
[ ... ]


---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

CI run summary: https://github.com/kernel-patches/bpf/actions/runs/33537080133
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help