Commit e75b513e authored by Andrii Nakryiko's avatar Andrii Nakryiko
Browse files

Merge branch 'libbpf: Fix BTF dump of pointer-to-array-of-struct'

Jean-Philippe Brucker says:

====================

Fix an issue with the libbpf BTF dump, see patch 1 for details.

Since [v1] I added the selftest in patch 2, though I couldn't figure out
a way to make it independent from the order in which debug info is
issued by the compiler.

[v1]: https://lore.kernel.org/bpf/20210318122700.396574-1-jean-philippe@linaro.org/


====================

Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
parents eddbe8e6 f118aac6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -462,7 +462,7 @@ static int btf_dump_order_type(struct btf_dump *d, __u32 id, bool through_ptr)
		return err;

	case BTF_KIND_ARRAY:
		return btf_dump_order_type(d, btf_array(t)->type, through_ptr);
		return btf_dump_order_type(d, btf_array(t)->type, false);

	case BTF_KIND_STRUCT:
	case BTF_KIND_UNION: {
+8 −0
Original line number Diff line number Diff line
@@ -174,6 +174,12 @@ struct struct_in_struct {
	};
};

struct struct_in_array {};

struct struct_in_array_typed {};

typedef struct struct_in_array_typed struct_in_array_t[2];

struct struct_with_embedded_stuff {
	int a;
	struct {
@@ -203,6 +209,8 @@ struct struct_with_embedded_stuff {
	} r[5];
	struct struct_in_struct s[10];
	int t[11];
	struct struct_in_array (*u)[2];
	struct_in_array_t *v;
};

struct root_struct {