Prep 1.29
[dwarves.git] / ctf_loader.c
blob501c4abe859c0d52e048a35e82a6a7491258e6bd
1 /* ctfdump.c: CTF dumper.
3 * Copyright (C) 2008 David S. Miller <davem@davemloft.net>
4 */
6 #include <sys/types.h>
7 #include <sys/stat.h>
8 #include <errno.h>
9 #include <fcntl.h>
10 #include <stdio.h>
11 #include <unistd.h>
12 #include <stdlib.h>
13 #include <stddef.h>
14 #include <malloc.h>
15 #include <string.h>
16 #include <limits.h>
17 #include <libgen.h>
18 #include <zlib.h>
20 #include <gelf.h>
22 #include "libctf.h"
23 #include "ctf.h"
24 #include "dutil.h"
25 #include "dwarves.h"
27 static void *tag__alloc(const size_t size)
29 struct tag *tag = zalloc(size);
31 if (tag != NULL)
32 tag->top_level = 1;
34 return tag;
37 static int ctf__load_ftype(struct ctf *ctf, struct ftype *proto, struct cu *cu, uint16_t tag,
38 uint16_t type, uint16_t vlen, uint16_t *args, long id)
40 proto->tag.tag = tag;
41 proto->tag.type = type;
42 INIT_LIST_HEAD(&proto->parms);
43 INIT_LIST_HEAD(&proto->template_type_params);
44 INIT_LIST_HEAD(&proto->template_value_params);
45 proto->template_parameter_pack = NULL;
46 proto->formal_parameter_pack = NULL;
48 int i;
49 for (i = 0; i < vlen; i++) {
50 uint16_t type = ctf__get16(ctf, &args[i]);
52 if (type == 0)
53 proto->unspec_parms = 1;
54 else {
55 struct parameter *p = tag__alloc(sizeof(*p));
57 if (p == NULL)
58 goto out_free_parameters;
59 p->tag.tag = DW_TAG_formal_parameter;
60 p->tag.type = ctf__get16(ctf, &args[i]);
61 ftype__add_parameter(proto, p);
65 vlen *= sizeof(*args);
67 /* Round up to next multiple of 4 to maintain
68 * 32-bit alignment.
70 if (vlen & 0x2)
71 vlen += 0x2;
73 if (id < 0) {
74 uint32_t type_id;
76 cu__add_tag(ctf->priv, &proto->tag, &type_id);
77 } else {
78 cu__add_tag_with_id(ctf->priv, &proto->tag, id);
81 return vlen;
82 out_free_parameters:
83 ftype__delete(proto, cu);
84 return -ENOMEM;
87 static struct function *function__new(uint16_t **ptr, GElf_Sym *sym,
88 struct ctf *ctf, struct cu *cu)
90 struct function *func = tag__alloc(sizeof(*func));
92 if (func != NULL) {
93 func->lexblock.ip.addr = elf_sym__value(sym);
94 func->lexblock.size = elf_sym__size(sym);
95 func->name = elf_sym__name(sym, ctf->symtab);
96 func->vtable_entry = -1;
97 func->external = elf_sym__bind(sym) == STB_GLOBAL;
98 INIT_LIST_HEAD(&func->vtable_node);
99 INIT_LIST_HEAD(&func->tool_node);
100 INIT_LIST_HEAD(&func->lexblock.tags);
102 uint16_t val = ctf__get16(ctf, *ptr);
103 uint16_t tag = CTF_GET_KIND(val);
104 uint16_t vlen = CTF_GET_VLEN(val);
106 ++*ptr;
108 if (tag != CTF_TYPE_KIND_FUNC) {
109 fprintf(stderr,
110 "%s: Expected function type, got %u\n",
111 __func__, tag);
112 goto out_delete;
114 uint16_t type = ctf__get16(ctf, *ptr);
115 long id = -1; /* FIXME: not needed for funcs... */
117 ++*ptr;
119 if (ctf__load_ftype(ctf, &func->proto, cu, DW_TAG_subprogram,
120 type, vlen, *ptr, id) < 0)
121 return NULL;
123 * Round up to next multiple of 4 to maintain 32-bit alignment.
125 if (vlen & 0x1)
126 ++vlen;
127 *ptr += vlen;
130 return func;
131 out_delete:
132 free(func);
133 return NULL;
136 static int ctf__load_funcs(struct ctf *ctf, struct cu *cu)
138 struct ctf_header *hp = ctf__get_buffer(ctf);
139 uint16_t *func_ptr = (ctf__get_buffer(ctf) + sizeof(*hp) +
140 ctf__get32(ctf, &hp->ctf_func_off));
142 GElf_Sym sym;
143 uint32_t idx;
144 ctf__for_each_symtab_function(ctf, idx, sym)
145 if (function__new(&func_ptr, &sym, ctf, cu) == NULL)
146 return -ENOMEM;
148 return 0;
151 static struct base_type *base_type__new(const char *name, uint32_t attrs,
152 uint8_t float_type, size_t size)
154 struct base_type *bt = tag__alloc(sizeof(*bt));
156 if (bt != NULL) {
157 bt->name = name;
158 bt->bit_size = size;
159 bt->is_signed = attrs & CTF_TYPE_INT_SIGNED;
160 bt->is_bool = attrs & CTF_TYPE_INT_BOOL;
161 bt->is_varargs = attrs & CTF_TYPE_INT_VARARGS;
162 bt->name_has_encoding = false;
163 bt->float_type = float_type;
164 INIT_LIST_HEAD(&bt->node);
166 return bt;
169 static void type__init(struct type *type, uint16_t tag, const char *name, size_t size)
171 __type__init(type);
172 INIT_LIST_HEAD(&type->namespace.tags);
173 type->size = size;
174 type->namespace.tag.tag = tag;
175 type->namespace.name = name;
176 type->template_parameter_pack = NULL;
179 static struct type *type__new(uint16_t tag, const char *name, size_t size)
181 struct type *type = tag__alloc(sizeof(*type));
183 if (type != NULL)
184 type__init(type, tag, name, size);
186 return type;
189 static struct class *class__new(const char *name, size_t size)
191 struct class *class = tag__alloc(sizeof(*class));
193 if (class != NULL) {
194 type__init(&class->type, DW_TAG_structure_type, name, size);
195 INIT_LIST_HEAD(&class->vtable);
198 return class;
201 static int create_new_base_type(struct ctf *ctf, void *ptr,
202 struct ctf_full_type *tp, uint32_t id)
204 uint32_t *enc = ptr;
205 uint32_t eval = ctf__get32(ctf, enc);
206 uint32_t attrs = CTF_TYPE_INT_ATTRS(eval);
207 uint32_t name = ctf__get32(ctf, &tp->base.ctf_name);
208 struct base_type *base = base_type__new(ctf__string(ctf, name), attrs, 0,
209 CTF_TYPE_INT_BITS(eval));
210 if (base == NULL)
211 return -ENOMEM;
213 base->tag.tag = DW_TAG_base_type;
214 cu__add_tag_with_id(ctf->priv, &base->tag, id);
216 return sizeof(*enc);
219 static int create_new_base_type_float(struct ctf *ctf, void *ptr,
220 struct ctf_full_type *tp,
221 uint32_t id)
223 uint32_t name = ctf__get32(ctf, &tp->base.ctf_name);
224 uint32_t *enc = ptr, eval = ctf__get32(ctf, enc);
225 struct base_type *base = base_type__new(ctf__string(ctf, name), 0, eval,
226 CTF_TYPE_FP_BITS(eval));
227 if (base == NULL)
228 return -ENOMEM;
230 base->tag.tag = DW_TAG_base_type;
231 cu__add_tag_with_id(ctf->priv, &base->tag, id);
233 return sizeof(*enc);
236 static int create_new_array(struct ctf *ctf, void *ptr, uint32_t id)
238 struct ctf_array *ap = ptr;
239 struct array_type *array = tag__alloc(sizeof(*array));
241 if (array == NULL)
242 return -ENOMEM;
244 /* FIXME: where to get the number of dimensions?
245 * it it flattened? */
246 array->dimensions = 1;
247 array->nr_entries = malloc(sizeof(uint32_t));
249 if (array->nr_entries == NULL) {
250 free(array);
251 return -ENOMEM;
254 array->nr_entries[0] = ctf__get32(ctf, &ap->ctf_array_nelems);
255 array->tag.tag = DW_TAG_array_type;
256 array->tag.type = ctf__get16(ctf, &ap->ctf_array_type);
258 cu__add_tag_with_id(ctf->priv, &array->tag, id);
260 return sizeof(*ap);
263 static int create_new_subroutine_type(struct ctf *ctf, void *ptr,
264 int vlen, struct ctf_full_type *tp,
265 uint32_t id, struct cu *cu)
267 uint16_t *args = ptr;
268 unsigned int type = ctf__get16(ctf, &tp->base.ctf_type);
269 struct ftype *proto = tag__alloc(sizeof(*proto));
271 if (proto == NULL)
272 return -ENOMEM;
274 vlen = ctf__load_ftype(ctf, proto, cu, DW_TAG_subroutine_type,
275 type, vlen, args, id);
276 return vlen < 0 ? -ENOMEM : vlen;
279 static int create_full_members(struct ctf *ctf, void *ptr,
280 int vlen, struct type *class)
282 struct ctf_full_member *mp = ptr;
283 int i;
285 for (i = 0; i < vlen; i++) {
286 struct class_member *member = zalloc(sizeof(*member));
288 if (member == NULL)
289 return -ENOMEM;
291 member->tag.tag = DW_TAG_member;
292 member->tag.type = ctf__get16(ctf, &mp[i].ctf_member_type);
293 member->name = ctf__string(ctf, ctf__get32(ctf, &mp[i].ctf_member_name));
294 member->bit_offset = (ctf__get32(ctf, &mp[i].ctf_member_offset_high) << 16) |
295 ctf__get32(ctf, &mp[i].ctf_member_offset_low);
296 /* sizes and offsets will be corrected at class__fixup_ctf_bitfields */
297 type__add_member(class, member);
300 return sizeof(*mp);
303 static int create_short_members(struct ctf *ctf, void *ptr,
304 int vlen, struct type *class)
306 struct ctf_short_member *mp = ptr;
307 int i;
309 for (i = 0; i < vlen; i++) {
310 struct class_member *member = zalloc(sizeof(*member));
312 if (member == NULL)
313 return -ENOMEM;
315 member->tag.tag = DW_TAG_member;
316 member->tag.type = ctf__get16(ctf, &mp[i].ctf_member_type);
317 member->name = ctf__string(ctf, ctf__get32(ctf, &mp[i].ctf_member_name));
318 member->bit_offset = ctf__get16(ctf, &mp[i].ctf_member_offset);
319 /* sizes and offsets will be corrected at class__fixup_ctf_bitfields */
321 type__add_member(class, member);
324 return sizeof(*mp);
327 static int create_new_class(struct ctf *ctf, void *ptr,
328 int vlen, struct ctf_full_type *tp,
329 uint64_t size, uint32_t id, struct cu *cu)
331 int member_size;
332 const char *name = ctf__string(ctf, ctf__get32(ctf, &tp->base.ctf_name));
333 struct class *class = class__new(name, size);
335 if (size >= CTF_SHORT_MEMBER_LIMIT) {
336 member_size = create_full_members(ctf, ptr, vlen, &class->type);
337 } else {
338 member_size = create_short_members(ctf, ptr, vlen, &class->type);
341 if (member_size < 0)
342 goto out_free;
344 cu__add_tag_with_id(ctf->priv, &class->type.namespace.tag, id);
346 return (vlen * member_size);
347 out_free:
348 class__delete(class, cu);
349 return -ENOMEM;
352 static int create_new_union(struct ctf *ctf, void *ptr,
353 int vlen, struct ctf_full_type *tp,
354 uint64_t size, uint32_t id, struct cu *cu)
356 int member_size;
357 const char *name = ctf__string(ctf, ctf__get32(ctf, &tp->base.ctf_name));
358 struct type *un = type__new(DW_TAG_union_type, name, size);
360 if (size >= CTF_SHORT_MEMBER_LIMIT) {
361 member_size = create_full_members(ctf, ptr, vlen, un);
362 } else {
363 member_size = create_short_members(ctf, ptr, vlen, un);
366 if (member_size < 0)
367 goto out_free;
369 cu__add_tag_with_id(ctf->priv, &un->namespace.tag, id);
371 return (vlen * member_size);
372 out_free:
373 type__delete(un, cu);
374 return -ENOMEM;
377 static struct enumerator *enumerator__new(const char *name, uint32_t value)
379 struct enumerator *en = tag__alloc(sizeof(*en));
381 if (en != NULL) {
382 en->name = name;
383 en->value = value;
384 en->tag.tag = DW_TAG_enumerator;
387 return en;
390 static int create_new_enumeration(struct ctf *ctf, void *ptr,
391 int vlen, struct ctf_full_type *tp,
392 uint16_t size, uint32_t id, struct cu *cu)
394 struct ctf_enum *ep = ptr;
395 uint16_t i;
396 const char *name = ctf__string(ctf, ctf__get32(ctf, &tp->base.ctf_name));
397 struct type *enumeration = type__new(DW_TAG_enumeration_type, name, size ?: (sizeof(int) * 8));
399 if (enumeration == NULL)
400 return -ENOMEM;
402 for (i = 0; i < vlen; i++) {
403 const char *name = ctf__string(ctf, ctf__get32(ctf, &ep[i].ctf_enum_name));
404 uint32_t value = ctf__get32(ctf, &ep[i].ctf_enum_val);
405 struct enumerator *enumerator = enumerator__new(name, value);
407 if (enumerator == NULL)
408 goto out_free;
410 enumeration__add(enumeration, enumerator);
413 cu__add_tag_with_id(ctf->priv, &enumeration->namespace.tag, id);
415 return (vlen * sizeof(*ep));
416 out_free:
417 enumeration__delete(enumeration, cu);
418 return -ENOMEM;
421 static int create_new_forward_decl(struct ctf *ctf, struct ctf_full_type *tp,
422 uint64_t size, uint32_t id)
424 const char *name = ctf__string(ctf, ctf__get32(ctf, &tp->base.ctf_name));
425 struct class *fwd = class__new(name, size);
427 if (fwd == NULL)
428 return -ENOMEM;
429 fwd->type.declaration = 1;
430 cu__add_tag_with_id(ctf->priv, &fwd->type.namespace.tag, id);
431 return 0;
434 static int create_new_typedef(struct ctf *ctf, struct ctf_full_type *tp,
435 uint64_t size, uint32_t id)
437 const char *name = ctf__string(ctf, ctf__get32(ctf, &tp->base.ctf_name));
438 unsigned int type_id = ctf__get16(ctf, &tp->base.ctf_type);
439 struct type *type = type__new(DW_TAG_typedef, name, size);
441 if (type == NULL)
442 return -ENOMEM;
444 type->namespace.tag.type = type_id;
445 cu__add_tag_with_id(ctf->priv, &type->namespace.tag, id);
447 return 0;
450 static int create_new_tag(struct ctf *ctf, int type,
451 struct ctf_full_type *tp, uint32_t id)
453 unsigned int type_id = ctf__get16(ctf, &tp->base.ctf_type);
454 struct tag *tag = zalloc(sizeof(*tag));
456 if (tag == NULL)
457 return -ENOMEM;
459 switch (type) {
460 case CTF_TYPE_KIND_CONST: tag->tag = DW_TAG_const_type; break;
461 case CTF_TYPE_KIND_PTR: tag->tag = DW_TAG_pointer_type; break;
462 case CTF_TYPE_KIND_RESTRICT: tag->tag = DW_TAG_restrict_type; break;
463 case CTF_TYPE_KIND_VOLATILE: tag->tag = DW_TAG_volatile_type; break;
464 default:
465 free(tag);
466 printf("%s: unknown type %d\n\n", __func__, type);
467 return 0;
470 tag->type = type_id;
471 cu__add_tag_with_id(ctf->priv, tag, id);
473 return 0;
476 static int ctf__load_types(struct ctf *ctf, struct cu *cu)
478 void *ctf_buffer = ctf__get_buffer(ctf);
479 struct ctf_header *hp = ctf_buffer;
480 void *ctf_contents = ctf_buffer + sizeof(*hp),
481 *type_section = (ctf_contents + ctf__get32(ctf, &hp->ctf_type_off)),
482 *strings_section = (ctf_contents + ctf__get32(ctf, &hp->ctf_str_off));
483 struct ctf_full_type *type_ptr = type_section,
484 *end = strings_section;
485 uint32_t type_index = 0x0001;
487 if (hp->ctf_parent_name || hp->ctf_parent_label)
488 type_index += 0x8000;
490 while (type_ptr < end) {
491 uint16_t val = ctf__get16(ctf, &type_ptr->base.ctf_info);
492 uint16_t type = CTF_GET_KIND(val);
493 int vlen = CTF_GET_VLEN(val);
494 void *ptr = type_ptr;
495 uint16_t base_size = ctf__get16(ctf, &type_ptr->base.ctf_size);
496 uint64_t size = base_size;
498 if (base_size == 0xffff) {
499 size = ctf__get32(ctf, &type_ptr->ctf_size_high);
500 size <<= 32;
501 size |= ctf__get32(ctf, &type_ptr->ctf_size_low);
502 ptr += sizeof(struct ctf_full_type);
503 } else
504 ptr += sizeof(struct ctf_short_type);
506 if (type == CTF_TYPE_KIND_INT) {
507 vlen = create_new_base_type(ctf, ptr, type_ptr, type_index);
508 } else if (type == CTF_TYPE_KIND_FLT) {
509 vlen = create_new_base_type_float(ctf, ptr, type_ptr, type_index);
510 } else if (type == CTF_TYPE_KIND_ARR) {
511 vlen = create_new_array(ctf, ptr, type_index);
512 } else if (type == CTF_TYPE_KIND_FUNC) {
513 vlen = create_new_subroutine_type(ctf, ptr, vlen, type_ptr, type_index, cu);
514 } else if (type == CTF_TYPE_KIND_STR) {
515 vlen = create_new_class(ctf, ptr,
516 vlen, type_ptr, size, type_index, cu);
517 } else if (type == CTF_TYPE_KIND_UNION) {
518 vlen = create_new_union(ctf, ptr,
519 vlen, type_ptr, size, type_index, cu);
520 } else if (type == CTF_TYPE_KIND_ENUM) {
521 vlen = create_new_enumeration(ctf, ptr, vlen, type_ptr,
522 size, type_index, cu);
523 } else if (type == CTF_TYPE_KIND_FWD) {
524 vlen = create_new_forward_decl(ctf, type_ptr, size, type_index);
525 } else if (type == CTF_TYPE_KIND_TYPDEF) {
526 vlen = create_new_typedef(ctf, type_ptr, size, type_index);
527 } else if (type == CTF_TYPE_KIND_VOLATILE ||
528 type == CTF_TYPE_KIND_PTR ||
529 type == CTF_TYPE_KIND_CONST ||
530 type == CTF_TYPE_KIND_RESTRICT) {
531 vlen = create_new_tag(ctf, type, type_ptr, type_index);
532 } else if (type == CTF_TYPE_KIND_UNKN) {
533 cu__table_nullify_type_entry(ctf->priv, type_index);
534 fprintf(stderr,
535 "CTF: idx: %d, off: %zd, root: %s Unknown\n",
536 type_index, ((void *)type_ptr) - type_section,
537 CTF_ISROOT(val) ? "yes" : "no");
538 vlen = 0;
539 } else
540 return -EINVAL;
542 if (vlen < 0)
543 return vlen;
545 type_ptr = ptr + vlen;
546 type_index++;
548 return 0;
551 static struct variable *variable__new(uint16_t type, GElf_Sym *sym,
552 struct ctf *ctf)
554 struct variable *var = tag__alloc(sizeof(*var));
556 if (var != NULL) {
557 var->scope = VSCOPE_GLOBAL;
558 var->ip.addr = elf_sym__value(sym);
559 var->name = ctf->symtab->symstrs->d_buf + sym->st_name;
560 var->external = elf_sym__bind(sym) == STB_GLOBAL;
561 var->ip.tag.tag = DW_TAG_variable;
562 var->ip.tag.type = type;
563 uint32_t id; /* FIXME: not needed for variables... */
564 cu__add_tag(ctf->priv, &var->ip.tag, &id);
567 return var;
570 static int ctf__load_objects(struct ctf *ctf)
572 struct ctf_header *hp = ctf__get_buffer(ctf);
573 uint16_t *objp = (ctf__get_buffer(ctf) + sizeof(*hp) +
574 ctf__get32(ctf, &hp->ctf_object_off));
576 GElf_Sym sym;
577 uint32_t idx;
578 ctf__for_each_symtab_object(ctf, idx, sym) {
579 const uint16_t type = *objp;
581 * Discard void objects, probably was an object
582 * we didn't found DWARF info for when encoding.
584 if (type && variable__new(type, &sym, ctf) == NULL)
585 return -ENOMEM;
586 ++objp;
589 return 0;
592 static int ctf__load_sections(struct ctf *ctf, struct cu *cu)
594 int err = ctf__load_symtab(ctf);
596 if (err != 0)
597 goto out;
598 err = ctf__load_funcs(ctf, cu);
599 if (err == 0)
600 err = ctf__load_types(ctf, cu);
601 if (err == 0)
602 err = ctf__load_objects(ctf);
603 out:
604 return err;
607 static int class__fixup_ctf_bitfields(struct tag *tag, struct cu *cu)
609 struct class_member *pos;
610 struct type *tag_type = tag__type(tag);
612 type__for_each_data_member(tag_type, pos) {
613 struct tag *type = tag__strip_typedefs_and_modifiers(&pos->tag, cu);
615 if (type == NULL) /* FIXME: C++ CTF... */
616 continue;
618 pos->bitfield_offset = 0;
619 pos->bitfield_size = 0;
620 pos->byte_offset = pos->bit_offset / 8;
622 uint16_t type_bit_size;
623 size_t integral_bit_size;
625 switch (type->tag) {
626 case DW_TAG_enumeration_type:
627 type_bit_size = tag__type(type)->size;
628 /* Best we can do to check if this is a packed enum */
629 if (is_power_of_2(type_bit_size))
630 integral_bit_size = roundup(type_bit_size, 8);
631 else
632 integral_bit_size = sizeof(int) * 8;
633 break;
634 case DW_TAG_base_type: {
635 struct base_type *bt = tag__base_type(type);
636 char name[256];
637 type_bit_size = bt->bit_size;
638 integral_bit_size = base_type__name_to_size(bt, cu);
639 if (integral_bit_size == 0)
640 fprintf(stderr, "%s: unknown base type name \"%s\"!\n",
641 __func__, base_type__name(bt, name, sizeof(name)));
643 break;
644 default:
645 pos->byte_size = tag__size(type, cu);
646 pos->bit_size = pos->byte_size * 8;
647 continue;
651 * XXX: integral_bit_size can be zero if base_type__name_to_size doesn't
652 * know about the base_type name, so one has to add there when
653 * such base_type isn't found. pahole will put zero on the
654 * struct output so it should be easy to spot the name when
655 * such unlikely thing happens.
657 pos->byte_size = integral_bit_size / 8;
659 if (integral_bit_size == 0 || type_bit_size == integral_bit_size) {
660 pos->bit_size = integral_bit_size;
661 continue;
664 pos->bitfield_offset = pos->bit_offset % integral_bit_size;
665 pos->bitfield_size = type_bit_size;
666 pos->bit_size = type_bit_size;
667 pos->byte_offset = (((pos->bit_offset / integral_bit_size) *
668 integral_bit_size) / 8);
671 return 0;
674 static int cu__fixup_ctf_bitfields(struct cu *cu)
676 int err = 0;
677 struct tag *pos;
679 list_for_each_entry(pos, &cu->tags, node)
680 if (tag__is_struct(pos) || tag__is_union(pos)) {
681 err = class__fixup_ctf_bitfields(pos, cu);
682 if (err)
683 break;
686 return err;
689 static void ctf__cu_delete(struct cu *cu)
691 ctf__delete(cu->priv);
692 cu->priv = NULL;
695 struct debug_fmt_ops ctf__ops;
697 int ctf__load_file(struct cus *cus, struct conf_load *conf,
698 const char *filename)
700 int err;
701 struct ctf *state = ctf__new(filename, NULL);
703 if (state == NULL)
704 return -1;
706 struct cu *cu = cu__new(filename, state->wordsize, NULL, 0, filename, false);
707 if (cu == NULL)
708 return -1;
710 cu->language = LANG_C;
711 cu->uses_global_strings = false;
712 cu->little_endian = state->ehdr.e_ident[EI_DATA] == ELFDATA2LSB;
713 cu->dfops = &ctf__ops;
714 cu->priv = state;
715 state->priv = cu;
716 if (ctf__load(state) != 0)
717 return -1;
719 err = ctf__load_sections(state, cu);
721 if (err != 0) {
722 cu__delete(cu);
723 return err;
726 err = cu__fixup_ctf_bitfields(cu);
728 * The app stole this cu, possibly deleting it,
729 * so forget about it
731 if (conf && conf->steal && conf->steal(cu, conf))
732 return 0;
734 cus__add(cus, cu);
735 return err;
738 struct debug_fmt_ops ctf__ops = {
739 .name = "ctf",
740 .load_file = ctf__load_file,
741 .cu__delete = ctf__cu_delete,