ctf.c (178546) | ctf.c (207578) |
---|---|
1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 341 unchanged lines hidden (view full) --- 350 } 351 } 352 break; 353 354 case ENUM: 355 for (i = 0, ep = tp->t_emem; ep != NULL; ep = ep->el_next) 356 i++; /* count up enum members */ 357 | 1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 341 unchanged lines hidden (view full) --- 350 } 351 } 352 break; 353 354 case ENUM: 355 for (i = 0, ep = tp->t_emem; ep != NULL; ep = ep->el_next) 356 i++; /* count up enum members */ 357 |
358 if (i > CTF_MAX_VLEN) { 359 warning("enum %s has too many values: %d > %d\n", 360 tdesc_name(tp), i, CTF_MAX_VLEN); 361 i = CTF_MAX_VLEN; 362 } 363 |
|
358 ctt.ctt_info = CTF_TYPE_INFO(CTF_K_ENUM, isroot, i); 359 write_sized_type_rec(b, &ctt, tp->t_size); 360 | 364 ctt.ctt_info = CTF_TYPE_INFO(CTF_K_ENUM, isroot, i); 365 write_sized_type_rec(b, &ctt, tp->t_size); 366 |
361 for (ep = tp->t_emem; ep != NULL; ep = ep->el_next) { | 367 for (ep = tp->t_emem; ep != NULL && i > 0; ep = ep->el_next) { |
362 offset = strtab_insert(&b->ctb_strtab, ep->el_name); 363 cte.cte_name = CTF_TYPE_NAME(CTF_STRTAB_0, offset); 364 cte.cte_value = ep->el_number; 365 ctf_buf_write(b, &cte, sizeof (cte)); | 368 offset = strtab_insert(&b->ctb_strtab, ep->el_name); 369 cte.cte_name = CTF_TYPE_NAME(CTF_STRTAB_0, offset); 370 cte.cte_value = ep->el_number; 371 ctf_buf_write(b, &cte, sizeof (cte)); |
372 i--; |
|
366 } 367 break; 368 369 case FORWARD: 370 ctt.ctt_info = CTF_TYPE_INFO(CTF_K_FORWARD, isroot, 0); 371 ctt.ctt_type = 0; 372 write_unsized_type_rec(b, &ctt); 373 break; --- 890 unchanged lines hidden --- | 373 } 374 break; 375 376 case FORWARD: 377 ctt.ctt_info = CTF_TYPE_INFO(CTF_K_FORWARD, isroot, 0); 378 ctt.ctt_type = 0; 379 write_unsized_type_rec(b, &ctt); 380 break; --- 890 unchanged lines hidden --- |