fprintf(out, " ret_type_id=%u vlen=%u", t->type, vlen); for (i = 0; i < vlen; i++, p++) {
fprintf(out, "\n\t'%s' type_id=%u",
btf_str(btf, p->name_off), p->type);
} break;
} case BTF_KIND_VAR:
fprintf(out, " type_id=%u, linkage=%s",
t->type, btf_var_linkage_str(btf_var(t)->linkage)); break; case BTF_KIND_DATASEC: { conststruct btf_var_secinfo *v = btf_var_secinfos(t);
fprintf(out, " size=%u vlen=%u", t->size, vlen); for (i = 0; i < vlen; i++, v++) {
fprintf(out, "\n\ttype_id=%u offset=%u size=%u",
v->type, v->offset, v->size);
} break;
} case BTF_KIND_FLOAT:
fprintf(out, " size=%u", t->size); break; case BTF_KIND_DECL_TAG:
fprintf(out, " type_id=%u component_idx=%d",
t->type, btf_decl_tag(t)->component_idx); break; default: break;
}
return 0;
}
/* Print raw BTF type dump into a local buffer and return string pointer back. * Buffer *will* be overwritten by subsequent btf_type_raw_dump() calls
*/ constchar *btf_type_raw_dump(conststruct btf *btf, int type_id)
{ staticchar buf[16 * 1024];
FILE *buf_file;
buf_file = fmemopen(buf, sizeof(buf) - 1, "w"); if (!buf_file) {
fprintf(stderr, "Failed to open memstream: %d\n", errno); return NULL;
}
/* Print BTF-to-C dump into a local buffer and return string pointer back. * Buffer *will* be overwritten by subsequent btf_type_raw_dump() calls
*/ constchar *btf_type_c_dump(conststruct btf *btf)
{ staticchar buf[16 * 1024];
FILE *buf_file; struct btf_dump *d = NULL; int err, i;
buf_file = fmemopen(buf, sizeof(buf) - 1, "w"); if (!buf_file) {
fprintf(stderr, "Failed to open memstream: %d\n", errno); return NULL;
}
d = btf_dump__new(btf, btf_dump_printf, buf_file, NULL); if (libbpf_get_error(d)) {
fprintf(stderr, "Failed to create btf_dump instance: %ld\n", libbpf_get_error(d)); goto err_out;
}
for (i = 1; i < btf__type_cnt(btf); i++) {
err = btf_dump__dump_type(d, i); if (err) {
fprintf(stderr, "Failed to dump type [%d]: %d\n", i, err); goto err_out;
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.