summaryrefslogtreecommitdiffstats
path: root/cddl
diff options
context:
space:
mode:
authormarkj <markj@FreeBSD.org>2014-11-16 04:07:53 +0000
committermarkj <markj@FreeBSD.org>2014-11-16 04:07:53 +0000
commitcf680a80e86f94a7c5c40aea2c8ffc1b8a5581b7 (patch)
tree41bc8faab0629b85016d8839849b87609fccf48e /cddl
parent39fa4746e5349aa73a6e35b24f10161f05b192df (diff)
downloadFreeBSD-src-cf680a80e86f94a7c5c40aea2c8ffc1b8a5581b7.zip
FreeBSD-src-cf680a80e86f94a7c5c40aea2c8ffc1b8a5581b7.tar.gz
Fix a couple of bugs around the handling of structs and unions of size zero.
These would cause ctfconvert(1) to return an error when attempting to resolve valid C types. Reviewed by: Robert Mustacchi <rm@joyent.com> MFC after: 2 weeks Sponsored by: EMC / Isilon Storage Division
Diffstat (limited to 'cddl')
-rw-r--r--cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c b/cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c
index 55ce7b2..5dfeab3 100644
--- a/cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c
+++ b/cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c
@@ -766,7 +766,8 @@ die_array_resolve(tdesc_t *tdp, tdesc_t **tdpp __unused, void *private)
debug(3, "trying to resolve array %d (cont %d)\n", tdp->t_id,
tdp->t_ardef->ad_contents->t_id);
- if ((sz = tdesc_size(tdp->t_ardef->ad_contents)) == 0) {
+ if ((sz = tdesc_size(tdp->t_ardef->ad_contents)) == 0 &&
+ (tdp->t_ardef->ad_contents->t_flags & TDESC_F_RESOLVED) == 0) {
debug(3, "unable to resolve array %s (%d) contents %d\n",
tdesc_name(tdp), tdp->t_id,
tdp->t_ardef->ad_contents->t_id);
@@ -1138,12 +1139,17 @@ die_sou_resolve(tdesc_t *tdp, tdesc_t **tdpp __unused, void *private)
/*
* For empty members, or GCC/C99 flexible array
- * members, a size of 0 is correct.
+ * members, a size of 0 is correct. Structs and unions
+ * consisting of flexible array members will also have
+ * size 0.
*/
if (mt->t_members == NULL)
continue;
if (mt->t_type == ARRAY && mt->t_ardef->ad_nelems == 0)
continue;
+ if ((mt->t_flags & TDESC_F_RESOLVED) != 0 &&
+ (mt->t_type == STRUCT || mt->t_type == UNION))
+ continue;
dw->dw_nunres++;
return (1);
OpenPOWER on IntegriCloud