Lines Matching refs:cd
112 ref_to_str(uint_t name, const ctf_header_t *hp, const ctf_data_t *cd) in ref_to_str() argument
115 const char *s = cd->cd_ctfdata + hp->cth_stroff + offset; in ref_to_str()
123 if (hp->cth_stroff + offset >= cd->cd_ctflen) in ref_to_str()
183 print_header(const ctf_header_t *hp, const ctf_data_t *cd) in print_header() argument
191 ref_to_str(hp->cth_parlabel, hp, cd)); in print_header()
193 ref_to_str(hp->cth_parname, hp, cd)); in print_header()
205 print_labeltable(const ctf_header_t *hp, const ctf_data_t *cd) in print_labeltable() argument
207 void *v = (void *) (cd->cd_ctfdata + hp->cth_lbloff); in print_labeltable()
215 if (hp->cth_lbloff >= cd->cd_ctflen) in print_labeltable()
217 if (hp->cth_objtoff >= cd->cd_ctflen) in print_labeltable()
224 ref_to_str(ctl->ctl_label, hp, cd)); in print_labeltable()
237 next_sym(const ctf_data_t *cd, const int symidx, const uchar_t matchtype, in next_sym() argument
242 for (i = symidx + 1; i < cd->cd_nsyms; i++) { in next_sym()
247 if (gelf_getsym(cd->cd_symdata, i, &sym) == 0) in next_sym()
250 name = (char *)cd->cd_strdata->d_buf + sym.st_name; in next_sym()
268 read_data(const ctf_header_t *hp, const ctf_data_t *cd) in read_data() argument
270 const char *v = (void *) (cd->cd_ctfdata + hp->cth_objtoff); in read_data()
271 ulong_t n = (hp->cth_funcoff - hp->cth_objtoff) / cd->cd_idwidth; in read_data()
278 if (hp->cth_objtoff >= cd->cd_ctflen) in read_data()
280 if (hp->cth_funcoff >= cd->cd_ctflen) in read_data()
293 if (cd->cd_symdata == NULL || (nextsym = next_sym(cd, in read_data()
299 memcpy(&id, v, cd->cd_idwidth); in read_data()
300 v += cd->cd_idwidth; in read_data()
314 read_funcs(const ctf_header_t *hp, const ctf_data_t *cd) in read_funcs() argument
316 const char *v = (void *) (cd->cd_ctfdata + hp->cth_funcoff); in read_funcs()
319 const char *end = (void *) (cd->cd_ctfdata + hp->cth_typeoff); in read_funcs()
329 if (hp->cth_funcoff >= cd->cd_ctflen) in read_funcs()
331 if (hp->cth_typeoff >= cd->cd_ctflen) in read_funcs()
338 memcpy(&info, v, cd->cd_idwidth); in read_funcs()
339 v += cd->cd_idwidth; in read_funcs()
348 if (cd->cd_symdata == NULL || (nextsym = next_sym(cd, symidx, in read_funcs()
363 if (v + n * cd->cd_idwidth > end) { in read_funcs()
373 memcpy(&f, v, cd->cd_idwidth); in read_funcs()
374 v += cd->cd_idwidth; in read_funcs()
378 memcpy(&f, v, cd->cd_idwidth); in read_funcs()
379 v += cd->cd_idwidth; in read_funcs()
382 memcpy(&f, v, cd->cd_idwidth); in read_funcs()
383 v += cd->cd_idwidth; in read_funcs()
390 v += n * cd->cd_idwidth + 1; /* skip to next function definition */ in read_funcs()
401 read_types(const ctf_header_t *hp, const ctf_data_t *cd) in read_types() argument
403 const char *v = (void *) (cd->cd_ctfdata + hp->cth_typeoff); in read_types()
404 const char *end = (void *) (cd->cd_ctfdata + hp->cth_stroff); in read_types()
413 if (hp->cth_typeoff >= cd->cd_ctflen) in read_types()
415 if (hp->cth_stroff >= cd->cd_ctflen) in read_types()
492 " bits=%u", ref_to_str(name, hp, cd), in read_types()
507 "bits=%u", ref_to_str(name, hp, cd), in read_types()
519 ref_to_str(name, hp, cd), type); in read_types()
537 "nelems: %u\n", ref_to_str(name, hp, cd), in read_types()
552 ref_to_str(name, hp, cd), type); in read_types()
555 memcpy(&arg, u.ptr, cd->cd_idwidth); in read_types()
556 u.ptr += cd->cd_idwidth; in read_types()
559 i++, u.ptr += cd->cd_idwidth) { in read_types()
561 cd->cd_idwidth); in read_types()
569 vlen = roundup2(cd->cd_idwidth * n, 4); in read_types()
595 ref_to_str(name, hp, cd), size); in read_types()
603 hp, cd), u.lmp2->ctlm_type, in read_types()
612 hp, cd), u.mp2->ctm_type, in read_types()
622 hp, cd), u.lmp3->ctlm_type, in read_types()
631 hp, cd), u.mp3->ctm_type, in read_types()
652 ref_to_str(name, hp, cd)); in read_types()
656 ref_to_str(u.ep->cte_name, hp, cd), in read_types()
670 ref_to_str(name, hp, cd)); in read_types()
677 ref_to_str(name, hp, cd), type); in read_types()
684 ref_to_str(name, hp, cd), type); in read_types()
691 ref_to_str(name, hp, cd), type); in read_types()
698 ref_to_str(name, hp, cd), type); in read_types()
723 read_strtab(const ctf_header_t *hp, const ctf_data_t *cd) in read_strtab() argument
726 const char *s = cd->cd_ctfdata + hp->cth_stroff; in read_strtab()
731 if (hp->cth_stroff >= cd->cd_ctflen) in read_strtab()
733 if (hp->cth_stroff + hp->cth_strlen > cd->cd_ctflen) in read_strtab()
901 ctf_data_t cd; in main() local
971 cd.cd_ctfdata = dp->d_buf; in main()
972 cd.cd_ctflen = dp->d_size; in main()
995 cd.cd_nsyms = shdr.sh_size / shdr.sh_entsize; in main()
996 cd.cd_symdata = elf_getdata(symscn, NULL); in main()
997 cd.cd_strdata = elf_getdata(symstrscn, NULL); in main()
1006 cd.cd_ctflen = st.st_size; in main()
1007 cd.cd_ctfdata = mmap(NULL, cd.cd_ctflen, PROT_READ, in main()
1009 if (cd.cd_ctfdata == MAP_FAILED) in main()
1018 if (cd.cd_ctflen < sizeof (ctf_preamble_t)) in main()
1021 void *v = (void *) cd.cd_ctfdata; in main()
1028 v = (void *) cd.cd_ctfdata; in main()
1030 cd.cd_ctfdata = (caddr_t)cd.cd_ctfdata + sizeof (ctf_header_t); in main()
1032 cd.cd_idwidth = pp->ctp_version == CTF_VERSION_2 ? 2 : 4; in main()
1034 if (cd.cd_ctflen < sizeof (ctf_header_t)) { in main()
1057 zstr.next_in = (void *)cd.cd_ctfdata; in main()
1058 zstr.avail_in = cd.cd_ctflen; in main()
1074 cd.cd_ctfdata = buf; in main()
1075 cd.cd_ctflen = hp->cth_stroff + hp->cth_strlen; in main()
1079 error |= print_header(hp, &cd); in main()
1081 error |= print_labeltable(hp, &cd); in main()
1083 error |= read_data(hp, &cd); in main()
1085 error |= read_funcs(hp, &cd); in main()
1087 error |= read_types(hp, &cd); in main()
1089 error |= read_strtab(hp, &cd); in main()
1106 write(ufd, cd.cd_ctfdata, cd.cd_ctflen) != (int) cd.cd_ctflen) { in main()