Lines Matching refs:fp

36 ctf_get_ctt_size(const ctf_file_t *fp, const ctf_type_t *tp, ssize_t *sizep,  in ctf_get_ctt_size()  argument
41 if (fp->ctf_version > CTF_VERSION_1 && in ctf_get_ctt_size()
75 ctf_member_iter(ctf_file_t *fp, ctf_id_t type, ctf_member_f *func, void *arg) in ctf_member_iter() argument
77 ctf_file_t *ofp = fp; in ctf_member_iter()
83 if ((type = ctf_type_resolve(fp, type)) == CTF_ERR) in ctf_member_iter()
86 if ((tp = ctf_lookup_by_id(&fp, type)) == NULL) in ctf_member_iter()
89 (void) ctf_get_ctt_size(fp, tp, &size, &increment); in ctf_member_iter()
90 kind = LCTF_INFO_KIND(fp, tp->ctt_info); in ctf_member_iter()
95 if (fp->ctf_version == CTF_VERSION_1 || size < CTF_LSTRUCT_THRESH) { in ctf_member_iter()
99 for (n = LCTF_INFO_VLEN(fp, tp->ctt_info); n != 0; n--, mp++) { in ctf_member_iter()
100 const char *name = ctf_strptr(fp, mp->ctm_name); in ctf_member_iter()
110 for (n = LCTF_INFO_VLEN(fp, tp->ctt_info); n != 0; n--, lmp++) { in ctf_member_iter()
111 const char *name = ctf_strptr(fp, lmp->ctlm_name); in ctf_member_iter()
126 ctf_enum_iter(ctf_file_t *fp, ctf_id_t type, ctf_enum_f *func, void *arg) in ctf_enum_iter() argument
128 ctf_file_t *ofp = fp; in ctf_enum_iter()
135 if ((type = ctf_type_resolve(fp, type)) == CTF_ERR) in ctf_enum_iter()
138 if ((tp = ctf_lookup_by_id(&fp, type)) == NULL) in ctf_enum_iter()
141 if (LCTF_INFO_KIND(fp, tp->ctt_info) != CTF_K_ENUM) in ctf_enum_iter()
144 (void) ctf_get_ctt_size(fp, tp, NULL, &increment); in ctf_enum_iter()
148 for (n = LCTF_INFO_VLEN(fp, tp->ctt_info); n != 0; n--, ep++) { in ctf_enum_iter()
149 const char *name = ctf_strptr(fp, ep->cte_name); in ctf_enum_iter()
163 ctf_type_iter(ctf_file_t *fp, boolean_t nonroot, ctf_type_f *func, void *arg) in ctf_type_iter() argument
165 ctf_id_t id, max = fp->ctf_typemax; in ctf_type_iter()
166 int rc, child = (fp->ctf_flags & LCTF_CHILD); in ctf_type_iter()
169 const ctf_type_t *tp = LCTF_INDEX_TO_TYPEPTR(fp, id); in ctf_type_iter()
187 ctf_type_resolve(ctf_file_t *fp, ctf_id_t type) in ctf_type_resolve() argument
190 ctf_file_t *ofp = fp; in ctf_type_resolve()
193 while ((tp = ctf_lookup_by_id(&fp, type)) != NULL) { in ctf_type_resolve()
194 switch (LCTF_INFO_KIND(fp, tp->ctt_info)) { in ctf_type_resolve()
245 ctf_format_func(ctf_file_t *fp, ctf_decl_t *cd, in ctf_format_func() argument
257 if (ctf_func_info_by_id(fp, id, &fi) != 0) in ctf_format_func()
268 if (ctf_func_args_by_id(fp, id, fi.ctc_argc, args) != 0) in ctf_format_func()
274 if (ctf_type_name(fp, args[i], aname, sizeof (aname)) == NULL) in ctf_format_func()
297 ctf_type_qlname(ctf_file_t *fp, ctf_id_t type, char *buf, size_t len, in ctf_type_qlname() argument
307 if (fp == NULL && type == CTF_ERR) in ctf_type_qlname()
311 ctf_decl_push(&cd, fp, type); in ctf_type_qlname()
315 return (ctf_set_errno(fp, cd.cd_err)); in ctf_type_qlname()
337 ctf_file_t *rfp = fp; in ctf_type_qlname()
369 ctf_format_func(fp, &cd, vname, in ctf_type_qlname()
446 (void) ctf_set_errno(fp, ECTF_NAMELEN); in ctf_type_qlname()
453 ctf_type_lname(ctf_file_t *fp, ctf_id_t type, char *buf, size_t len) in ctf_type_lname() argument
455 return (ctf_type_qlname(fp, type, buf, len, NULL, NULL)); in ctf_type_lname()
463 ctf_type_name(ctf_file_t *fp, ctf_id_t type, char *buf, size_t len) in ctf_type_name() argument
465 ssize_t rv = ctf_type_qlname(fp, type, buf, len, NULL, NULL); in ctf_type_name()
470 ctf_type_qname(ctf_file_t *fp, ctf_id_t type, char *buf, size_t len, in ctf_type_qname() argument
473 ssize_t rv = ctf_type_qlname(fp, type, buf, len, NULL, qname); in ctf_type_qname()
478 ctf_type_cname(ctf_file_t *fp, ctf_id_t type, char *buf, size_t len, in ctf_type_cname() argument
481 ssize_t rv = ctf_type_qlname(fp, type, buf, len, cname, NULL); in ctf_type_cname()
490 ctf_type_size(ctf_file_t *fp, ctf_id_t type) in ctf_type_size() argument
496 if ((type = ctf_type_resolve(fp, type)) == CTF_ERR) in ctf_type_size()
499 if ((tp = ctf_lookup_by_id(&fp, type)) == NULL) in ctf_type_size()
502 switch (LCTF_INFO_KIND(fp, tp->ctt_info)) { in ctf_type_size()
504 return (fp->ctf_dmodel->ctd_pointer); in ctf_type_size()
513 return (ctf_get_ctt_size(fp, tp, NULL, NULL)); in ctf_type_size()
523 if ((size = ctf_get_ctt_size(fp, tp, NULL, NULL)) > 0) in ctf_type_size()
526 if (ctf_array_info(fp, type, &ar) == CTF_ERR || in ctf_type_size()
527 (size = ctf_type_size(fp, ar.ctr_contents)) == CTF_ERR) in ctf_type_size()
540 size = ctf_get_ctt_size(fp, tp, NULL, NULL); in ctf_type_size()
542 ctf_dtdef_t *dtd = ctf_dtd_lookup(fp, type); in ctf_type_size()
548 return (ctf_get_ctt_size(fp, tp, NULL, NULL)); in ctf_type_size()
557 ctf_type_align(ctf_file_t *fp, ctf_id_t type) in ctf_type_align() argument
562 if ((type = ctf_type_resolve(fp, type)) == CTF_ERR) in ctf_type_align()
565 if ((tp = ctf_lookup_by_id(&fp, type)) == NULL) in ctf_type_align()
568 switch (LCTF_INFO_KIND(fp, tp->ctt_info)) { in ctf_type_align()
571 return (fp->ctf_dmodel->ctd_pointer); in ctf_type_align()
574 if (ctf_array_info(fp, type, &r) == CTF_ERR) in ctf_type_align()
576 return (ctf_type_align(fp, r.ctr_contents)); in ctf_type_align()
580 uint_t n = LCTF_INFO_VLEN(fp, tp->ctt_info); in ctf_type_align()
585 (void) ctf_get_ctt_size(fp, tp, &size, &increment); in ctf_type_align()
588 if (LCTF_INFO_KIND(fp, tp->ctt_info) == CTF_K_STRUCT) in ctf_type_align()
591 if (fp->ctf_version == CTF_VERSION_1 || in ctf_type_align()
595 ssize_t am = ctf_type_align(fp, mp->ctm_type); in ctf_type_align()
601 ssize_t am = ctf_type_align(fp, lmp->ctlm_type); in ctf_type_align()
611 return (ctf_get_ctt_size(fp, tp, NULL, NULL)); in ctf_type_align()
619 ctf_type_kind(ctf_file_t *fp, ctf_id_t type) in ctf_type_kind() argument
623 if ((tp = ctf_lookup_by_id(&fp, type)) == NULL) in ctf_type_kind()
626 return (LCTF_INFO_KIND(fp, tp->ctt_info)); in ctf_type_kind()
634 ctf_type_reference(ctf_file_t *fp, ctf_id_t type) in ctf_type_reference() argument
636 ctf_file_t *ofp = fp; in ctf_type_reference()
639 if ((tp = ctf_lookup_by_id(&fp, type)) == NULL) in ctf_type_reference()
642 switch (LCTF_INFO_KIND(fp, tp->ctt_info)) { in ctf_type_reference()
662 ctf_type_pointer(ctf_file_t *fp, ctf_id_t type) in ctf_type_pointer() argument
664 ctf_file_t *ofp = fp; in ctf_type_pointer()
667 if (ctf_lookup_by_id(&fp, type) == NULL) in ctf_type_pointer()
670 if ((ntype = fp->ctf_ptrtab[CTF_TYPE_TO_INDEX(type)]) != 0) in ctf_type_pointer()
671 return (CTF_INDEX_TO_TYPE(ntype, (fp->ctf_flags & LCTF_CHILD))); in ctf_type_pointer()
673 if ((type = ctf_type_resolve(fp, type)) == CTF_ERR) in ctf_type_pointer()
676 if (ctf_lookup_by_id(&fp, type) == NULL) in ctf_type_pointer()
679 if ((ntype = fp->ctf_ptrtab[CTF_TYPE_TO_INDEX(type)]) != 0) in ctf_type_pointer()
680 return (CTF_INDEX_TO_TYPE(ntype, (fp->ctf_flags & LCTF_CHILD))); in ctf_type_pointer()
689 ctf_type_encoding(ctf_file_t *fp, ctf_id_t type, ctf_encoding_t *ep) in ctf_type_encoding() argument
691 ctf_file_t *ofp = fp; in ctf_type_encoding()
696 if ((tp = ctf_lookup_by_id(&fp, type)) == NULL) in ctf_type_encoding()
699 (void) ctf_get_ctt_size(fp, tp, NULL, &increment); in ctf_type_encoding()
701 switch (LCTF_INFO_KIND(fp, tp->ctt_info)) { in ctf_type_encoding()
812 ctf_member_info(ctf_file_t *fp, ctf_id_t type, const char *name, in ctf_member_info() argument
815 ctf_file_t *ofp = fp; in ctf_member_info()
820 if ((type = ctf_type_resolve(fp, type)) == CTF_ERR) in ctf_member_info()
823 if ((tp = ctf_lookup_by_id(&fp, type)) == NULL) in ctf_member_info()
826 (void) ctf_get_ctt_size(fp, tp, &size, &increment); in ctf_member_info()
827 kind = LCTF_INFO_KIND(fp, tp->ctt_info); in ctf_member_info()
832 if (fp->ctf_version == CTF_VERSION_1 || size < CTF_LSTRUCT_THRESH) { in ctf_member_info()
836 for (n = LCTF_INFO_VLEN(fp, tp->ctt_info); n != 0; n--, mp++) { in ctf_member_info()
837 if (strcmp(ctf_strptr(fp, mp->ctm_name), name) == 0) { in ctf_member_info()
847 for (n = LCTF_INFO_VLEN(fp, tp->ctt_info); n != 0; n--, lmp++) { in ctf_member_info()
848 if (strcmp(ctf_strptr(fp, lmp->ctlm_name), name) == 0) { in ctf_member_info()
863 ctf_array_info(ctf_file_t *fp, ctf_id_t type, ctf_arinfo_t *arp) in ctf_array_info() argument
865 ctf_file_t *ofp = fp; in ctf_array_info()
870 if ((tp = ctf_lookup_by_id(&fp, type)) == NULL) in ctf_array_info()
873 if (LCTF_INFO_KIND(fp, tp->ctt_info) != CTF_K_ARRAY) in ctf_array_info()
876 (void) ctf_get_ctt_size(fp, tp, NULL, &increment); in ctf_array_info()
891 ctf_enum_name(ctf_file_t *fp, ctf_id_t type, int value) in ctf_enum_name() argument
893 ctf_file_t *ofp = fp; in ctf_enum_name()
899 if ((type = ctf_type_resolve(fp, type)) == CTF_ERR) in ctf_enum_name()
902 if ((tp = ctf_lookup_by_id(&fp, type)) == NULL) in ctf_enum_name()
905 if (LCTF_INFO_KIND(fp, tp->ctt_info) != CTF_K_ENUM) { in ctf_enum_name()
910 (void) ctf_get_ctt_size(fp, tp, NULL, &increment); in ctf_enum_name()
914 for (n = LCTF_INFO_VLEN(fp, tp->ctt_info); n != 0; n--, ep++) { in ctf_enum_name()
916 return (ctf_strptr(fp, ep->cte_name)); in ctf_enum_name()
928 ctf_enum_value(ctf_file_t *fp, ctf_id_t type, const char *name, int *valp) in ctf_enum_value() argument
930 ctf_file_t *ofp = fp; in ctf_enum_value()
936 if ((type = ctf_type_resolve(fp, type)) == CTF_ERR) in ctf_enum_value()
939 if ((tp = ctf_lookup_by_id(&fp, type)) == NULL) in ctf_enum_value()
942 if (LCTF_INFO_KIND(fp, tp->ctt_info) != CTF_K_ENUM) { in ctf_enum_value()
947 (void) ctf_get_ctt_size(fp, tp, &size, &increment); in ctf_enum_value()
951 for (n = LCTF_INFO_VLEN(fp, tp->ctt_info); n != 0; n--, ep++) { in ctf_enum_value()
952 if (strcmp(ctf_strptr(fp, ep->cte_name), name) == 0) { in ctf_enum_value()
971 ctf_type_rvisit(ctf_file_t *fp, ctf_id_t type, ctf_visit_f *func, void *arg, in ctf_type_rvisit() argument
980 if ((type = ctf_type_resolve(fp, type)) == CTF_ERR) in ctf_type_rvisit()
983 if ((tp = ctf_lookup_by_id(&fp, type)) == NULL) in ctf_type_rvisit()
989 kind = LCTF_INFO_KIND(fp, tp->ctt_info); in ctf_type_rvisit()
994 (void) ctf_get_ctt_size(fp, tp, &size, &increment); in ctf_type_rvisit()
996 if (fp->ctf_version == CTF_VERSION_1 || size < CTF_LSTRUCT_THRESH) { in ctf_type_rvisit()
1000 for (n = LCTF_INFO_VLEN(fp, tp->ctt_info); n != 0; n--, mp++) { in ctf_type_rvisit()
1001 if ((rc = ctf_type_rvisit(fp, mp->ctm_type, in ctf_type_rvisit()
1002 func, arg, ctf_strptr(fp, mp->ctm_name), in ctf_type_rvisit()
1011 for (n = LCTF_INFO_VLEN(fp, tp->ctt_info); n != 0; n--, lmp++) { in ctf_type_rvisit()
1012 if ((rc = ctf_type_rvisit(fp, lmp->ctlm_type, in ctf_type_rvisit()
1013 func, arg, ctf_strptr(fp, lmp->ctlm_name), in ctf_type_rvisit()
1028 ctf_type_visit(ctf_file_t *fp, ctf_id_t type, ctf_visit_f *func, void *arg) in ctf_type_visit() argument
1030 return (ctf_type_rvisit(fp, type, func, arg, "", 0, 0)); in ctf_type_visit()
1034 ctf_func_info_by_id(ctf_file_t *fp, ctf_id_t type, ctf_funcinfo_t *fip) in ctf_func_info_by_id() argument
1036 ctf_file_t *ofp = fp; in ctf_func_info_by_id()
1042 if ((tp = ctf_lookup_by_id(&fp, type)) == NULL) in ctf_func_info_by_id()
1045 if (LCTF_INFO_KIND(fp, tp->ctt_info) != CTF_K_FUNCTION) in ctf_func_info_by_id()
1049 nargs = LCTF_INFO_VLEN(fp, tp->ctt_info); in ctf_func_info_by_id()
1055 (void) ctf_get_ctt_size(fp, tp, NULL, &increment); in ctf_func_info_by_id()
1056 dp = (ushort_t *)((uintptr_t)fp->ctf_buf + in ctf_func_info_by_id()
1057 fp->ctf_txlate[CTF_TYPE_TO_INDEX(type)] + increment); in ctf_func_info_by_id()
1068 ctf_func_args_by_id(ctf_file_t *fp, ctf_id_t type, uint_t argc, ctf_id_t *argv) in ctf_func_args_by_id() argument
1070 ctf_file_t *ofp = fp; in ctf_func_args_by_id()
1076 if ((tp = ctf_lookup_by_id(&fp, type)) == NULL) in ctf_func_args_by_id()
1079 if (LCTF_INFO_KIND(fp, tp->ctt_info) != CTF_K_FUNCTION) in ctf_func_args_by_id()
1082 nargs = LCTF_INFO_VLEN(fp, tp->ctt_info); in ctf_func_args_by_id()
1083 (void) ctf_get_ctt_size(fp, tp, NULL, &increment); in ctf_func_args_by_id()
1084 dp = (ushort_t *)((uintptr_t)fp->ctf_buf + in ctf_func_args_by_id()
1085 fp->ctf_txlate[CTF_TYPE_TO_INDEX(type)] + in ctf_func_args_by_id()
1097 ctf_object_iter(ctf_file_t *fp, ctf_object_f *func, void *arg) in ctf_object_iter() argument
1101 uintptr_t symbase = (uintptr_t)fp->ctf_symtab.cts_data; in ctf_object_iter()
1102 uintptr_t strbase = (uintptr_t)fp->ctf_strtab.cts_data; in ctf_object_iter()
1104 if (fp->ctf_symtab.cts_data == NULL) in ctf_object_iter()
1105 return (ctf_set_errno(fp, ECTF_NOSYMTAB)); in ctf_object_iter()
1107 for (i = 0; i < fp->ctf_nsyms; i++) { in ctf_object_iter()
1109 if (fp->ctf_sxlate[i] == -1u) in ctf_object_iter()
1111 id = *(ushort_t *)((uintptr_t)fp->ctf_buf + in ctf_object_iter()
1112 fp->ctf_sxlate[i]); in ctf_object_iter()
1118 if (fp->ctf_symtab.cts_entsize == sizeof (Elf32_Sym)) { in ctf_object_iter()
1122 if (fp->ctf_strtab.cts_data != NULL && in ctf_object_iter()
1131 if (fp->ctf_strtab.cts_data != NULL && in ctf_object_iter()
1146 ctf_function_iter(ctf_file_t *fp, ctf_function_f *func, void *arg) in ctf_function_iter() argument
1149 uintptr_t symbase = (uintptr_t)fp->ctf_symtab.cts_data; in ctf_function_iter()
1150 uintptr_t strbase = (uintptr_t)fp->ctf_strtab.cts_data; in ctf_function_iter()
1152 if (fp->ctf_symtab.cts_data == NULL) in ctf_function_iter()
1153 return (ctf_set_errno(fp, ECTF_NOSYMTAB)); in ctf_function_iter()
1155 for (i = 0; i < fp->ctf_nsyms; i++) { in ctf_function_iter()
1159 if (fp->ctf_sxlate[i] == -1u) in ctf_function_iter()
1162 dp = (ushort_t *)((uintptr_t)fp->ctf_buf + in ctf_function_iter()
1163 fp->ctf_sxlate[i]); in ctf_function_iter()
1173 if (fp->ctf_symtab.cts_entsize == sizeof (Elf32_Sym)) { in ctf_function_iter()
1177 if (fp->ctf_strtab.cts_data != NULL) in ctf_function_iter()
1185 if (fp->ctf_strtab.cts_data != NULL) in ctf_function_iter()
1191 if (LCTF_INFO_KIND(fp, info) != CTF_K_FUNCTION) in ctf_function_iter()
1196 fi.ctc_argc = LCTF_INFO_VLEN(fp, info); in ctf_function_iter()
1213 ctf_symbol_name(ctf_file_t *fp, ulong_t idx, char *buf, size_t len) in ctf_symbol_name() argument
1216 uintptr_t symbase = (uintptr_t)fp->ctf_symtab.cts_data; in ctf_symbol_name()
1217 uintptr_t strbase = (uintptr_t)fp->ctf_strtab.cts_data; in ctf_symbol_name()
1219 if (fp->ctf_symtab.cts_data == NULL) { in ctf_symbol_name()
1220 (void) ctf_set_errno(fp, ECTF_NOSYMTAB); in ctf_symbol_name()
1224 if (fp->ctf_strtab.cts_data == NULL) { in ctf_symbol_name()
1225 (void) ctf_set_errno(fp, ECTF_STRTAB); in ctf_symbol_name()
1229 if (idx > fp->ctf_nsyms) { in ctf_symbol_name()
1230 (void) ctf_set_errno(fp, ECTF_NOTDATA); in ctf_symbol_name()
1234 if (fp->ctf_symtab.cts_entsize == sizeof (Elf32_Sym)) { in ctf_symbol_name()
1238 (void) ctf_set_errno(fp, ECTF_NOTDATA); in ctf_symbol_name()
1242 (void) ctf_set_errno(fp, ENOENT); in ctf_symbol_name()
1250 (void) ctf_set_errno(fp, ECTF_NOTDATA); in ctf_symbol_name()
1254 (void) ctf_set_errno(fp, ENOENT); in ctf_symbol_name()
1266 ctf_string_iter(ctf_file_t *fp, ctf_string_f *func, void *arg) in ctf_string_iter() argument
1269 const char *strp = fp->ctf_str[CTF_STRTAB_0].cts_strs; in ctf_string_iter()
1270 size_t strl = fp->ctf_str[CTF_STRTAB_0].cts_len; in ctf_string_iter()
1291 ctf_kind_name(ctf_file_t *fp, int kind) in ctf_kind_name() argument
1327 ctf_max_id(ctf_file_t *fp) in ctf_max_id() argument
1329 int child = (fp->ctf_flags & LCTF_CHILD); in ctf_max_id()
1330 return (fp->ctf_typemax + (child ? CTF_CHILD_START : 0)); in ctf_max_id()
1334 ctf_nr_syms(ctf_file_t *fp) in ctf_nr_syms() argument
1336 return (fp->ctf_nsyms); in ctf_nr_syms()