Lines Matching refs:cup
297 #define DWARF_LOCK(cup) \ argument
298 if ((cup)->cu_dwlock != NULL) \
299 mutex_enter((cup)->cu_dwlock)
300 #define DWARF_UNLOCK(cup) \ argument
301 if ((cup)->cu_dwlock != NULL) \
302 mutex_exit((cup)->cu_dwlock)
311 ctf_dwarf_error(ctf_cu_t *cup, ctf_file_t *cfp, int err, const char *fmt, ...) in ctf_dwarf_error() argument
316 ssize_t rem = cup->cu_errlen; in ctf_dwarf_error()
323 ret = snprintf(cup->cu_errbuf, rem, "die %s: ", in ctf_dwarf_error()
324 cup->cu_name != NULL ? cup->cu_name : "NULL"); in ctf_dwarf_error()
331 ret = vsnprintf(cup->cu_errbuf + off, rem, fmt, ap); in ctf_dwarf_error()
339 (void) snprintf(cup->cu_errbuf + off, rem, in ctf_dwarf_error()
346 cup->cu_errbuf[0] = '\0'; in ctf_dwarf_error()
357 ctf_dwarf_void(ctf_cu_t *cup) in ctf_dwarf_void() argument
359 if (cup->cu_voidtid == CTF_ERR) { in ctf_dwarf_void()
361 cup->cu_voidtid = ctf_add_integer(cup->cu_ctfp, CTF_ADD_ROOT, in ctf_dwarf_void()
363 if (cup->cu_voidtid == CTF_ERR) { in ctf_dwarf_void()
364 (void) snprintf(cup->cu_errbuf, cup->cu_errlen, in ctf_dwarf_void()
366 ctf_errmsg(ctf_errno(cup->cu_ctfp))); in ctf_dwarf_void()
370 return (cup->cu_voidtid); in ctf_dwarf_void()
379 ctf_dwarf_long(ctf_cu_t *cup) in ctf_dwarf_long() argument
381 if (cup->cu_longtid == CTF_ERR) { in ctf_dwarf_long()
387 enc.cte_bits = cup->cu_ptrsz * 8; in ctf_dwarf_long()
388 cup->cu_longtid = ctf_add_integer(cup->cu_ctfp, CTF_ADD_NONROOT, in ctf_dwarf_long()
390 if (cup->cu_longtid == CTF_ERR) { in ctf_dwarf_long()
391 (void) snprintf(cup->cu_errbuf, cup->cu_errlen, in ctf_dwarf_long()
393 ctf_errmsg(ctf_errno(cup->cu_ctfp))); in ctf_dwarf_long()
398 return (cup->cu_longtid); in ctf_dwarf_long()
415 ctf_dwmap_add(ctf_cu_t *cup, ctf_id_t id, Dwarf_Die die, boolean_t fix) in ctf_dwmap_add() argument
424 if ((ret = ctf_dwarf_offset(cup, die, &off)) != 0) in ctf_dwmap_add()
436 VERIFY(avl_find(&cup->cu_map, dwmap, &index) == NULL); in ctf_dwmap_add()
437 avl_insert(&cup->cu_map, dwmap, index); in ctf_dwmap_add()
442 ctf_dwarf_attribute(ctf_cu_t *cup, Dwarf_Die die, Dwarf_Half name, in ctf_dwarf_attribute() argument
448 DWARF_LOCK(cup); in ctf_dwarf_attribute()
450 DWARF_UNLOCK(cup); in ctf_dwarf_attribute()
457 (void) snprintf(cup->cu_errbuf, cup->cu_errlen, in ctf_dwarf_attribute()
464 ctf_dwarf_dealloc(ctf_cu_t *cup, Dwarf_Ptr ptr, Dwarf_Unsigned type) in ctf_dwarf_dealloc() argument
466 DWARF_LOCK(cup); in ctf_dwarf_dealloc()
467 dwarf_dealloc(cup->cu_dwarf, ptr, type); in ctf_dwarf_dealloc()
468 DWARF_UNLOCK(cup); in ctf_dwarf_dealloc()
472 ctf_dwarf_ref(ctf_cu_t *cup, Dwarf_Die die, Dwarf_Half name, Dwarf_Off *refp) in ctf_dwarf_ref() argument
478 if ((ret = ctf_dwarf_attribute(cup, die, name, &attr)) != 0) in ctf_dwarf_ref()
481 DWARF_LOCK(cup); in ctf_dwarf_ref()
483 DWARF_UNLOCK(cup); in ctf_dwarf_ref()
485 ctf_dwarf_dealloc(cup, attr, DW_DLA_ATTR); in ctf_dwarf_ref()
489 (void) snprintf(cup->cu_errbuf, cup->cu_errlen, in ctf_dwarf_ref()
496 ctf_dwarf_refdie(ctf_cu_t *cup, Dwarf_Die die, Dwarf_Half name, in ctf_dwarf_refdie() argument
503 if ((ret = ctf_dwarf_ref(cup, die, name, &off)) != 0) in ctf_dwarf_refdie()
506 off += cup->cu_cuoff; in ctf_dwarf_refdie()
507 DWARF_LOCK(cup); in ctf_dwarf_refdie()
508 ret = dwarf_offdie(cup->cu_dwarf, off, diep, &derr); in ctf_dwarf_refdie()
509 DWARF_UNLOCK(cup); in ctf_dwarf_refdie()
511 (void) snprintf(cup->cu_errbuf, cup->cu_errlen, in ctf_dwarf_refdie()
521 ctf_dwarf_signed(ctf_cu_t *cup, Dwarf_Die die, Dwarf_Half name, in ctf_dwarf_signed() argument
528 if ((ret = ctf_dwarf_attribute(cup, die, name, &attr)) != 0) in ctf_dwarf_signed()
531 DWARF_LOCK(cup); in ctf_dwarf_signed()
533 DWARF_UNLOCK(cup); in ctf_dwarf_signed()
535 ctf_dwarf_dealloc(cup, attr, DW_DLA_ATTR); in ctf_dwarf_signed()
539 (void) snprintf(cup->cu_errbuf, cup->cu_errlen, in ctf_dwarf_signed()
546 ctf_dwarf_unsigned(ctf_cu_t *cup, Dwarf_Die die, Dwarf_Half name, in ctf_dwarf_unsigned() argument
553 if ((ret = ctf_dwarf_attribute(cup, die, name, &attr)) != 0) in ctf_dwarf_unsigned()
556 DWARF_LOCK(cup); in ctf_dwarf_unsigned()
558 DWARF_UNLOCK(cup); in ctf_dwarf_unsigned()
560 ctf_dwarf_dealloc(cup, attr, DW_DLA_ATTR); in ctf_dwarf_unsigned()
564 (void) snprintf(cup->cu_errbuf, cup->cu_errlen, in ctf_dwarf_unsigned()
571 ctf_dwarf_boolean(ctf_cu_t *cup, Dwarf_Die die, Dwarf_Half name, in ctf_dwarf_boolean() argument
578 if ((ret = ctf_dwarf_attribute(cup, die, name, &attr)) != 0) in ctf_dwarf_boolean()
581 DWARF_LOCK(cup); in ctf_dwarf_boolean()
583 DWARF_UNLOCK(cup); in ctf_dwarf_boolean()
585 ctf_dwarf_dealloc(cup, attr, DW_DLA_ATTR); in ctf_dwarf_boolean()
589 (void) snprintf(cup->cu_errbuf, cup->cu_errlen, in ctf_dwarf_boolean()
597 ctf_dwarf_string(ctf_cu_t *cup, Dwarf_Die die, Dwarf_Half name, char **strp) in ctf_dwarf_string() argument
605 if ((ret = ctf_dwarf_attribute(cup, die, name, &attr)) != 0) in ctf_dwarf_string()
608 DWARF_LOCK(cup); in ctf_dwarf_string()
610 DWARF_UNLOCK(cup); in ctf_dwarf_string()
616 ctf_dwarf_dealloc(cup, attr, DW_DLA_ATTR); in ctf_dwarf_string()
620 (void) snprintf(cup->cu_errbuf, cup->cu_errlen, in ctf_dwarf_string()
634 ctf_dwarf_member_location(ctf_cu_t *cup, Dwarf_Die die, Dwarf_Unsigned *valp) in ctf_dwarf_member_location() argument
644 if ((ret = ctf_dwarf_attribute(cup, die, DW_AT_data_member_location, in ctf_dwarf_member_location()
649 DWARF_LOCK(cup); in ctf_dwarf_member_location()
651 DWARF_UNLOCK(cup); in ctf_dwarf_member_location()
653 (void) snprintf(cup->cu_errbuf, cup->cu_errlen, in ctf_dwarf_member_location()
657 ctf_dwarf_dealloc(cup, attr, DW_DLA_ATTR); in ctf_dwarf_member_location()
661 DWARF_LOCK(cup); in ctf_dwarf_member_location()
662 class = dwarf_get_form_class(cup->cu_vers, DW_AT_data_member_location, in ctf_dwarf_member_location()
663 cup->cu_addrsz, form); in ctf_dwarf_member_location()
674 DWARF_UNLOCK(cup); in ctf_dwarf_member_location()
675 ctf_dwarf_dealloc(cup, attr, DW_DLA_ATTR); in ctf_dwarf_member_location()
680 DWARF_UNLOCK(cup); in ctf_dwarf_member_location()
681 ctf_dwarf_dealloc(cup, attr, DW_DLA_ATTR); in ctf_dwarf_member_location()
683 (void) snprintf(cup->cu_errbuf, cup->cu_errlen, in ctf_dwarf_member_location()
693 DWARF_UNLOCK(cup); in ctf_dwarf_member_location()
694 (void) snprintf(cup->cu_errbuf, cup->cu_errlen, in ctf_dwarf_member_location()
697 ctf_dwarf_dealloc(cup, attr, DW_DLA_ATTR); in ctf_dwarf_member_location()
700 DWARF_UNLOCK(cup); in ctf_dwarf_member_location()
701 ctf_dwarf_dealloc(cup, attr, DW_DLA_ATTR); in ctf_dwarf_member_location()
704 (void) snprintf(cup->cu_errbuf, cup->cu_errlen, in ctf_dwarf_member_location()
706 ctf_dwarf_dealloc(cup, loc->ld_s, DW_DLA_LOC_BLOCK); in ctf_dwarf_member_location()
707 ctf_dwarf_dealloc(cup, loc, DW_DLA_LOCDESC); in ctf_dwarf_member_location()
713 ctf_dwarf_dealloc(cup, loc->ld_s, DW_DLA_LOC_BLOCK); in ctf_dwarf_member_location()
714 ctf_dwarf_dealloc(cup, loc, DW_DLA_LOCDESC); in ctf_dwarf_member_location()
720 ctf_dwarf_offset(ctf_cu_t *cup, Dwarf_Die die, Dwarf_Off *offsetp) in ctf_dwarf_offset() argument
725 DWARF_LOCK(cup); in ctf_dwarf_offset()
727 DWARF_UNLOCK(cup); in ctf_dwarf_offset()
731 (void) snprintf(cup->cu_errbuf, cup->cu_errlen, in ctf_dwarf_offset()
739 ctf_die_offset(ctf_cu_t *cup, Dwarf_Die die) in ctf_die_offset() argument
744 DWARF_LOCK(cup); in ctf_die_offset()
746 DWARF_UNLOCK(cup); in ctf_die_offset()
751 ctf_dwarf_tag(ctf_cu_t *cup, Dwarf_Die die, Dwarf_Half *tagp) in ctf_dwarf_tag() argument
756 DWARF_LOCK(cup); in ctf_dwarf_tag()
758 DWARF_UNLOCK(cup); in ctf_dwarf_tag()
762 (void) snprintf(cup->cu_errbuf, cup->cu_errlen, in ctf_dwarf_tag()
769 ctf_dwarf_sib(ctf_cu_t *cup, Dwarf_Die base, Dwarf_Die *sibp) in ctf_dwarf_sib() argument
775 DWARF_LOCK(cup); in ctf_dwarf_sib()
776 ret = dwarf_siblingof(cup->cu_dwarf, base, sibp, &derr); in ctf_dwarf_sib()
777 DWARF_UNLOCK(cup); in ctf_dwarf_sib()
781 (void) snprintf(cup->cu_errbuf, cup->cu_errlen, in ctf_dwarf_sib()
788 ctf_dwarf_child(ctf_cu_t *cup, Dwarf_Die base, Dwarf_Die *childp) in ctf_dwarf_child() argument
794 DWARF_LOCK(cup); in ctf_dwarf_child()
796 DWARF_UNLOCK(cup); in ctf_dwarf_child()
800 (void) snprintf(cup->cu_errbuf, cup->cu_errlen, in ctf_dwarf_child()
813 ctf_dwarf_isglobal(ctf_cu_t *cup, Dwarf_Die die, boolean_t *igp) in ctf_dwarf_isglobal() argument
819 if ((ret = ctf_dwarf_signed(cup, die, DW_AT_visibility, &vis)) == 0) { in ctf_dwarf_isglobal()
826 if ((ret = ctf_dwarf_boolean(cup, die, DW_AT_external, &ext)) != 0) { in ctf_dwarf_isglobal()
838 ctf_dwarf_die_elfenc(Elf *elf, ctf_cu_t *cup, char *errbuf, size_t errlen) in ctf_dwarf_die_elfenc() argument
849 cup->cu_mach = ehdr.e_machine; in ctf_dwarf_die_elfenc()
852 cup->cu_ptrsz = 4; in ctf_dwarf_die_elfenc()
853 VERIFY(ctf_setmodel(cup->cu_ctfp, CTF_MODEL_ILP32) == 0); in ctf_dwarf_die_elfenc()
855 cup->cu_ptrsz = 8; in ctf_dwarf_die_elfenc()
856 VERIFY(ctf_setmodel(cup->cu_ctfp, CTF_MODEL_LP64) == 0); in ctf_dwarf_die_elfenc()
864 cup->cu_bigend = B_FALSE; in ctf_dwarf_die_elfenc()
866 cup->cu_bigend = B_TRUE; in ctf_dwarf_die_elfenc()
938 ctf_dwarf_fixup_complex(ctf_cu_t *cup, ctf_encoding_t *enc, char **namep) in ctf_dwarf_fixup_complex() argument
966 ctf_dwarf_float_base(ctf_cu_t *cup, Dwarf_Signed type, ctf_encoding_t *enc) in ctf_dwarf_float_base() argument
973 if (map->cdf_mach == cup->cu_mach) in ctf_dwarf_float_base()
978 (void) snprintf(cup->cu_errbuf, cup->cu_errlen, in ctf_dwarf_float_base()
979 "Unsupported machine type: %d\n", cup->cu_mach); in ctf_dwarf_float_base()
999 (void) snprintf(cup->cu_errbuf, cup->cu_errlen, in ctf_dwarf_float_base()
1006 ctf_dwarf_dwarf_base(ctf_cu_t *cup, Dwarf_Die die, int *kindp, in ctf_dwarf_dwarf_base() argument
1012 if ((ret = ctf_dwarf_signed(cup, die, DW_AT_encoding, &type)) != 0) in ctf_dwarf_dwarf_base()
1043 if ((ret = ctf_dwarf_float_base(cup, type, enc)) != 0) in ctf_dwarf_dwarf_base()
1047 (void) snprintf(cup->cu_errbuf, cup->cu_errlen, in ctf_dwarf_dwarf_base()
1135 ctf_dwarf_create_base(ctf_cu_t *cup, Dwarf_Die die, ctf_id_t *idp, int isroot, in ctf_dwarf_create_base() argument
1145 if ((ret = ctf_dwarf_string(cup, die, DW_AT_name, &name)) != 0) in ctf_dwarf_create_base()
1147 if ((ret = ctf_dwarf_unsigned(cup, die, DW_AT_byte_size, &sz)) != 0) { in ctf_dwarf_create_base()
1163 if ((ret = ctf_dwarf_dwarf_base(cup, die, &kind, &enc)) != 0) { in ctf_dwarf_create_base()
1167 if (kind == CTF_K_FLOAT && (ret = ctf_dwarf_fixup_complex(cup, in ctf_dwarf_create_base()
1176 id = ctf_add_encoded(cup->cu_ctfp, isroot, name, &enc, kind); in ctf_dwarf_create_base()
1178 ret = ctf_errno(cup->cu_ctfp); in ctf_dwarf_create_base()
1181 ret = ctf_dwmap_add(cup, id, die, B_FALSE); in ctf_dwarf_create_base()
1207 ctf_dwarf_member_offset(ctf_cu_t *cup, Dwarf_Die die, ctf_id_t mid, in ctf_dwarf_member_offset() argument
1216 if ((ret = ctf_dwarf_unsigned(cup, die, DW_AT_data_bit_offset, in ctf_dwarf_member_offset()
1224 if ((ret = ctf_dwarf_member_location(cup, die, &loc)) != 0) in ctf_dwarf_member_offset()
1228 if ((ret = ctf_dwarf_signed(cup, die, DW_AT_bit_offset, in ctf_dwarf_member_offset()
1237 if ((ret = ctf_dwarf_unsigned(cup, die, DW_AT_bit_size, &bitsz)) != 0) in ctf_dwarf_member_offset()
1240 if ((ret = ctf_dwarf_unsigned(cup, die, DW_AT_byte_size, in ctf_dwarf_member_offset()
1244 if ((tsz = ctf_type_size(cup->cu_ctfp, mid)) == CTF_ERR) { in ctf_dwarf_member_offset()
1245 int e = ctf_errno(cup->cu_ctfp); in ctf_dwarf_member_offset()
1246 (void) snprintf(cup->cu_errbuf, cup->cu_errlen, in ctf_dwarf_member_offset()
1254 if (cup->cu_bigend == B_TRUE) { in ctf_dwarf_member_offset()
1277 ctf_dwarf_member_bitfield(ctf_cu_t *cup, Dwarf_Die die, ctf_id_t *idp) in ctf_dwarf_member_bitfield() argument
1287 if ((ret = ctf_dwarf_unsigned(cup, die, DW_AT_bit_size, &bitsz)) != 0) { in ctf_dwarf_member_bitfield()
1302 dtd = ctf_dtd_lookup(cup->cu_ctfp, base); in ctf_dwarf_member_bitfield()
1307 dtd = ctf_dtd_lookup(cup->cu_ctfp, dtd->dtd_data.ctt_type); in ctf_dwarf_member_bitfield()
1332 for (cdb = ctf_list_next(&cup->cu_bitfields); cdb != NULL; in ctf_dwarf_member_bitfield()
1363 cdb->cdb_id = ctf_add_integer(cup->cu_ctfp, CTF_ADD_NONROOT, in ctf_dwarf_member_bitfield()
1366 (void) snprintf(cup->cu_errbuf, cup->cu_errlen, in ctf_dwarf_member_bitfield()
1368 ctf_errmsg(ctf_errno(cup->cu_ctfp))); in ctf_dwarf_member_bitfield()
1374 ctf_list_append(&cup->cu_bitfields, cdb); in ctf_dwarf_member_bitfield()
1383 ctf_dwarf_fixup_sou(ctf_cu_t *cup, Dwarf_Die die, ctf_id_t base, boolean_t add) in ctf_dwarf_fixup_sou() argument
1389 kind = ctf_type_kind(cup->cu_ctfp, base); in ctf_dwarf_fixup_sou()
1396 if ((ret = ctf_dwarf_child(cup, die, &child)) != 0) in ctf_dwarf_fixup_sou()
1409 if ((ret = ctf_dwarf_tag(cup, memb, &tag)) != 0) in ctf_dwarf_fixup_sou()
1415 if ((ret = ctf_dwarf_refdie(cup, memb, DW_AT_type, &tdie)) != 0) in ctf_dwarf_fixup_sou()
1418 if ((ret = ctf_dwarf_convert_type(cup, tdie, &mid, in ctf_dwarf_fixup_sou()
1427 if ((ret = ctf_dwarf_member_bitfield(cup, memb, in ctf_dwarf_fixup_sou()
1433 if ((ret = ctf_dwarf_string(cup, memb, DW_AT_name, in ctf_dwarf_fixup_sou()
1441 } else if ((ret = ctf_dwarf_member_offset(cup, memb, mid, in ctf_dwarf_fixup_sou()
1448 if ((ret = ctf_dwarf_member_bitfield(cup, memb, &mid)) != 0) in ctf_dwarf_fixup_sou()
1451 ret = ctf_add_member(cup->cu_ctfp, base, mname, mid, memboff); in ctf_dwarf_fixup_sou()
1453 (void) snprintf(cup->cu_errbuf, cup->cu_errlen, in ctf_dwarf_fixup_sou()
1455 mname, ctf_errmsg(ctf_errno(cup->cu_ctfp))); in ctf_dwarf_fixup_sou()
1465 if ((ret = ctf_dwarf_sib(cup, memb, &sib)) != 0) in ctf_dwarf_fixup_sou()
1478 if ((ret = ctf_dwarf_unsigned(cup, die, DW_AT_byte_size, &size)) != 0) in ctf_dwarf_fixup_sou()
1480 if ((ctf_set_size(cup->cu_ctfp, base, size)) == CTF_ERR) { in ctf_dwarf_fixup_sou()
1481 int e = ctf_errno(cup->cu_ctfp); in ctf_dwarf_fixup_sou()
1482 (void) snprintf(cup->cu_errbuf, cup->cu_errlen, in ctf_dwarf_fixup_sou()
1492 ctf_dwarf_create_sou(ctf_cu_t *cup, Dwarf_Die die, ctf_id_t *idp, in ctf_dwarf_create_sou() argument
1505 if ((ret = ctf_dwarf_string(cup, die, DW_AT_name, &name)) != 0 && in ctf_dwarf_create_sou()
1517 if ((ret = ctf_dwarf_boolean(cup, die, DW_AT_declaration, in ctf_dwarf_create_sou()
1525 base = ctf_add_forward(cup->cu_ctfp, isroot, name, kind); in ctf_dwarf_create_sou()
1527 base = ctf_add_struct(cup->cu_ctfp, isroot, name); in ctf_dwarf_create_sou()
1529 base = ctf_add_union(cup->cu_ctfp, isroot, name); in ctf_dwarf_create_sou()
1536 return (ctf_errno(cup->cu_ctfp)); in ctf_dwarf_create_sou()
1544 return (ctf_dwmap_add(cup, base, die, B_FALSE)); in ctf_dwarf_create_sou()
1545 if ((ret = ctf_dwmap_add(cup, base, die, B_TRUE)) != 0) in ctf_dwarf_create_sou()
1555 if ((ret = ctf_dwarf_child(cup, die, &child)) != 0) in ctf_dwarf_create_sou()
1562 if ((ret = ctf_dwarf_tag(cup, child, &tag)) != 0) in ctf_dwarf_create_sou()
1568 ret = ctf_dwarf_convert_type(cup, child, NULL, in ctf_dwarf_create_sou()
1578 if ((ret = ctf_dwarf_sib(cup, child, &sib)) != 0) in ctf_dwarf_create_sou()
1587 ctf_dwarf_array_upper_bound(ctf_cu_t *cup, Dwarf_Die range, ctf_arinfo_t *ar) in ctf_dwarf_array_upper_bound() argument
1616 ret = ctf_dwarf_attribute(cup, range, DW_AT_count, &attr); in ctf_dwarf_array_upper_bound()
1621 ret = ctf_dwarf_attribute(cup, range, DW_AT_upper_bound, &attr); in ctf_dwarf_array_upper_bound()
1631 DWARF_LOCK(cup); in ctf_dwarf_array_upper_bound()
1634 (void) snprintf(cup->cu_errbuf, cup->cu_errlen, in ctf_dwarf_array_upper_bound()
1691 class = dwarf_get_form_class(cup->cu_vers, attrnum, cup->cu_addrsz, in ctf_dwarf_array_upper_bound()
1700 (void) snprintf(cup->cu_errbuf, cup->cu_errlen, in ctf_dwarf_array_upper_bound()
1706 DWARF_UNLOCK(cup); in ctf_dwarf_array_upper_bound()
1707 ctf_dwarf_dealloc(cup, attr, DW_DLA_ATTR); in ctf_dwarf_array_upper_bound()
1712 ctf_dwarf_create_array_range(ctf_cu_t *cup, Dwarf_Die range, ctf_id_t *idp, in ctf_dwarf_create_array_range() argument
1721 if ((ret = ctf_dwarf_sib(cup, range, &sib)) != 0) in ctf_dwarf_create_array_range()
1725 if ((ret = ctf_dwarf_create_array_range(cup, sib, &id, in ctf_dwarf_create_array_range()
1733 if ((ar.ctr_index = ctf_dwarf_long(cup)) == CTF_ERR) in ctf_dwarf_create_array_range()
1734 return (ctf_errno(cup->cu_ctfp)); in ctf_dwarf_create_array_range()
1736 if ((ret = ctf_dwarf_array_upper_bound(cup, range, &ar)) != 0) in ctf_dwarf_create_array_range()
1739 if ((*idp = ctf_add_array(cup->cu_ctfp, isroot, &ar)) == CTF_ERR) in ctf_dwarf_create_array_range()
1740 return (ctf_errno(cup->cu_ctfp)); in ctf_dwarf_create_array_range()
1751 ctf_dwarf_create_array(ctf_cu_t *cup, Dwarf_Die die, ctf_id_t *idp, int isroot) in ctf_dwarf_create_array() argument
1758 if ((ret = ctf_dwarf_refdie(cup, die, DW_AT_type, &tdie)) != 0) in ctf_dwarf_create_array()
1760 if ((ret = ctf_dwarf_convert_type(cup, tdie, &tid, in ctf_dwarf_create_array()
1764 if ((ret = ctf_dwarf_child(cup, die, &rdie)) != 0) in ctf_dwarf_create_array()
1766 if ((ret = ctf_dwarf_tag(cup, rdie, &rtag)) != 0) in ctf_dwarf_create_array()
1769 (void) snprintf(cup->cu_errbuf, cup->cu_errlen, in ctf_dwarf_create_array()
1780 if ((ret = ctf_dwarf_create_array_range(cup, rdie, idp, tid, in ctf_dwarf_create_array()
1784 return (ctf_dwmap_add(cup, *idp, die, B_FALSE)); in ctf_dwarf_create_array()
1803 needed_array_qualifier(ctf_cu_t *cup, int kind, ctf_id_t ref_id) in needed_array_qualifier() argument
1813 if ((t = ctf_dyn_lookup_by_id(cup->cu_ctfp, ref_id)) == NULL) in needed_array_qualifier()
1816 if (LCTF_INFO_KIND(cup->cu_ctfp, t->ctt_info) != CTF_K_ARRAY) in needed_array_qualifier()
1819 if (ctf_dyn_array_info(cup->cu_ctfp, ref_id, &arinfo) != 0) in needed_array_qualifier()
1825 if ((t = ctf_dyn_lookup_by_id(cup->cu_ctfp, id)) == NULL) in needed_array_qualifier()
1828 akind = LCTF_INFO_KIND(cup->cu_ctfp, t->ctt_info); in needed_array_qualifier()
1834 if (ctf_dyn_array_info(cup->cu_ctfp, in needed_array_qualifier()
1850 ctf_kind_name(cup->cu_ctfp, kind), ref_id); in needed_array_qualifier()
1857 ctf_dwarf_create_reference(ctf_cu_t *cup, Dwarf_Die die, ctf_id_t *idp, in ctf_dwarf_create_reference() argument
1865 if ((ret = ctf_dwarf_string(cup, die, DW_AT_name, &name)) != 0 && in ctf_dwarf_create_reference()
1873 if ((ret = ctf_dwarf_refdie(cup, die, DW_AT_type, &tdie)) != 0) { in ctf_dwarf_create_reference()
1878 if ((id = ctf_dwarf_void(cup)) == CTF_ERR) { in ctf_dwarf_create_reference()
1880 return (ctf_errno(cup->cu_ctfp)); in ctf_dwarf_create_reference()
1883 if ((ret = ctf_dwarf_convert_type(cup, tdie, &id, in ctf_dwarf_create_reference()
1890 if ((ret = needed_array_qualifier(cup, kind, id)) <= 0) { in ctf_dwarf_create_reference()
1892 ret = (ctf_errno(cup->cu_ctfp)); in ctf_dwarf_create_reference()
1901 if ((*idp = ctf_add_reftype(cup->cu_ctfp, isroot, name, id, kind)) == in ctf_dwarf_create_reference()
1904 return (ctf_errno(cup->cu_ctfp)); in ctf_dwarf_create_reference()
1908 return (ctf_dwmap_add(cup, *idp, die, B_FALSE)); in ctf_dwarf_create_reference()
1912 ctf_dwarf_create_enum(ctf_cu_t *cup, Dwarf_Die die, ctf_id_t *idp, int isroot) in ctf_dwarf_create_enum() argument
1921 ret = ctf_dwarf_string(cup, die, DW_AT_name, &enumname); in ctf_dwarf_create_enum()
1932 if (ctf_dwarf_unsigned(cup, die, DW_AT_byte_size, &dw) == 0 && in ctf_dwarf_create_enum()
1937 id = ctf_add_enum(cup->cu_ctfp, isroot, enumname, size); in ctf_dwarf_create_enum()
1941 ret = ctf_errno(cup->cu_ctfp); in ctf_dwarf_create_enum()
1945 if ((ret = ctf_dwmap_add(cup, id, die, B_FALSE)) != 0) in ctf_dwarf_create_enum()
1948 if ((ret = ctf_dwarf_child(cup, die, &child)) != 0) { in ctf_dwarf_create_enum()
1962 if ((ret = ctf_dwarf_sib(cup, arg, &child)) != 0) in ctf_dwarf_create_enum()
1965 if ((ret = ctf_dwarf_tag(cup, arg, &tag)) != 0) in ctf_dwarf_create_enum()
1969 if ((ret = ctf_dwarf_convert_type(cup, arg, NULL, in ctf_dwarf_create_enum()
1979 if ((ret = ctf_dwarf_string(cup, arg, DW_AT_name, &name)) != 0) in ctf_dwarf_create_enum()
1988 if ((ret = ctf_dwarf_unsigned(cup, arg, DW_AT_const_value, in ctf_dwarf_create_enum()
1996 *cup->cu_errbuf = '\0'; in ctf_dwarf_create_enum()
1998 if ((ret = ctf_dwarf_signed(cup, arg, DW_AT_const_value, in ctf_dwarf_create_enum()
2006 (void) snprintf(cup->cu_errbuf, cup->cu_errlen, in ctf_dwarf_create_enum()
2015 ret = ctf_add_enumerator(cup->cu_ctfp, id, name, eval); in ctf_dwarf_create_enum()
2017 ret = ctf_errno(cup->cu_ctfp); in ctf_dwarf_create_enum()
2019 if (ret == ECTF_DTFULL && (cup->cu_handle->cch_flags & in ctf_dwarf_create_enum()
2021 if (cup->cu_handle->cch_warncb != NULL) { in ctf_dwarf_create_enum()
2022 cup->cu_handle->cch_warncb( in ctf_dwarf_create_enum()
2023 cup->cu_handle->cch_warncb_arg, in ctf_dwarf_create_enum()
2030 (void) snprintf(cup->cu_errbuf, cup->cu_errlen, in ctf_dwarf_create_enum()
2054 ctf_dwarf_create_fptr(ctf_cu_t *cup, Dwarf_Die die, ctf_id_t *idp, int isroot) in ctf_dwarf_create_fptr() argument
2064 if ((ret = ctf_dwarf_boolean(cup, die, DW_AT_declaration, &b)) != 0) { in ctf_dwarf_create_fptr()
2075 if ((ret = ctf_dwarf_refdie(cup, die, DW_AT_type, &retdie)) != 0) { in ctf_dwarf_create_fptr()
2078 if ((fi.ctc_return = ctf_dwarf_void(cup)) == CTF_ERR) in ctf_dwarf_create_fptr()
2079 return (ctf_errno(cup->cu_ctfp)); in ctf_dwarf_create_fptr()
2081 if ((ret = ctf_dwarf_convert_type(cup, retdie, &fi.ctc_return, in ctf_dwarf_create_fptr()
2086 if ((ret = ctf_dwarf_function_count(cup, die, &fi, B_TRUE)) != 0) { in ctf_dwarf_create_fptr()
2095 if ((ret = ctf_dwarf_convert_fargs(cup, die, &fi, argv)) != 0) { in ctf_dwarf_create_fptr()
2101 if ((*idp = ctf_add_funcptr(cup->cu_ctfp, isroot, &fi, argv)) == in ctf_dwarf_create_fptr()
2104 return (ctf_errno(cup->cu_ctfp)); in ctf_dwarf_create_fptr()
2108 return (ctf_dwmap_add(cup, *idp, die, B_FALSE)); in ctf_dwarf_create_fptr()
2112 ctf_dwarf_convert_type(ctf_cu_t *cup, Dwarf_Die die, ctf_id_t *idp, in ctf_dwarf_convert_type() argument
2124 if ((ret = ctf_dwarf_offset(cup, die, &offset)) != 0) in ctf_dwarf_convert_type()
2127 if (offset > cup->cu_maxoff) { in ctf_dwarf_convert_type()
2128 (void) snprintf(cup->cu_errbuf, cup->cu_errlen, in ctf_dwarf_convert_type()
2130 offset, cup->cu_maxoff); in ctf_dwarf_convert_type()
2138 if ((map = avl_find(&cup->cu_map, &lookup, NULL)) != NULL) { in ctf_dwarf_convert_type()
2143 if ((ret = ctf_dwarf_tag(cup, die, &tag)) != 0) in ctf_dwarf_convert_type()
2150 ret = ctf_dwarf_create_base(cup, die, idp, isroot, offset); in ctf_dwarf_convert_type()
2154 ret = ctf_dwarf_create_array(cup, die, idp, isroot); in ctf_dwarf_convert_type()
2158 ret = ctf_dwarf_create_enum(cup, die, idp, isroot); in ctf_dwarf_convert_type()
2162 ret = ctf_dwarf_create_reference(cup, die, idp, CTF_K_POINTER, in ctf_dwarf_convert_type()
2167 ret = ctf_dwarf_create_sou(cup, die, idp, CTF_K_STRUCT, in ctf_dwarf_convert_type()
2172 ret = ctf_dwarf_create_fptr(cup, die, idp, isroot); in ctf_dwarf_convert_type()
2176 ret = ctf_dwarf_create_reference(cup, die, idp, CTF_K_TYPEDEF, in ctf_dwarf_convert_type()
2181 ret = ctf_dwarf_create_sou(cup, die, idp, CTF_K_UNION, in ctf_dwarf_convert_type()
2186 ret = ctf_dwarf_create_reference(cup, die, idp, CTF_K_CONST, in ctf_dwarf_convert_type()
2191 ret = ctf_dwarf_create_reference(cup, die, idp, CTF_K_VOLATILE, in ctf_dwarf_convert_type()
2196 ret = ctf_dwarf_create_reference(cup, die, idp, CTF_K_RESTRICT, in ctf_dwarf_convert_type()
2212 ctf_dwarf_walk_lexical(ctf_cu_t *cup, Dwarf_Die die) in ctf_dwarf_walk_lexical() argument
2217 if ((ret = ctf_dwarf_child(cup, die, &child)) != 0) in ctf_dwarf_walk_lexical()
2223 return (ctf_dwarf_convert_die(cup, die)); in ctf_dwarf_walk_lexical()
2227 ctf_dwarf_function_count(ctf_cu_t *cup, Dwarf_Die die, ctf_funcinfo_t *fip, in ctf_dwarf_function_count() argument
2233 if ((ret = ctf_dwarf_child(cup, die, &child)) != 0) in ctf_dwarf_function_count()
2240 if ((ret = ctf_dwarf_tag(cup, arg, &tag)) != 0) in ctf_dwarf_function_count()
2258 if ((ret = ctf_dwarf_string(cup, die, DW_AT_name, in ctf_dwarf_function_count()
2272 if ((ret = ctf_dwarf_sib(cup, arg, &sib)) != 0) in ctf_dwarf_function_count()
2281 ctf_dwarf_convert_fargs(ctf_cu_t *cup, Dwarf_Die die, ctf_funcinfo_t *fip, in ctf_dwarf_convert_fargs() argument
2288 if ((ret = ctf_dwarf_child(cup, die, &child)) != 0) in ctf_dwarf_convert_fargs()
2295 if ((ret = ctf_dwarf_tag(cup, arg, &tag)) != 0) in ctf_dwarf_convert_fargs()
2300 if ((ret = ctf_dwarf_refdie(cup, arg, DW_AT_type, in ctf_dwarf_convert_fargs()
2304 if ((ret = ctf_dwarf_convert_type(cup, tdie, &argv[i], in ctf_dwarf_convert_fargs()
2318 if ((ret = ctf_dwarf_sib(cup, arg, &sib)) != 0) in ctf_dwarf_convert_fargs()
2327 ctf_dwarf_convert_function(ctf_cu_t *cup, Dwarf_Die die) in ctf_dwarf_convert_function() argument
2341 if ((ret = ctf_dwarf_string(cup, die, DW_AT_name, &name)) != 0) { in ctf_dwarf_convert_function()
2348 name, ctf_die_offset(cup, die)); in ctf_dwarf_convert_function()
2350 if ((ret = ctf_dwarf_boolean(cup, die, DW_AT_declaration, &b)) != 0) { in ctf_dwarf_convert_function()
2364 name, ctf_die_offset(cup, die)); in ctf_dwarf_convert_function()
2376 if ((ret = ctf_dwarf_refdie(cup, die, DW_AT_type, &tdie)) == 0) { in ctf_dwarf_convert_function()
2377 if ((ret = ctf_dwarf_convert_type(cup, tdie, in ctf_dwarf_convert_function()
2388 if ((cdf->cdf_fip.ctc_return = ctf_dwarf_void(cup)) == in ctf_dwarf_convert_function()
2392 return (ctf_errno(cup->cu_ctfp)); in ctf_dwarf_convert_function()
2406 if ((ret = ctf_dwarf_function_count(cup, die, &cdf->cdf_fip, in ctf_dwarf_convert_function()
2422 if ((ret = ctf_dwarf_convert_fargs(cup, die, in ctf_dwarf_convert_function()
2433 if ((ret = ctf_dwarf_isglobal(cup, die, &cdf->cdf_global)) != 0) { in ctf_dwarf_convert_function()
2441 ctf_list_append(&cup->cu_funcs, cdf); in ctf_dwarf_convert_function()
2449 ctf_dwarf_convert_variable(ctf_cu_t *cup, Dwarf_Die die) in ctf_dwarf_convert_variable() argument
2459 if ((ret = ctf_dwarf_boolean(cup, die, DW_AT_declaration, &b)) == 0) { in ctf_dwarf_convert_variable()
2473 if ((ret = ctf_dwarf_refdie(cup, die, DW_AT_specification, in ctf_dwarf_convert_variable()
2476 if ((ret = ctf_dwarf_offset(cup, tdie, &offset)) != 0) in ctf_dwarf_convert_variable()
2479 ctf_die_offset(cup, die), ctf_die_offset(cup, tdie)); in ctf_dwarf_convert_variable()
2485 if ((ret = ctf_dwarf_string(cup, die, DW_AT_name, &name)) != 0 && in ctf_dwarf_convert_variable()
2491 if ((ret = ctf_dwarf_refdie(cup, die, DW_AT_type, &tdie)) != 0) { in ctf_dwarf_convert_variable()
2496 if ((ret = ctf_dwarf_convert_type(cup, tdie, &id, in ctf_dwarf_convert_variable()
2508 if ((ret = ctf_dwarf_isglobal(cup, die, &cdv->cdv_global)) != 0) { in ctf_dwarf_convert_variable()
2514 ctf_list_append(&cup->cu_vars, cdv); in ctf_dwarf_convert_variable()
2522 ctf_dwarf_walk_toplevel(ctf_cu_t *cup, Dwarf_Die die) in ctf_dwarf_walk_toplevel() argument
2528 if ((ret = ctf_dwarf_offset(cup, die, &offset)) != 0) in ctf_dwarf_walk_toplevel()
2531 if (offset > cup->cu_maxoff) { in ctf_dwarf_walk_toplevel()
2532 (void) snprintf(cup->cu_errbuf, cup->cu_errlen, in ctf_dwarf_walk_toplevel()
2534 offset, cup->cu_maxoff); in ctf_dwarf_walk_toplevel()
2538 if ((ret = ctf_dwarf_tag(cup, die, &tag)) != 0) in ctf_dwarf_walk_toplevel()
2545 ret = ctf_dwarf_convert_function(cup, die); in ctf_dwarf_walk_toplevel()
2549 ret = ctf_dwarf_convert_variable(cup, die); in ctf_dwarf_walk_toplevel()
2553 ret = ctf_dwarf_walk_lexical(cup, die); in ctf_dwarf_walk_toplevel()
2560 ret = ctf_dwarf_convert_type(cup, die, NULL, B_TRUE); in ctf_dwarf_walk_toplevel()
2575 ctf_dwarf_convert_die(ctf_cu_t *cup, Dwarf_Die die) in ctf_dwarf_convert_die() argument
2581 if ((ret = ctf_dwarf_walk_toplevel(cup, die)) != 0) in ctf_dwarf_convert_die()
2584 if ((ret = ctf_dwarf_sib(cup, die, &sib)) != 0) in ctf_dwarf_convert_die()
2592 ctf_dwarf_fixup_die(ctf_cu_t *cup, boolean_t addpass) in ctf_dwarf_fixup_die() argument
2596 for (map = avl_first(&cup->cu_map); map != NULL; in ctf_dwarf_fixup_die()
2597 map = AVL_NEXT(&cup->cu_map, map)) { in ctf_dwarf_fixup_die()
2601 if ((ret = ctf_dwarf_fixup_sou(cup, map->cdm_die, map->cdm_id, in ctf_dwarf_fixup_die()
2666 ctf_dwarf_match_func(ctf_cu_t *cup, const char *file, const char *name, in ctf_dwarf_match_func() argument
2674 if (bind == STB_LOCAL && (file == NULL || cup->cu_name == NULL)) in ctf_dwarf_match_func()
2677 for (cdf = ctf_list_next(&cup->cu_funcs); cdf != NULL; in ctf_dwarf_match_func()
2681 if (ctf_dwarf_symbol_match(file, name, bind, cup->cu_name, in ctf_dwarf_match_func()
2698 ctf_dwarf_match_var(ctf_cu_t *cup, const char *file, const char *name, in ctf_dwarf_match_var() argument
2706 if (bind == STB_LOCAL && (file == NULL || cup->cu_name == NULL)) in ctf_dwarf_match_var()
2709 for (cdv = ctf_list_next(&cup->cu_vars); cdv != NULL; in ctf_dwarf_match_var()
2713 if (ctf_dwarf_symbol_match(file, name, bind, cup->cu_name, in ctf_dwarf_match_var()
2734 ctf_cu_t *cup = arg; in ctf_dwarf_conv_funcvars_cb() local
2746 ctf_dwvar_t *cdv = ctf_dwarf_match_var(cup, file, name, in ctf_dwarf_conv_funcvars_cb()
2750 ret = ctf_add_object(cup->cu_ctfp, idx, cdv->cdv_type); in ctf_dwarf_conv_funcvars_cb()
2753 ctf_dwfunc_t *cdf = ctf_dwarf_match_func(cup, file, name, in ctf_dwarf_conv_funcvars_cb()
2757 ret = ctf_add_function(cup->cu_ctfp, idx, &cdf->cdf_fip, in ctf_dwarf_conv_funcvars_cb()
2763 return (ctf_errno(cup->cu_ctfp)); in ctf_dwarf_conv_funcvars_cb()
2770 ctf_dwarf_conv_funcvars(ctf_cu_t *cup) in ctf_dwarf_conv_funcvars() argument
2772 return (ctf_symtab_iter(cup->cu_ctfp, ctf_dwarf_conv_funcvars_cb, cup)); in ctf_dwarf_conv_funcvars()
2869 ctf_dwarf_duplicate_sym(ctf_cu_t *cup, ulong_t idx, ulong_t matchidx) in ctf_dwarf_duplicate_sym() argument
2871 ctf_id_t id = ctf_lookup_by_symbol(cup->cu_ctfp, matchidx); in ctf_dwarf_duplicate_sym()
2878 if (ctf_errno(cup->cu_ctfp) == ECTF_NOTYPEDAT) in ctf_dwarf_duplicate_sym()
2881 return (ctf_errno(cup->cu_ctfp)); in ctf_dwarf_duplicate_sym()
2884 if (ctf_add_object(cup->cu_ctfp, idx, id) == CTF_ERR) in ctf_dwarf_duplicate_sym()
2885 return (ctf_errno(cup->cu_ctfp)); in ctf_dwarf_duplicate_sym()
2891 ctf_dwarf_duplicate_func(ctf_cu_t *cup, ulong_t idx, ulong_t matchidx) in ctf_dwarf_duplicate_func() argument
2897 if (ctf_func_info(cup->cu_ctfp, matchidx, &fip) == CTF_ERR) { in ctf_dwarf_duplicate_func()
2898 if (ctf_errno(cup->cu_ctfp) == ECTF_NOFUNCDAT) in ctf_dwarf_duplicate_func()
2901 return (ctf_errno(cup->cu_ctfp)); in ctf_dwarf_duplicate_func()
2909 if (ctf_func_args(cup->cu_ctfp, matchidx, fip.ctc_argc, args) == in ctf_dwarf_duplicate_func()
2912 return (ctf_errno(cup->cu_ctfp)); in ctf_dwarf_duplicate_func()
2916 ret = ctf_add_function(cup->cu_ctfp, idx, &fip, args); in ctf_dwarf_duplicate_func()
2920 return (ctf_errno(cup->cu_ctfp)); in ctf_dwarf_duplicate_func()
2931 ctf_cu_t *cup = arg; in ctf_dwarf_conv_weaks_cb() local
2954 ret = ctf_symtab_iter(cup->cu_ctfp, ctf_dwarf_conv_check_weak, &cweak); in ctf_dwarf_conv_weaks_cb()
2971 ret = ctf_dwarf_duplicate_sym(cup, idx, cweak.cweak_idx); in ctf_dwarf_conv_weaks_cb()
2973 ret = ctf_dwarf_duplicate_func(cup, idx, cweak.cweak_idx); in ctf_dwarf_conv_weaks_cb()
2980 ctf_dwarf_conv_weaks(ctf_cu_t *cup) in ctf_dwarf_conv_weaks() argument
2982 return (ctf_symtab_iter(cup->cu_ctfp, ctf_dwarf_conv_weaks_cb, cup)); in ctf_dwarf_conv_weaks()
2990 ctf_cu_t *cup = arg; in ctf_dwarf_convert_one() local
2991 const char *name = cup->cu_name != NULL ? cup->cu_name : "NULL"; in ctf_dwarf_convert_one()
2993 VERIFY(cup != NULL); in ctf_dwarf_convert_one()
2995 if ((ret = ctf_dwarf_init_die(cup)) != 0) in ctf_dwarf_convert_one()
2999 cup->cu_maxoff); in ctf_dwarf_convert_one()
3001 ret = ctf_dwarf_convert_die(cup, cup->cu_cu); in ctf_dwarf_convert_one()
3007 if (ctf_update(cup->cu_ctfp) != 0) { in ctf_dwarf_convert_one()
3008 return (ctf_dwarf_error(cup, cup->cu_ctfp, 0, in ctf_dwarf_convert_one()
3012 ret = ctf_dwarf_fixup_die(cup, B_FALSE); in ctf_dwarf_convert_one()
3018 if (ctf_update(cup->cu_ctfp) != 0) { in ctf_dwarf_convert_one()
3019 return (ctf_dwarf_error(cup, cup->cu_ctfp, 0, in ctf_dwarf_convert_one()
3023 ret = ctf_dwarf_fixup_die(cup, B_TRUE); in ctf_dwarf_convert_one()
3029 if (ctf_update(cup->cu_ctfp) != 0) { in ctf_dwarf_convert_one()
3030 return (ctf_dwarf_error(cup, cup->cu_ctfp, 0, in ctf_dwarf_convert_one()
3034 if ((ret = ctf_dwarf_conv_funcvars(cup)) != 0) { in ctf_dwarf_convert_one()
3037 return (ctf_dwarf_error(cup, NULL, ret, in ctf_dwarf_convert_one()
3041 if (ctf_update(cup->cu_ctfp) != 0) { in ctf_dwarf_convert_one()
3042 return (ctf_dwarf_error(cup, cup->cu_ctfp, 0, in ctf_dwarf_convert_one()
3046 if (cup->cu_doweaks == B_TRUE) { in ctf_dwarf_convert_one()
3047 if ((ret = ctf_dwarf_conv_weaks(cup)) != 0) { in ctf_dwarf_convert_one()
3050 return (ctf_dwarf_error(cup, NULL, ret, in ctf_dwarf_convert_one()
3054 if (ctf_update(cup->cu_ctfp) != 0) { in ctf_dwarf_convert_one()
3055 return (ctf_dwarf_error(cup, cup->cu_ctfp, 0, in ctf_dwarf_convert_one()
3060 ctf_phase_dump(cup->cu_ctfp, "pre-dwarf-dedup", name); in ctf_dwarf_convert_one()
3062 if ((ret = ctf_merge_add(cup->cu_cmh, cup->cu_ctfp)) != 0) { in ctf_dwarf_convert_one()
3063 return (ctf_dwarf_error(cup, NULL, ret, in ctf_dwarf_convert_one()
3068 if ((ret = ctf_merge_dedup(cup->cu_cmh, &dedup)) != 0) { in ctf_dwarf_convert_one()
3069 return (ctf_dwarf_error(cup, NULL, ret, in ctf_dwarf_convert_one()
3073 ctf_close(cup->cu_ctfp); in ctf_dwarf_convert_one()
3074 cup->cu_ctfp = dedup; in ctf_dwarf_convert_one()
3075 ctf_phase_dump(cup->cu_ctfp, "post-dwarf-dedup", name); in ctf_dwarf_convert_one()
3081 ctf_dwarf_free_die(ctf_cu_t *cup) in ctf_dwarf_free_die() argument
3089 ctf_dprintf("Beginning to free die: %p\n", cup); in ctf_dwarf_free_die()
3091 VERIFY3P(cup->cu_elf, !=, NULL); in ctf_dwarf_free_die()
3092 cup->cu_elf = NULL; in ctf_dwarf_free_die()
3094 ctf_dprintf("Trying to free name: %p\n", cup->cu_name); in ctf_dwarf_free_die()
3095 if (cup->cu_name != NULL) { in ctf_dwarf_free_die()
3096 ctf_strfree(cup->cu_name); in ctf_dwarf_free_die()
3097 cup->cu_name = NULL; in ctf_dwarf_free_die()
3100 ctf_dprintf("Trying to free merge handle: %p\n", cup->cu_cmh); in ctf_dwarf_free_die()
3101 if (cup->cu_cmh != NULL) { in ctf_dwarf_free_die()
3102 ctf_merge_fini(cup->cu_cmh); in ctf_dwarf_free_die()
3103 cup->cu_cmh = NULL; in ctf_dwarf_free_die()
3107 for (cdf = ctf_list_next(&cup->cu_funcs); cdf != NULL; cdf = ndf) { in ctf_dwarf_free_die()
3118 for (cdv = ctf_list_next(&cup->cu_vars); cdv != NULL; cdv = ndv) { in ctf_dwarf_free_die()
3125 for (cdb = ctf_list_next(&cup->cu_bitfields); cdb != NULL; cdb = ndb) { in ctf_dwarf_free_die()
3130 if (cup->cu_ctfp != NULL) { in ctf_dwarf_free_die()
3131 ctf_close(cup->cu_ctfp); in ctf_dwarf_free_die()
3132 cup->cu_ctfp = NULL; in ctf_dwarf_free_die()
3136 while ((map = avl_destroy_nodes(&cup->cu_map, &cookie)) != NULL) in ctf_dwarf_free_die()
3138 avl_destroy(&cup->cu_map); in ctf_dwarf_free_die()
3139 cup->cu_errbuf = NULL; in ctf_dwarf_free_die()
3141 if (cup->cu_cu != NULL) { in ctf_dwarf_free_die()
3142 ctf_dwarf_dealloc(cup, cup->cu_cu, DW_DLA_DIE); in ctf_dwarf_free_die()
3143 cup->cu_cu = NULL; in ctf_dwarf_free_die()
3197 ctf_cu_t *cup; in ctf_dwarf_preinit_dies() local
3202 cup = &cdies[i++]; in ctf_dwarf_preinit_dies()
3204 cup->cu_handle = cch; in ctf_dwarf_preinit_dies()
3205 cup->cu_fd = fd; in ctf_dwarf_preinit_dies()
3206 cup->cu_elf = elf; in ctf_dwarf_preinit_dies()
3207 cup->cu_dwarf = dw; in ctf_dwarf_preinit_dies()
3208 cup->cu_errbuf = errbuf; in ctf_dwarf_preinit_dies()
3209 cup->cu_errlen = errlen; in ctf_dwarf_preinit_dies()
3210 cup->cu_dwarf = dw; in ctf_dwarf_preinit_dies()
3216 cup->cu_dwlock = dwlock; in ctf_dwarf_preinit_dies()
3217 cup->cu_doweaks = B_FALSE; in ctf_dwarf_preinit_dies()
3219 cup->cu_doweaks = B_TRUE; in ctf_dwarf_preinit_dies()
3222 cup->cu_voidtid = CTF_ERR; in ctf_dwarf_preinit_dies()
3223 cup->cu_longtid = CTF_ERR; in ctf_dwarf_preinit_dies()
3224 cup->cu_cuoff = offset; in ctf_dwarf_preinit_dies()
3225 cup->cu_maxoff = nexthdr - 1; in ctf_dwarf_preinit_dies()
3226 cup->cu_vers = vers; in ctf_dwarf_preinit_dies()
3227 cup->cu_addrsz = addrsz; in ctf_dwarf_preinit_dies()
3229 if ((ret = ctf_dwarf_sib(cup, NULL, &cu)) != 0) { in ctf_dwarf_preinit_dies()
3236 (void) snprintf(cup->cu_errbuf, cup->cu_errlen, in ctf_dwarf_preinit_dies()
3241 if (ctf_dwarf_string(cup, cu, DW_AT_name, &name) == 0) { in ctf_dwarf_preinit_dies()
3244 cup->cu_name = strdup(b); in ctf_dwarf_preinit_dies()
3246 if (cup->cu_name == NULL) in ctf_dwarf_preinit_dies()
3250 ret = ctf_dwarf_child(cup, cu, &cup->cu_cu); in ctf_dwarf_preinit_dies()
3251 dwarf_dealloc(cup->cu_dwarf, cu, DW_DLA_DIE); in ctf_dwarf_preinit_dies()
3254 i, cup->cu_name != NULL ? cup->cu_name : "NULL", in ctf_dwarf_preinit_dies()
3259 if (cup->cu_cu == NULL) { in ctf_dwarf_preinit_dies()
3263 i, cup->cu_name != NULL ? cup->cu_name : "NULL", in ctf_dwarf_preinit_dies()
3265 if (cup->cu_name != NULL && in ctf_dwarf_preinit_dies()
3266 (len = strlen(cup->cu_name)) > 2 && in ctf_dwarf_preinit_dies()
3267 strncmp(".c", &cup->cu_name[len - 2], 2) == 0) { in ctf_dwarf_preinit_dies()
3275 cup->cu_errbuf, cup->cu_errlen, in ctf_dwarf_preinit_dies()
3278 cup->cu_name); in ctf_dwarf_preinit_dies()
3284 "information\n", cup->cu_name); in ctf_dwarf_preinit_dies()
3292 cup->cu_name != NULL ? cup->cu_name : "NULL"); in ctf_dwarf_preinit_dies()
3307 ctf_dwarf_init_die(ctf_cu_t *cup) in ctf_dwarf_init_die() argument
3311 cup->cu_ctfp = ctf_fdcreate(cup->cu_fd, &ret); in ctf_dwarf_init_die()
3312 if (cup->cu_ctfp == NULL) in ctf_dwarf_init_die()
3315 avl_create(&cup->cu_map, ctf_dwmap_comp, sizeof (ctf_dwmap_t), in ctf_dwarf_init_die()
3318 if ((ret = ctf_dwarf_die_elfenc(cup->cu_elf, cup, in ctf_dwarf_init_die()
3319 cup->cu_errbuf, cup->cu_errlen)) != 0) { in ctf_dwarf_init_die()
3323 if ((cup->cu_cmh = ctf_merge_init(cup->cu_fd, &ret)) == NULL) in ctf_dwarf_init_die()
3471 ctf_cu_t *cup; in ctf_dwarf_convert_batch() local
3478 cup = &cdies[i]; in ctf_dwarf_convert_batch()
3479 if (cup->cu_cu == NULL) in ctf_dwarf_convert_batch()
3482 cup->cu_name != NULL ? cup->cu_name : "NULL", in ctf_dwarf_convert_batch()
3483 cup->cu_cu, cup->cu_cuoff, cup->cu_maxoff); in ctf_dwarf_convert_batch()
3484 if (workq_add(wqp, cup) == -1) { in ctf_dwarf_convert_batch()
3541 cup = &cdies[i]; in ctf_dwarf_convert_batch()
3542 if (cup->cu_cu == NULL) in ctf_dwarf_convert_batch()
3544 if ((err = ctf_merge_add(cmp, cup->cu_ctfp)) != 0) { in ctf_dwarf_convert_batch()
3564 cup = &cdies[i]; in ctf_dwarf_convert_batch()
3566 ctf_dwarf_free_die(cup); in ctf_dwarf_convert_batch()
3582 ctf_cu_t *cdies = NULL, *cup; in ctf_dwarf_convert() local
3648 cup = cdies; in ctf_dwarf_convert()
3650 if ((err = ctf_dwarf_convert_one(cup, NULL)) != 0) in ctf_dwarf_convert()
3653 *fpp = cup->cu_ctfp; in ctf_dwarf_convert()
3654 cup->cu_ctfp = NULL; in ctf_dwarf_convert()
3655 ctf_dwarf_free_die(cup); in ctf_dwarf_convert()