Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/cddl/osnet/dist/tools/ctf/cvt make too many struct ...



details:   https://anonhg.NetBSD.org/src/rev/452f12330943
branches:  trunk
changeset: 341148:452f12330943
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Oct 21 13:43:49 2015 +0000

description:
make too many struct or union members non-fatal.

diffstat:

 external/cddl/osnet/dist/tools/ctf/cvt/ctf.c |  11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diffs (45 lines):

diff -r dd691e5259ee -r 452f12330943 external/cddl/osnet/dist/tools/ctf/cvt/ctf.c
--- a/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c      Wed Oct 21 13:06:39 2015 +0000
+++ b/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c      Wed Oct 21 13:43:49 2015 +0000
@@ -387,8 +387,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)
@@ -399,7 +400,8 @@
                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);
 
@@ -413,9 +415,11 @@
                                        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);
 
@@ -435,6 +439,7 @@
                                }
 
                                ctf_buf_write(b, &ctlm, sizeof (ctlm));
+                               i--;
                        }
                }
                break;



Home | Main Index | Thread Index | Old Index