Index: cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c =================================================================== --- cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c +++ cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c @@ -428,9 +428,6 @@ char *str = NULL; (void) die_string(dw, die, DW_AT_name, &str, 0); - if (str == NULL) - str = xstrdup(""); - return (str); } @@ -990,8 +987,7 @@ * info for anon structs, though recent versions are fixed (gcc * bug 11816). */ - if ((ml->ml_name = die_name(dw, mem)) == NULL) - ml->ml_name = NULL; + ml->ml_name = die_name(dw, mem); ml->ml_type = die_lookup_pass1(dw, mem, DW_AT_type); debug(3, "die_sou_create(): ml_type = %p t_id = %d\n", @@ -1132,6 +1128,10 @@ for (ml = tdp->t_members; ml != NULL; ml = ml->ml_next) { if (ml->ml_size == 0) { mt = tdesc_basetype(ml->ml_type); + if (mt == NULL) { + dw->dw_nunres++; + return (1); + } if ((ml->ml_size = tdesc_bitsize(mt)) != 0) continue; @@ -1621,31 +1621,36 @@ char *name1; debug(3, "die %llu: looking at sub member at %llu\n", - off, die_off(dw, die)); + off, die_off(dw, arg)); if (die_tag(dw, arg) != DW_TAG_formal_parameter) continue; - if ((name1 = die_name(dw, arg)) == NULL) { - terminate("die %llu: func arg %d has no name\n", - off, ii->ii_nargs + 1); - } + name1 = die_name(dw, arg); + /* + * Function arguments can have no name. But CTF doesn't + * need to care. + */ - if (strcmp(name1, "...") == 0) { + if (name1 != NULL && strcmp(name1, "...") == 0) { free(name1); ii->ii_vargs = 1; continue; } + if (ii->ii_vargs != 0) { + /* The loop below assumes it won't encounter varargs. */ + terminate("die %llu: varargs not the last arg?", off); + } ii->ii_nargs++; } + debug(3, "die %llu: function has %d argument%s%s\n", off, + ii->ii_nargs, (ii->ii_nargs == 1 ? "" : "s"), + ii->ii_vargs == 1 ? " and is variadic" : ""); if (ii->ii_nargs > 0) { int i; - debug(3, "die %llu: function has %d argument%s\n", off, - ii->ii_nargs, (ii->ii_nargs == 1 ? "" : "s")); - ii->ii_args = xcalloc(sizeof (tdesc_t) * ii->ii_nargs); for (arg = die_child(dw, die), i = 0;