Commit e75b513e authored by Andrii Nakryiko's avatar Andrii Nakryiko

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
...@@ -462,7 +462,7 @@ static int btf_dump_order_type(struct btf_dump *d, __u32 id, bool through_ptr) ...@@ -462,7 +462,7 @@ static int btf_dump_order_type(struct btf_dump *d, __u32 id, bool through_ptr)
return err; return err;
case BTF_KIND_ARRAY: 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_STRUCT:
case BTF_KIND_UNION: { case BTF_KIND_UNION: {
......
...@@ -174,6 +174,12 @@ struct struct_in_struct { ...@@ -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 { struct struct_with_embedded_stuff {
int a; int a;
struct { struct {
...@@ -203,6 +209,8 @@ struct struct_with_embedded_stuff { ...@@ -203,6 +209,8 @@ struct struct_with_embedded_stuff {
} r[5]; } r[5];
struct struct_in_struct s[10]; struct struct_in_struct s[10];
int t[11]; int t[11];
struct struct_in_array (*u)[2];
struct_in_array_t *v;
}; };
struct root_struct { struct root_struct {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment