Lines Matching full:t
10 const struct btf_type *t; in gen_btf() local
30 t = btf__type_by_id(btf, 1); in gen_btf()
32 ASSERT_EQ(t->name_off, str_off, "int_name_off"); in gen_btf()
33 ASSERT_STREQ(btf__str_by_offset(btf, t->name_off), "int", "int_name"); in gen_btf()
34 ASSERT_EQ(btf_kind(t), BTF_KIND_INT, "int_kind"); in gen_btf()
35 ASSERT_EQ(t->size, 4, "int_sz"); in gen_btf()
36 ASSERT_EQ(btf_int_encoding(t), BTF_INT_SIGNED, "int_enc"); in gen_btf()
37 ASSERT_EQ(btf_int_bits(t), 32, "int_bits"); in gen_btf()
57 t = btf__type_by_id(btf, 2); in gen_btf()
58 ASSERT_EQ(btf_kind(t), BTF_KIND_PTR, "ptr_kind"); in gen_btf()
59 ASSERT_EQ(t->type, 1, "ptr_type"); in gen_btf()
65 t = btf__type_by_id(btf, 3); in gen_btf()
66 ASSERT_EQ(btf_kind(t), BTF_KIND_CONST, "const_kind"); in gen_btf()
67 ASSERT_EQ(t->type, 5, "const_type"); in gen_btf()
73 t = btf__type_by_id(btf, 4); in gen_btf()
74 ASSERT_EQ(btf_kind(t), BTF_KIND_VOLATILE, "volatile_kind"); in gen_btf()
75 ASSERT_EQ(t->type, 3, "volatile_type"); in gen_btf()
81 t = btf__type_by_id(btf, 5); in gen_btf()
82 ASSERT_EQ(btf_kind(t), BTF_KIND_RESTRICT, "restrict_kind"); in gen_btf()
83 ASSERT_EQ(t->type, 4, "restrict_type"); in gen_btf()
90 t = btf__type_by_id(btf, 6); in gen_btf()
91 ASSERT_EQ(btf_kind(t), BTF_KIND_ARRAY, "array_kind"); in gen_btf()
92 ASSERT_EQ(btf_array(t)->index_type, 1, "array_index_type"); in gen_btf()
93 ASSERT_EQ(btf_array(t)->type, 2, "array_elem_type"); in gen_btf()
94 ASSERT_EQ(btf_array(t)->nelems, 10, "array_nelems"); in gen_btf()
108 t = btf__type_by_id(btf, 7); in gen_btf()
109 ASSERT_STREQ(btf__str_by_offset(btf, t->name_off), "s1", "struct_name"); in gen_btf()
110 ASSERT_EQ(btf_kind(t), BTF_KIND_STRUCT, "struct_kind"); in gen_btf()
111 ASSERT_EQ(btf_vlen(t), 2, "struct_vlen"); in gen_btf()
112 ASSERT_EQ(btf_kflag(t), true, "struct_kflag"); in gen_btf()
113 ASSERT_EQ(t->size, 8, "struct_sz"); in gen_btf()
114 m = btf_members(t) + 0; in gen_btf()
117 ASSERT_EQ(btf_member_bit_offset(t, 0), 0, "f1_bit_off"); in gen_btf()
118 ASSERT_EQ(btf_member_bitfield_size(t, 0), 0, "f1_bit_sz"); in gen_btf()
119 m = btf_members(t) + 1; in gen_btf()
122 ASSERT_EQ(btf_member_bit_offset(t, 1), 32, "f2_bit_off"); in gen_btf()
123 ASSERT_EQ(btf_member_bitfield_size(t, 1), 16, "f2_bit_sz"); in gen_btf()
126 "\t'f1' type_id=1 bits_offset=0\n" in gen_btf()
127 "\t'f2' type_id=1 bits_offset=32 bitfield_size=16", "raw_dump"); in gen_btf()
140 t = btf__type_by_id(btf, 8); in gen_btf()
141 ASSERT_STREQ(btf__str_by_offset(btf, t->name_off), "u1", "union_name"); in gen_btf()
142 ASSERT_EQ(btf_kind(t), BTF_KIND_UNION, "union_kind"); in gen_btf()
143 ASSERT_EQ(btf_vlen(t), 1, "union_vlen"); in gen_btf()
144 ASSERT_EQ(btf_kflag(t), true, "union_kflag"); in gen_btf()
145 ASSERT_EQ(t->size, 8, "union_sz"); in gen_btf()
146 m = btf_members(t) + 0; in gen_btf()
149 ASSERT_EQ(btf_member_bit_offset(t, 0), 0, "f1_bit_off"); in gen_btf()
150 ASSERT_EQ(btf_member_bitfield_size(t, 0), 16, "f1_bit_sz"); in gen_btf()
153 "\t'f1' type_id=1 bits_offset=0 bitfield_size=16", "raw_dump"); in gen_btf()
163 t = btf__type_by_id(btf, 9); in gen_btf()
164 ASSERT_STREQ(btf__str_by_offset(btf, t->name_off), "e1", "enum_name"); in gen_btf()
165 ASSERT_EQ(btf_kind(t), BTF_KIND_ENUM, "enum_kind"); in gen_btf()
166 ASSERT_EQ(btf_vlen(t), 2, "enum_vlen"); in gen_btf()
167 ASSERT_EQ(t->size, 4, "enum_sz"); in gen_btf()
168 v = btf_enum(t) + 0; in gen_btf()
171 v = btf_enum(t) + 1; in gen_btf()
176 "\t'v1' val=1\n" in gen_btf()
177 "\t'v2' val=2", "raw_dump"); in gen_btf()
182 t = btf__type_by_id(btf, 10); in gen_btf()
183 ASSERT_STREQ(btf__str_by_offset(btf, t->name_off), "struct_fwd", "fwd_name"); in gen_btf()
184 ASSERT_EQ(btf_kind(t), BTF_KIND_FWD, "fwd_kind"); in gen_btf()
185 ASSERT_EQ(btf_kflag(t), 0, "fwd_kflag"); in gen_btf()
191 t = btf__type_by_id(btf, 11); in gen_btf()
192 ASSERT_STREQ(btf__str_by_offset(btf, t->name_off), "union_fwd", "fwd_name"); in gen_btf()
193 ASSERT_EQ(btf_kind(t), BTF_KIND_FWD, "fwd_kind"); in gen_btf()
194 ASSERT_EQ(btf_kflag(t), 1, "fwd_kflag"); in gen_btf()
200 t = btf__type_by_id(btf, 12); in gen_btf()
201 ASSERT_STREQ(btf__str_by_offset(btf, t->name_off), "enum_fwd", "fwd_name"); in gen_btf()
202 ASSERT_EQ(btf_kind(t), BTF_KIND_ENUM, "enum_fwd_kind"); in gen_btf()
203 ASSERT_EQ(btf_vlen(t), 0, "enum_fwd_kind"); in gen_btf()
204 ASSERT_EQ(t->size, 4, "enum_fwd_sz"); in gen_btf()
211 t = btf__type_by_id(btf, 13); in gen_btf()
212 ASSERT_STREQ(btf__str_by_offset(btf, t->name_off), "typedef1", "typedef_name"); in gen_btf()
213 ASSERT_EQ(btf_kind(t), BTF_KIND_TYPEDEF, "typedef_kind"); in gen_btf()
214 ASSERT_EQ(t->type, 1, "typedef_type"); in gen_btf()
221 t = btf__type_by_id(btf, 14); in gen_btf()
222 ASSERT_STREQ(btf__str_by_offset(btf, t->name_off), "func1", "func_name"); in gen_btf()
223 ASSERT_EQ(t->type, 15, "func_type"); in gen_btf()
224 ASSERT_EQ(btf_kind(t), BTF_KIND_FUNC, "func_kind"); in gen_btf()
225 ASSERT_EQ(btf_vlen(t), BTF_FUNC_GLOBAL, "func_vlen"); in gen_btf()
236 t = btf__type_by_id(btf, 15); in gen_btf()
237 ASSERT_EQ(btf_kind(t), BTF_KIND_FUNC_PROTO, "func_proto_kind"); in gen_btf()
238 ASSERT_EQ(btf_vlen(t), 2, "func_proto_vlen"); in gen_btf()
239 ASSERT_EQ(t->type, 1, "func_proto_ret_type"); in gen_btf()
240 p = btf_params(t) + 0; in gen_btf()
243 p = btf_params(t) + 1; in gen_btf()
248 "\t'p1' type_id=1\n" in gen_btf()
249 "\t'p2' type_id=2", "raw_dump"); in gen_btf()
254 t = btf__type_by_id(btf, 16); in gen_btf()
255 ASSERT_STREQ(btf__str_by_offset(btf, t->name_off), "var1", "var_name"); in gen_btf()
256 ASSERT_EQ(btf_kind(t), BTF_KIND_VAR, "var_kind"); in gen_btf()
257 ASSERT_EQ(t->type, 1, "var_type"); in gen_btf()
258 ASSERT_EQ(btf_var(t)->linkage, BTF_VAR_GLOBAL_ALLOCATED, "var_type"); in gen_btf()
268 t = btf__type_by_id(btf, 17); in gen_btf()
269 ASSERT_STREQ(btf__str_by_offset(btf, t->name_off), "datasec1", "datasec_name"); in gen_btf()
270 ASSERT_EQ(t->size, 12, "datasec_sz"); in gen_btf()
271 ASSERT_EQ(btf_kind(t), BTF_KIND_DATASEC, "datasec_kind"); in gen_btf()
272 ASSERT_EQ(btf_vlen(t), 1, "datasec_vlen"); in gen_btf()
273 vi = btf_var_secinfos(t) + 0; in gen_btf()
284 t = btf__type_by_id(btf, 18); in gen_btf()
285 ASSERT_STREQ(btf__str_by_offset(btf, t->name_off), "tag1", "tag_value"); in gen_btf()
286 ASSERT_EQ(btf_kind(t), BTF_KIND_DECL_TAG, "tag_kind"); in gen_btf()
287 ASSERT_EQ(t->type, 16, "tag_type"); in gen_btf()
288 ASSERT_EQ(btf_decl_tag(t)->component_idx, -1, "tag_component_idx"); in gen_btf()
294 t = btf__type_by_id(btf, 19); in gen_btf()
295 ASSERT_STREQ(btf__str_by_offset(btf, t->name_off), "tag2", "tag_value"); in gen_btf()
296 ASSERT_EQ(btf_kind(t), BTF_KIND_DECL_TAG, "tag_kind"); in gen_btf()
297 ASSERT_EQ(t->type, 14, "tag_type"); in gen_btf()
298 ASSERT_EQ(btf_decl_tag(t)->component_idx, 1, "tag_component_idx"); in gen_btf()
305 t = btf__type_by_id(btf, 20); in gen_btf()
306 ASSERT_STREQ(btf__str_by_offset(btf, t->name_off), "tag1", "tag_value"); in gen_btf()
307 ASSERT_EQ(btf_kind(t), BTF_KIND_TYPE_TAG, "tag_kind"); in gen_btf()
308 ASSERT_EQ(t->type, 1, "tag_type"); in gen_btf()
319 t = btf__type_by_id(btf, 21); in gen_btf()
320 ASSERT_STREQ(btf__str_by_offset(btf, t->name_off), "e1", "enum64_name"); in gen_btf()
321 ASSERT_EQ(btf_kind(t), BTF_KIND_ENUM64, "enum64_kind"); in gen_btf()
322 ASSERT_EQ(btf_vlen(t), 2, "enum64_vlen"); in gen_btf()
323 ASSERT_EQ(t->size, 8, "enum64_sz"); in gen_btf()
324 v64 = btf_enum64(t) + 0; in gen_btf()
328 v64 = btf_enum64(t) + 1; in gen_btf()
334 "\t'v1' val=-1\n" in gen_btf()
335 "\t'v2' val=4886718345", "raw_dump"); in gen_btf()
341 t = btf__type_by_id(btf, 22); in gen_btf()
342 ASSERT_STREQ(btf__str_by_offset(btf, t->name_off), "e1", "enum64_name"); in gen_btf()
343 ASSERT_EQ(btf_kind(t), BTF_KIND_ENUM64, "enum64_kind"); in gen_btf()
344 ASSERT_EQ(btf_vlen(t), 1, "enum64_vlen"); in gen_btf()
345 ASSERT_EQ(t->size, 8, "enum64_sz"); in gen_btf()
346 v64 = btf_enum64(t) + 0; in gen_btf()
352 "\t'v1' val=18446744073709551615", "raw_dump"); in gen_btf()
374 "\t'f1' type_id=1 bits_offset=0\n" in test_btf_add()
375 "\t'f2' type_id=1 bits_offset=32 bitfield_size=16", in test_btf_add()
377 "\t'f1' type_id=1 bits_offset=0 bitfield_size=16", in test_btf_add()
379 "\t'v1' val=1\n" in test_btf_add()
380 "\t'v2' val=2", in test_btf_add()
387 "\t'p1' type_id=1\n" in test_btf_add()
388 "\t'p2' type_id=2", in test_btf_add()
396 "\t'v1' val=-1\n" in test_btf_add()
397 "\t'v2' val=4886718345", in test_btf_add()
399 "\t'v1' val=18446744073709551615"); in test_btf_add()
433 "\t'f1' type_id=1 bits_offset=0\n" in test_btf_add_btf()
434 "\t'f2' type_id=1 bits_offset=32 bitfield_size=16", in test_btf_add_btf()
436 "\t'f1' type_id=1 bits_offset=0 bitfield_size=16", in test_btf_add_btf()
438 "\t'v1' val=1\n" in test_btf_add_btf()
439 "\t'v2' val=2", in test_btf_add_btf()
446 "\t'p1' type_id=1\n" in test_btf_add_btf()
447 "\t'p2' type_id=2", in test_btf_add_btf()
455 "\t'v1' val=-1\n" in test_btf_add_btf()
456 "\t'v2' val=4886718345", in test_btf_add_btf()
458 "\t'v1' val=18446744073709551615", in test_btf_add_btf()
468 "\t'f1' type_id=23 bits_offset=0\n" in test_btf_add_btf()
469 "\t'f2' type_id=23 bits_offset=32 bitfield_size=16", in test_btf_add_btf()
471 "\t'f1' type_id=23 bits_offset=0 bitfield_size=16", in test_btf_add_btf()
473 "\t'v1' val=1\n" in test_btf_add_btf()
474 "\t'v2' val=2", in test_btf_add_btf()
481 "\t'p1' type_id=23\n" in test_btf_add_btf()
482 "\t'p2' type_id=24", in test_btf_add_btf()
490 "\t'v1' val=-1\n" in test_btf_add_btf()
491 "\t'v2' val=4886718345", in test_btf_add_btf()
493 "\t'v1' val=18446744073709551615"); in test_btf_add_btf()