dwarves
dwarves copied to clipboard
Arrays are flattened when pahole --btf_encode_detached is used
$ cat << EOF > struct_foo.c
struct foo {
int array[10][20];
};
int main()
{
struct foo bar;
}
EOF
$ gcc -ggdb struct_foo.c -o struct_foo
$ ../pahole_git/build/pahole struct_foo
struct foo {
int array[10][20]; /* 0 800 */
/* size: 800, cachelines: 13, members: 1 */
/* last cacheline: 32 bytes */
};
The array member has not been flattened yet.
Let's detach the BTF to the struct_foo.btf file
$ ../pahole_git/build/pahole --btf_encode_detached struct_foo.btf struct_foo
$ ../pahole_git/build/pahole struct_foo.btf
struct foo {
int array[200]; /* 0 800 */
/* size: 800, cachelines: 13, members: 1 */
/* last cacheline: 32 bytes */
};
As you can see above, even without using --flat_arrays, the arrays are flattened.
Tested with the latest repo changes
$ cd ../pahole_git
$ git rev-parse --short HEAD
de24234