diff options
Diffstat (limited to 'cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c')
-rw-r--r-- | cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c b/cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c index 32c993e1e524..42faaad65db5 100644 --- a/cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c +++ b/cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c @@ -618,7 +618,7 @@ tdesc_intr_long(dwarf_t *dw) * caller can then use the copy as the type for a bitfield structure member. */ static tdesc_t * -tdesc_intr_clone(dwarf_t *dw, tdesc_t *old, size_t bitsz) +tdesc_intr_clone(dwarf_t *dw, tdesc_t *old, size_t bitsz, const char *suffix) { tdesc_t *new = xcalloc(sizeof (tdesc_t)); @@ -627,7 +627,7 @@ tdesc_intr_clone(dwarf_t *dw, tdesc_t *old, size_t bitsz) "unresolved type\n", old->t_id); } - new->t_name = xstrdup(old->t_name); + xasprintf(&new->t_name, "%s %s", old->t_name, suffix); new->t_size = old->t_size; new->t_id = mfgtid_next(dw); new->t_type = INTRINSIC; @@ -1004,7 +1004,9 @@ die_sou_create(dwarf_t *dw, Dwarf_Die str, Dwarf_Off off, tdesc_t *tdp, else ml->ml_size = tdesc_bitsize(ml->ml_type); - if (die_unsigned(dw, mem, DW_AT_bit_offset, &bitoff, 0)) { + if (die_unsigned(dw, mem, DW_AT_data_bit_offset, &bitoff, 0)) { + ml->ml_offset += bitoff; + } else if (die_unsigned(dw, mem, DW_AT_bit_offset, &bitoff, 0)) { #if BYTE_ORDER == _BIG_ENDIAN ml->ml_offset += bitoff; #else @@ -1123,8 +1125,16 @@ die_sou_resolve(tdesc_t *tdp, tdesc_t **tdpp __unused, void *private) */ if (mt->t_members == NULL) continue; - if (mt->t_type == ARRAY && mt->t_ardef->ad_nelems == 0) - continue; + if (mt->t_type == ARRAY) { + if (mt->t_ardef->ad_nelems == 0) + continue; + mt = tdesc_basetype(mt->t_ardef->ad_contents); + if ((mt->t_flags & TDESC_F_RESOLVED) != 0 && + (mt->t_type == STRUCT || + mt->t_type == UNION) && + mt->t_members == NULL) + continue; + } if ((mt->t_flags & TDESC_F_RESOLVED) != 0 && (mt->t_type == STRUCT || mt->t_type == UNION)) continue; @@ -1150,7 +1160,8 @@ die_sou_resolve(tdesc_t *tdp, tdesc_t **tdpp __unused, void *private) debug(3, "tdp %u: creating bitfield for %d bits\n", tdp->t_id, ml->ml_size); - ml->ml_type = tdesc_intr_clone(dw, mt, ml->ml_size); + ml->ml_type = tdesc_intr_clone(dw, mt, ml->ml_size, + "bitfield"); } } @@ -1358,7 +1369,7 @@ static const fp_size_map_t fp_encodings[] = { }; static uint_t -die_base_type2enc(dwarf_t *dw, Dwarf_Off off, Dwarf_Signed enc, size_t sz) +die_base_type2enc(dwarf_t *dw, Dwarf_Off off, Dwarf_Unsigned enc, size_t sz) { const fp_size_map_t *map = fp_encodings; uint_t szidx = dw->dw_ptrsz == sizeof (uint64_t); @@ -1389,9 +1400,9 @@ static intr_t * die_base_from_dwarf(dwarf_t *dw, Dwarf_Die base, Dwarf_Off off, size_t sz) { intr_t *intr = xcalloc(sizeof (intr_t)); - Dwarf_Signed enc; + Dwarf_Unsigned enc; - (void) die_signed(dw, base, DW_AT_encoding, &enc, DW_ATTR_REQ); + (void) die_unsigned(dw, base, DW_AT_encoding, &enc, DW_ATTR_REQ); switch (enc) { case DW_ATE_unsigned: |