1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
Date: Sun, 10 Apr 2016 21:54:27 +0100
From: Steven Chamberlain <steven@pyro.eu.org>
Subject: encode first CTF_MAX_VLEN members of struct/union
Turn a "sou %s has too many values" error into a warning;
encode only the first CTF_MAX_VLEN members.
--- a/cddl/contrib/opensolaris/tools/ctf/cvt/ctf.c
+++ b/cddl/contrib/opensolaris/tools/ctf/cvt/ctf.c
@@ -383,8 +383,9 @@
i++; /* count up struct or union members */
if (i > CTF_MAX_VLEN) {
- terminate("sou %s has too many members: %d > %d\n",
+ warning("sou %s has too many members: %d > %d\n",
tdesc_name(tp), i, CTF_MAX_VLEN);
+ i = CTF_MAX_VLEN;
}
if (tp->t_type == STRUCT)
@@ -395,7 +396,7 @@
write_sized_type_rec(b, &ctt, tp->t_size);
if (tp->t_size < CTF_LSTRUCT_THRESH) {
- for (mp = tp->t_members; mp != NULL; mp = mp->ml_next) {
+ for (mp = tp->t_members; mp != NULL && i > 0; mp = mp->ml_next) {
offset = strtab_insert(&b->ctb_strtab,
mp->ml_name);
@@ -409,9 +410,10 @@
SWAP_16(ctm.ctm_offset);
}
ctf_buf_write(b, &ctm, sizeof (ctm));
+ i--;
}
} else {
- for (mp = tp->t_members; mp != NULL; mp = mp->ml_next) {
+ for (mp = tp->t_members; mp != NULL && i > 0; mp = mp->ml_next) {
offset = strtab_insert(&b->ctb_strtab,
mp->ml_name);
@@ -431,6 +433,7 @@
}
ctf_buf_write(b, &ctlm, sizeof (ctlm));
+ i--;
}
}
break;
|