Lines Matching refs:type

55  * type, and offset of each member to the specified callback function.
58 ctf_member_iter(ctf_file_t *fp, ctf_id_t type, ctf_member_f *func, void *arg)
66 if ((type = ctf_type_resolve(fp, type)) == CTF_ERR)
69 if ((tp = ctf_lookup_by_id(&fp, type)) == NULL)
109 ctf_enum_iter(ctf_file_t *fp, ctf_id_t type, ctf_enum_f *func, void *arg)
118 if ((type = ctf_type_resolve(fp, type)) == CTF_ERR)
121 if ((tp = ctf_lookup_by_id(&fp, type)) == NULL)
141 * Iterate over every root (user-visible) type in the given CTF container.
142 * We pass the type ID of each type to the specified callback function.
161 * Follow a given type through the graph for TYPEDEF, VOLATILE, CONST, and
162 * RESTRICT nodes until we reach a "base" type node. This is useful when
163 * we want to follow a type ID to a node that has members or a size. To guard
168 ctf_type_resolve(ctf_file_t *fp, ctf_id_t type)
170 ctf_id_t prev = type, otype = type;
174 while ((tp = ctf_lookup_by_id(&fp, type)) != NULL) {
180 if (tp->ctt_type == type || tp->ctt_type == otype ||
182 ctf_dprintf("type %ld cycle detected\n", otype);
185 prev = type;
186 type = tp->ctt_type;
189 return (type);
197 * Lookup the given type ID and print a string name for it into buf. Return
201 ctf_type_qlname(ctf_file_t *fp, ctf_id_t type, char *buf, size_t len,
210 if (fp == NULL && type == CTF_ERR)
214 ctf_decl_push(&cd, fp, type);
222 * If the type graph's order conflicts with lexical precedence order
315 ctf_type_lname(ctf_file_t *fp, ctf_id_t type, char *buf, size_t len)
317 return (ctf_type_qlname(fp, type, buf, len, NULL));
321 * Lookup the given type ID and print a string name for it into buf. If buf
325 ctf_type_name(ctf_file_t *fp, ctf_id_t type, char *buf, size_t len)
327 ssize_t rv = ctf_type_qlname(fp, type, buf, len, NULL);
332 ctf_type_qname(ctf_file_t *fp, ctf_id_t type, char *buf, size_t len,
335 ssize_t rv = ctf_type_qlname(fp, type, buf, len, qname);
341 * Resolve the type down to a base type node, and then return the size
342 * of the type storage in bytes.
345 ctf_type_size(ctf_file_t *fp, ctf_id_t type)
351 if ((type = ctf_type_resolve(fp, type)) == CTF_ERR)
354 if ((tp = ctf_lookup_by_id(&fp, type)) == NULL)
370 * it defines the element type and requires the user to perform
378 if (ctf_array_info(fp, type, &ar) == CTF_ERR ||
390 * Resolve the type down to a base type node, and then return the alignment
391 * needed for the type storage in bytes.
394 ctf_type_align(ctf_file_t *fp, ctf_id_t type)
399 if ((type = ctf_type_resolve(fp, type)) == CTF_ERR)
402 if ((tp = ctf_lookup_by_id(&fp, type)) == NULL)
411 if (ctf_array_info(fp, type, &r) == CTF_ERR)
455 * Return the kind (CTF_K_* constant) for the specified type ID.
458 ctf_type_kind(ctf_file_t *fp, ctf_id_t type)
462 if ((tp = ctf_lookup_by_id(&fp, type)) == NULL)
469 * If the type is one that directly references another type (such as POINTER),
470 * then return the ID of the type to which it refers.
473 ctf_type_reference(ctf_file_t *fp, ctf_id_t type)
478 if ((tp = ctf_lookup_by_id(&fp, type)) == NULL)
494 * Find a pointer to type by looking in fp->ctf_ptrtab. If we can't find a
495 * pointer to the given type, see if we can compute a pointer to the type
496 * resulting from resolving the type down to its base type and use that
501 ctf_type_pointer(ctf_file_t *fp, ctf_id_t type)
506 if (ctf_lookup_by_id(&fp, type) == NULL)
509 if ((ntype = fp->ctf_ptrtab[CTF_TYPE_TO_INDEX(type)]) != 0)
512 if ((type = ctf_type_resolve(fp, type)) == CTF_ERR)
515 if (ctf_lookup_by_id(&fp, type) == NULL)
518 if ((ntype = fp->ctf_ptrtab[CTF_TYPE_TO_INDEX(type)]) != 0)
528 ctf_type_encoding(ctf_file_t *fp, ctf_id_t type, ctf_encoding_t *ep)
535 if ((tp = ctf_lookup_by_id(&fp, type)) == NULL)
641 return (1); /* no other checks required for these type kinds */
648 * Return the type and offset for a given member of a STRUCT or UNION.
651 ctf_member_info(ctf_file_t *fp, ctf_id_t type, const char *name,
659 if ((type = ctf_type_resolve(fp, type)) == CTF_ERR)
662 if ((tp = ctf_lookup_by_id(&fp, type)) == NULL)
699 * Return the array type, index, and size information for the specified ARRAY.
702 ctf_array_info(ctf_file_t *fp, ctf_id_t type, ctf_arinfo_t *arp)
709 if ((tp = ctf_lookup_by_id(&fp, type)) == NULL)
730 ctf_enum_name(ctf_file_t *fp, ctf_id_t type, int value)
738 if ((type = ctf_type_resolve(fp, type)) == CTF_ERR)
741 if ((tp = ctf_lookup_by_id(&fp, type)) == NULL)
767 ctf_enum_value(ctf_file_t *fp, ctf_id_t type, const char *name, int *valp)
775 if ((type = ctf_type_resolve(fp, type)) == CTF_ERR)
778 if ((tp = ctf_lookup_by_id(&fp, type)) == NULL)
803 * Recursively visit the members of any type. This function is used as the
804 * engine for ctf_type_visit, below. We resolve the input type, recursively
805 * invoke ourself for each type member if the type is a struct or union, and
806 * then invoke the callback function on the current type. If any callback
810 ctf_type_rvisit(ctf_file_t *fp, ctf_id_t type, ctf_visit_f *func, void *arg,
813 ctf_id_t otype = type;
819 if ((type = ctf_type_resolve(fp, type)) == CTF_ERR)
822 if ((tp = ctf_lookup_by_id(&fp, type)) == NULL)
863 * Recursively visit the members of any type. We pass the name, member
864 * type, and offset of each member to the specified callback function.
867 ctf_type_visit(ctf_file_t *fp, ctf_id_t type, ctf_visit_f *func, void *arg)
869 return (ctf_type_rvisit(fp, type, func, arg, "", 0, 0));