CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2021-03-31 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Wed Mar 31 06:26:27 UTC 2021

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: dwarf.c

Log Message:
Simplify the CTF float encoding type logic: all floating point types of
4 bytes or less are "float", 8 bytes or less are "double" and 16 bytes
or less are "long double".  Make ctfconvert much happier with N32 ABI
where we have 4 byte pointers and 16 byte long doubles.  Will also help
ctfconvert if ever used on m68k or 32-bit RISC-V.

@christos: LGTM


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.25 src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.26
--- src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.25	Mon May 28 21:05:06 2018
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c	Wed Mar 31 06:26:27 2021
@@ -1419,41 +1419,53 @@ die_base_name_parse(const char *name, ch
 	return (intr);
 }
 
+/*
+ * Return the CTF float encoding type.  The logic is all floating
+ * point types of 4 bytes or less are "float", 8 bytes or less are
+ * "double" and 16 bytes or less are "long double".  Anything bigger
+ * will error.
+ */
+#define	FLOAT_SIZE_SINGLE	 4
+#define	FLOAT_SIZE_DOUBLE	 8
+#define	FLOAT_SIZE_LONG_DOUBLE	16
+
 typedef struct fp_size_map {
-	size_t fsm_typesz[2];	/* size of {32,64} type */
+	size_t fsm_typesz;	/* size of type */
 	uint_t fsm_enc[3];	/* CTF_FP_* for {bare,cplx,imagry} type */
 } fp_size_map_t;
 
 static const fp_size_map_t fp_encodings[] = {
-	{ { 4, 4 }, { CTF_FP_SINGLE, CTF_FP_CPLX, CTF_FP_IMAGRY } },
-	{ { 8, 8 }, { CTF_FP_DOUBLE, CTF_FP_DCPLX, CTF_FP_DIMAGRY } },
-#ifdef __sparc
-	{ { 16, 16 }, { CTF_FP_LDOUBLE, CTF_FP_LDCPLX, CTF_FP_LDIMAGRY } },
-#else
-	{ { 12, 16 }, { CTF_FP_LDOUBLE, CTF_FP_LDCPLX, CTF_FP_LDIMAGRY } },
-#endif
-	{ { 0, 0 }, { 0, 0, 0 } }
+	{ FLOAT_SIZE_SINGLE, { CTF_FP_SINGLE, CTF_FP_CPLX, CTF_FP_IMAGRY } },
+	{ FLOAT_SIZE_DOUBLE, { CTF_FP_DOUBLE, CTF_FP_DCPLX, CTF_FP_DIMAGRY } },
+	{ FLOAT_SIZE_LONG_DOUBLE,
+	{ CTF_FP_LDOUBLE, CTF_FP_LDCPLX, CTF_FP_LDIMAGRY } },
+	{ 0, { 0, 0, 0 } }
 };
 
 static uint_t
 die_base_type2enc(dwarf_t *dw, Dwarf_Off off, Dwarf_Signed enc, size_t sz)
 {
 	const fp_size_map_t *map = fp_encodings;
-	uint_t szidx = dw->dw_ptrsz == sizeof (uint64_t);
 	uint_t mult = 1, col = 0;
 
-	if (enc == DW_ATE_complex_float) {
+	switch (enc) {
+	case DW_ATE_complex_float:
+#if defined(DW_ATE_SUN_interval_float)
+	case DW_ATE_SUN_interval_float:
+#endif
 		mult = 2;
 		col = 1;
-	} else if (enc == DW_ATE_imaginary_float
-#if defined(sun)
-	|| enc == DW_ATE_SUN_imaginary_float
+		break;
+	case DW_ATE_imaginary_float:
+#if defined(DW_ATE_SUN_imaginary_float)
+	case DW_ATE_SUN_imaginary_float:
 #endif
-	)
 		col = 2;
+		break;
+	}
 
-	while (map->fsm_typesz[szidx] != 0) {
-		if (map->fsm_typesz[szidx] * mult == sz)
+	while (map->fsm_typesz != 0) {
+		if (sz <= map->fsm_typesz * mult)
 			return (map->fsm_enc[col]);
 		map++;
 	}



CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2020-03-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Mar  5 16:05:06 UTC 2020

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: fixup_tdescs.c

Log Message:
Revert "Add fixup operation to remove private mutex types for x86."

The x86 (and arm) definitions of struct kmutex are no longer defined
differently depending on __MUTEX_PRIVATE.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 \
src/external/cddl/osnet/dist/tools/ctf/cvt/fixup_tdescs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/fixup_tdescs.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/fixup_tdescs.c:1.5 src/external/cddl/osnet/dist/tools/ctf/cvt/fixup_tdescs.c:1.6
--- src/external/cddl/osnet/dist/tools/ctf/cvt/fixup_tdescs.c:1.5	Tue Jul 16 07:27:35 2019
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/fixup_tdescs.c	Thu Mar  5 16:05:05 2020
@@ -280,48 +280,6 @@ fix_small_cpu_struct(tdata_t *td, size_t
 #ifdef __NetBSD__
 
 /*
- * The kmutex structure comes in two flavours, with or without __MUTEX_PRIVATE
- * defined.  Since many structures include kmutexes this causes massive amounts
- * of duplication on merge (~ 40% for a GENERIC kernel).  Remove the private
- * fields if we see them.
- */
-static void
-fix_kmutex_private(tdata_t *td, size_t ptrsize)
-{
-	tdesc_t *desc;
-	mlist_t *ml;
-
-	/*
-	 * X86 kmutex is either
-	 *	union {
-	 *		volatile uintptr_t mtxa_owner;
-	 *	} u
-	 * or
-	 *	union {
-	 *		volatile uintptr_t mtxa_owner;
-	 *		struct {
-	 *			...
-	 *		} s;
-	 *	} u
-	 * so we remove "struct s" if we find it.
-	 */
-	if ((desc = lookup_tdesc(td, "kmutex")) != NULL &&
-	desc->t_type == STRUCT &&
-	(ml = desc->t_members) != NULL &&
-	streq(ml->ml_name, "u") &&
-	(desc = ml->ml_type) != NULL &&
-	desc->t_type == UNION &&
-	(ml = desc->t_members) != NULL &&
-	streq(ml->ml_name, "mtxa_owner") &&
-	(ml = ml->ml_next) != NULL &&
-	streq(ml->ml_name, "s") &&
-	ml->ml_next == NULL) {
-		/* Found, delete member "s". */
-		desc->t_members->ml_next = NULL;
-	}
-}
-
-/*
  * XXX: A crude hack to bring down the number of types for a
  * GENRIC kernel below 2**15-1 (from ~34000 to ~29800).
  *
@@ -377,7 +335,6 @@ cvt_fixups(tdata_t *td, size_t ptrsize)
 {
 	fix_small_cpu_struct(td, ptrsize);
 #ifdef __NetBSD__
-	fix_kmutex_private(td, ptrsize);
 	fix_kill_attr(td, ptrsize);
 #endif
 }



CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2017-12-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Dec 31 03:08:49 UTC 2017

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: dwarf.c

Log Message:
add trivial handling for DW_ATE_UTF, does not work.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.23 src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.24
--- src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.23	Wed Jun  8 17:32:27 2016
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c	Sat Dec 30 22:08:49 2017
@@ -1536,6 +1536,12 @@ die_base_from_dwarf(dwarf_t *dw, Dwarf_D
 		intr->intr_signed = 1;
 		intr->intr_fformat = die_base_type2enc(dw, off, enc, sz);
 		break;
+	case DW_ATE_UTF:
+		// XXX: c++ char16_t/char32_t; we don't deal with it.
+		intr->intr_type = INTR_INT;
+		intr->intr_signed = 1;
+		intr->intr_iformat = 'v';
+		break;
 	default:
 		terminate("die %ju: unknown base type encoding 0x%jx\n",
 		(uintmax_t)off, (uintmax_t)enc);



CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2016-06-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jun  8 21:32:27 UTC 2016

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: dwarf.c

Log Message:
Grr, gcc-5.4 creates DW_AT_typedef without DW_AT_type for HARD_REG_SET!

 <1>: Abbrev Number: 4 (DW_TAG_typedef)
   DW_AT_name: (indirect string, offset: 0x16e30): 
HARD_REG_ELT_TYPE
   DW_AT_decl_file   : 57
   DW_AT_decl_line   : 43
   DW_AT_type: <0x70>
 <1>: Abbrev Number: 102 (DW_TAG_typedef)
   DW_AT_name: (indirect string, offset: 0x2f954): 
HARD_REG_SET
   DW_AT_decl_file   : 57
   DW_AT_decl_line   : 54


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.22 src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.23
--- src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.22	Fri Mar 18 13:07:23 2016
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c	Wed Jun  8 17:32:27 2016
@@ -1224,8 +1224,18 @@ die_sou_resolve(tdesc_t *tdp, tdesc_t **
 			(mt->t_name == NULL || mt->t_name[0] == '\0'))
 			continue;
 
-			printf("%s unresolved type = %d (%s)\n", tdesc_name(tdp),
-mt->t_type, tdesc_name(mt));
+			/*
+			 * XXX: Gcc-5.4 DW_TAG_typedef without DW_AT_type;
+			 * assume pointer
+			 */
+			if (mt->t_id == TID_VOID) {
+			ml->ml_size = dw->dw_ptrsz;
+			continue;
+			}
+
+			fprintf(stderr, "%s unresolved type=%d (%s) tid=%#x\n", 
+			tdesc_name(tdp), mt->t_type, tdesc_name(mt),
+			mt->t_id);
 			dw->dw_nunres++;
 			return (1);
 		}



CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2016-04-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr 10 23:37:10 UTC 2016

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: merge.c

Log Message:
Apply revision 274569 from FreeBSD:
Only compare visitation counters if they've both been set for the current
type graph walk.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/cddl/osnet/dist/tools/ctf/cvt/merge.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/merge.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/merge.c:1.6 src/external/cddl/osnet/dist/tools/ctf/cvt/merge.c:1.7
--- src/external/cddl/osnet/dist/tools/ctf/cvt/merge.c:1.6	Fri Mar 18 13:07:23 2016
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/merge.c	Sun Apr 10 19:37:10 2016
@@ -361,7 +361,7 @@ equiv_node(tdesc_t *ctdp, tdesc_t *mtdp,
 	int (*equiv)(tdesc_t *, tdesc_t *, equiv_data_t *);
 	int mapping;
 
-	if (ctdp->t_emark > ed->ed_clear_mark ||
+	if (ctdp->t_emark > ed->ed_clear_mark &&
 	mtdp->t_emark > ed->ed_clear_mark)
 		return (ctdp->t_emark == mtdp->t_emark);
 



CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2016-03-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Mar 18 17:07:23 UTC 2016

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: ctftools.h dwarf.c merge.c
output.c tdata.c traverse.c

Log Message:
Add support for c++ classes.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 \
src/external/cddl/osnet/dist/tools/ctf/cvt/ctftools.h
cvs rdiff -u -r1.21 -r1.22 src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c
cvs rdiff -u -r1.5 -r1.6 src/external/cddl/osnet/dist/tools/ctf/cvt/merge.c \
src/external/cddl/osnet/dist/tools/ctf/cvt/traverse.c
cvs rdiff -u -r1.7 -r1.8 src/external/cddl/osnet/dist/tools/ctf/cvt/output.c \
src/external/cddl/osnet/dist/tools/ctf/cvt/tdata.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/ctftools.h
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/ctftools.h:1.6 src/external/cddl/osnet/dist/tools/ctf/cvt/ctftools.h:1.7
--- src/external/cddl/osnet/dist/tools/ctf/cvt/ctftools.h:1.6	Fri Mar 18 10:55:34 2016
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/ctftools.h	Fri Mar 18 13:07:23 2016
@@ -142,6 +142,7 @@ typedef enum stabtype {
 	FUNCTION,
 	STRUCT,
 	UNION,
+	CLASS,
 	ENUM,
 	FORWARD,
 	TYPEDEF,

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.21 src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.22
--- src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.21	Fri Mar 18 12:32:03 2016
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c	Fri Mar 18 13:07:23 2016
@@ -186,6 +186,7 @@ tdesc_size(tdesc_t *tdp)
 		case FUNCTION:
 		case STRUCT:
 		case UNION:
+		case CLASS:
 		case ENUM:
 			return (tdp->t_size);
 
@@ -223,6 +224,7 @@ tdesc_bitsize(tdesc_t *tdp)
 		case FUNCTION:
 		case STRUCT:
 		case UNION:
+		case CLASS:
 		case ENUM:
 		case POINTER:
 		case REFERENCE:
@@ -1162,6 +1164,12 @@ die_union_create(dwarf_t *dw, Dwarf_Die 
 	die_sou_create(dw, die, off, tdp, UNION, "union");
 }
 
+static void
+die_class_create(dwarf_t *dw, Dwarf_Die die, Dwarf_Off off, tdesc_t *tdp)
+{
+	die_sou_create(dw, die, off, tdp, CLASS, "class");
+}
+
 /*ARGSUSED1*/
 static int
 die_sou_resolve(tdesc_t *tdp, tdesc_t **tdpp __unused, void *private)
@@ -1196,7 +1204,8 @@ die_sou_resolve(tdesc_t *tdp, tdesc_t **
 			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))
+			(mt->t_type == STRUCT || mt->t_type == UNION ||
+			 mt->t_type == CLASS))
 continue;
 
 			if (mt->t_type == STRUCT && 
@@ -1819,6 +1828,7 @@ static const die_creator_t die_creators[
 	{ DW_TAG_subroutine_type,	0,		die_funcptr_create },
 	{ DW_TAG_typedef,		0,		die_typedef_create },
 	{ DW_TAG_union_type,		0,		die_union_create },
+	{ DW_TAG_class_type,		0,		die_class_create },
 	{ DW_TAG_base_type,		0,		die_base_create },
 	{ DW_TAG_const_type,		0,		die_const_create },
 	{ DW_TAG_subprogram,		DW_F_NOTDP,	die_function_create },
@@ -1895,6 +1905,7 @@ static tdtrav_cb_f die_resolvers[] = {
 	NULL,			/* function */
 	die_sou_resolve,	/* struct */
 	die_sou_resolve,	/* union */
+	die_sou_resolve,	/* class */
 	die_enum_resolve,	/* enum */
 	die_fwd_resolve,	/* forward */
 	NULL,			/* typedef */
@@ -1913,6 +1924,7 @@ static tdtrav_cb_f die_fail_reporters[] 
 	NULL,			/* function */
 	die_sou_failed,		/* struct */
 	die_sou_failed,		/* union */
+	die_sou_failed,		/* class */
 	NULL,			/* enum */
 	NULL,			/* forward */
 	NULL,			/* typedef */

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/merge.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/merge.c:1.5 src/external/cddl/osnet/dist/tools/ctf/cvt/merge.c:1.6
--- src/external/cddl/osnet/dist/tools/ctf/cvt/merge.c:1.5	Fri Mar 18 10:55:34 2016
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/merge.c	Fri Mar 18 13:07:23 2016
@@ -548,6 +548,7 @@ static tdtrav_cb_f map_pre[] = {
 	map_td_tree_pre,	/* function */
 	map_td_tree_pre,	/* struct */
 	map_td_tree_pre,	/* union */
+	map_td_tree_pre,	/* class */
 	map_td_tree_pre,	/* enum */
 	map_td_tree_pre,	/* forward */
 	map_td_tree_pre,	/* typedef */
@@ -566,6 +567,7 @@ static tdtrav_cb_f map_post[] = {
 	map_td_tree_post,	/* function */
 	map_td_tree_post,	/* struct */
 	map_td_tree_post,	/* union */
+	map_td_tree_post,	/* class */
 	map_td_tree_post,	/* enum */
 	map_td_tree_post,	/* forward */
 	map_td_tree_post,	/* typedef */
@@ -584,6 +586,7 @@ static tdtrav_cb_f map_self_post[] = {
 	map_td_tree_self_post,	/* function */
 	map_td_tree_self_post,	/* struct */
 	map_td_tree_self_post,	/* union */
+	map_td_tree_self_post,	/* class */
 	map_td_tree_self_post,	/* enum */
 	map_td_tree_self_post,	/* forward */
 	map_td_tree_self_post,	/* typedef */
@@ -901,6 +904,7 @@ static tdtrav_cb_f fwd_redir_cbs[] = {
 	NULL,			/* function */
 	NULL,			

CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2016-03-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Mar 18 17:08:45 UTC 2016

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: ctf.c

Log Message:
treat class line struct and union


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c:1.11 src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c:1.12
--- src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c:1.11	Fri Mar 18 09:23:00 2016
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c	Fri Mar 18 13:08:45 2016
@@ -383,6 +383,7 @@ write_type(void *arg1, void *arg2)
 
 	case STRUCT:
 	case UNION:
+	case CLASS:
 		for (i = 0, mp = tp->t_members; mp != NULL; mp = mp->ml_next)
 			i++; /* count up struct or union members */
 



CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2016-03-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Mar 18 16:37:09 UTC 2016

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: tdata.c

Log Message:
spell restrict


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/cddl/osnet/dist/tools/ctf/cvt/tdata.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/tdata.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/tdata.c:1.6 src/external/cddl/osnet/dist/tools/ctf/cvt/tdata.c:1.7
--- src/external/cddl/osnet/dist/tools/ctf/cvt/tdata.c:1.6	Fri Mar 18 12:24:26 2016
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/tdata.c	Fri Mar 18 12:37:09 2016
@@ -249,7 +249,7 @@ static void (*free_cbs[])(tdesc_t *) = {
 	NULL,		/* typedef_unres */
 	NULL,		/* volatile */
 	NULL,		/* const */
-	NULL		/* restric */
+	NULL		/* restrict */
 };
 
 /*ARGSUSED1*/



CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2016-03-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar 17 03:05:55 UTC 2016

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: st_parse.c

Log Message:
Avoid longjmp clobbering


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 \
src/external/cddl/osnet/dist/tools/ctf/cvt/st_parse.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/st_parse.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/st_parse.c:1.6 src/external/cddl/osnet/dist/tools/ctf/cvt/st_parse.c:1.7
--- src/external/cddl/osnet/dist/tools/ctf/cvt/st_parse.c:1.6	Thu Feb  4 12:40:55 2016
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/st_parse.c	Wed Mar 16 23:05:55 2016
@@ -403,7 +403,7 @@ parse_sou(char *cp, iidesc_t *idp)
 }
 
 int
-parse_stab(stab_t *stab, char *cp, iidesc_t **iidescp)
+parse_stab(stab_t *stab, char * volatile cp, iidesc_t **iidescp)
 {
 	iidesc_t *ii = NULL;
 	iitype_t (*parse)(char *, iidesc_t *);



CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2016-03-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Mar 18 16:32:04 UTC 2016

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: dwarf.c

Log Message:
fix printf format


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.20 src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.21
--- src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.20	Fri Mar 18 10:55:34 2016
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c	Fri Mar 18 12:32:03 2016
@@ -800,7 +800,7 @@ die_array_resolve(tdesc_t *tdp, tdesc_t 
 	if (tdp->t_flags & TDESC_F_RESOLVED)
 		return (1);
 
-	debug(3, "trying to resolve array %#x (cont %#x/%zu)\n", tdp->t_id,
+	debug(3, "trying to resolve array %#x (cont %#x/%d)\n", tdp->t_id,
 	tdp->t_ardef->ad_contents->t_id,
 	tdp->t_ardef->ad_contents->t_size);
 



CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2016-03-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Mar 18 14:55:34 UTC 2016

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: ctftools.h dwarf.c merge.c
traverse.c

Log Message:
- Add processing for c++ references.
- Make sure we load the DIE that contains the types of array elements so
  we can resolve them later.
- Print t_id (die offsets) in hex.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 \
src/external/cddl/osnet/dist/tools/ctf/cvt/ctftools.h
cvs rdiff -u -r1.19 -r1.20 src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c
cvs rdiff -u -r1.4 -r1.5 src/external/cddl/osnet/dist/tools/ctf/cvt/merge.c \
src/external/cddl/osnet/dist/tools/ctf/cvt/traverse.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/ctftools.h
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/ctftools.h:1.5 src/external/cddl/osnet/dist/tools/ctf/cvt/ctftools.h:1.6
--- src/external/cddl/osnet/dist/tools/ctf/cvt/ctftools.h:1.5	Thu Feb  4 12:40:55 2016
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/ctftools.h	Fri Mar 18 10:55:34 2016
@@ -137,6 +137,7 @@ typedef enum stabtype {
 	STABTYPE_FIRST, /* do not use */
 	INTRINSIC,
 	POINTER,
+	REFERENCE,
 	ARRAY,
 	FUNCTION,
 	STRUCT,

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.19 src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.20
--- src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.19	Tue Mar  1 09:52:14 2016
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c	Fri Mar 18 10:55:34 2016
@@ -181,6 +181,7 @@ tdesc_size(tdesc_t *tdp)
 		switch (tdp->t_type) {
 		case INTRINSIC:
 		case POINTER:
+		case REFERENCE:
 		case ARRAY:
 		case FUNCTION:
 		case STRUCT:
@@ -189,6 +190,7 @@ tdesc_size(tdesc_t *tdp)
 			return (tdp->t_size);
 
 		case FORWARD:
+			debug(3, "type is forward for %#x\n", tdp->t_id);
 			return (0);
 
 		case TYPEDEF:
@@ -199,10 +201,11 @@ tdesc_size(tdesc_t *tdp)
 			continue;
 
 		case 0: /* not yet defined */
+			debug(3, "type is undefined for %#x\n", tdp->t_id);
 			return (0);
 
 		default:
-			terminate("tdp %u: tdesc_size on unknown type %d\n",
+			terminate("tdp %u: tdesc_size on unknown type %#x\n",
 			tdp->t_id, tdp->t_type);
 		}
 	}
@@ -222,9 +225,11 @@ tdesc_bitsize(tdesc_t *tdp)
 		case UNION:
 		case ENUM:
 		case POINTER:
+		case REFERENCE:
 			return (tdp->t_size * NBBY);
 
 		case FORWARD:
+			debug(3, "bitsize is forward for %d\n", tdp->t_id);
 			return (0);
 
 		case TYPEDEF:
@@ -235,6 +240,7 @@ tdesc_bitsize(tdesc_t *tdp)
 			continue;
 
 		case 0: /* not yet defined */
+			debug(3, "bitsize is undefined for %d\n", tdp->t_id);
 			return (0);
 
 		default:
@@ -664,10 +670,12 @@ tdesc_array_create(dwarf_t *dw, Dwarf_Di
 
 	if ((dim2 = die_sibling(dw, dim)) == NULL) {
 		ctdp = arrtdp;
+		debug(3, "die %ju: sibling type %#x for dimension\n",
+		(uintmax_t)die_off(dw, dim), ctdp->t_id);
 	} else if (die_tag(dw, dim2) == DW_TAG_subrange_type) {
 		ctdp = xcalloc(sizeof (tdesc_t));
 		ctdp->t_id = mfgtid_next(dw);
-		debug(3, "die %ju: creating new type %u for sub-dimension\n",
+		debug(3, "die %ju: creating new type %#x for sub-dimension\n",
 		(uintmax_t)die_off(dw, dim2), ctdp->t_id);
 		tdesc_array_create(dw, dim2, arrtdp, ctdp);
 	} else {
@@ -706,6 +714,8 @@ tdesc_array_create(dwarf_t *dw, Dwarf_Di
 	 */
 	ar->ad_idxtype = tdesc_intr_long(dw);
 	ar->ad_contents = ctdp;
+	debug(3, "die %ju: hi mom sibling type %#x for dimension\n",
+	(uintmax_t)die_off(dw, dim), ctdp->t_id);
 
 	if (ar->ad_contents->t_size != 0) {
 		dimtdp->t_size = ar->ad_contents->t_size * ar->ad_nelems;
@@ -733,6 +743,17 @@ die_array_create(dwarf_t *dw, Dwarf_Die 
 		terminate("die %ju: failed to retrieve array bounds\n",
 		(uintmax_t)off);
 
+	if (arrtdp->t_type == 0) {
+		/*
+		 * Add the die that contains the type of the array elements
+		 * to the the ones we process; XXX: no public API for that?
+		 */
+		extern Dwarf_Die _dwarf_die_find(Dwarf_Die, Dwarf_Unsigned);
+		Dwarf_Die elem = _dwarf_die_find(arr, arrtdp->t_id);
+		if (elem != NULL)
+		die_create_one(dw, elem);
+	}
+
 	tdesc_array_create(dw, dim, arrtdp, tdp);
 
 	if (die_unsigned(dw, arr, DW_AT_byte_size, , 0)) {
@@ -779,12 +800,13 @@ die_array_resolve(tdesc_t *tdp, tdesc_t 
 	if (tdp->t_flags & TDESC_F_RESOLVED)
 		return (1);
 
-	debug(3, "trying to resolve array %d (cont %d)\n", tdp->t_id,
-	tdp->t_ardef->ad_contents->t_id);
+	debug(3, "trying to resolve array %#x (cont %#x/%zu)\n", tdp->t_id,
+	tdp->t_ardef->ad_contents->t_id,
+	tdp->t_ardef->ad_contents->t_size);
 
 	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",
+		debug(3, "unable to resolve array %s (%#x) 

CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2016-03-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Mar 18 13:23:00 UTC 2016

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: ctf.c

Log Message:
swap first, then write.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c:1.10 src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c:1.11
--- src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c:1.10	Thu Feb  4 12:40:55 2016
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c	Fri Mar 18 09:23:00 2016
@@ -173,12 +173,12 @@ write_objects(iidesc_t *idp, ctf_buf_t *
 {
 	ushort_t id = (idp ? idp->ii_dtype->t_id : 0);
 
-	ctf_buf_write(b, , sizeof (id));
-
 	if (target_requires_swap) {
 		SWAP_16(id);
 	}
 
+	ctf_buf_write(b, , sizeof (id));
+
 	debug(3, "Wrote object %s (%d)\n", (idp ? idp->ii_name : "(null)"), id);
 }
 



CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2016-03-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Mar 18 16:24:27 UTC 2016

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: tdata.c

Log Message:
Add references, comments.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/cddl/osnet/dist/tools/ctf/cvt/tdata.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/tdata.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/tdata.c:1.5 src/external/cddl/osnet/dist/tools/ctf/cvt/tdata.c:1.6
--- src/external/cddl/osnet/dist/tools/ctf/cvt/tdata.c:1.5	Fri Mar 18 12:12:46 2016
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/tdata.c	Fri Mar 18 12:24:26 2016
@@ -236,19 +236,20 @@ free_elist(tdesc_t *tdp)
 
 static void (*free_cbs[])(tdesc_t *) = {
 	NULL,
-	free_intr,
-	NULL,
-	free_ardef,
-	NULL,
-	free_mlist,
-	free_mlist,
-	free_elist,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	NULL
+	free_intr,	/* intrinsic */
+	NULL,		/* pointer */
+	NULL,		/* reference */
+	free_ardef,	/* array */
+	NULL,		/* function */
+	free_mlist,	/* struct */
+	free_mlist,	/* union */
+	free_elist,	/* enum */
+	NULL,		/* forward */
+	NULL,		/* typedef */
+	NULL,		/* typedef_unres */
+	NULL,		/* volatile */
+	NULL,		/* const */
+	NULL		/* restric */
 };
 
 /*ARGSUSED1*/



CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2016-03-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Mar 18 15:26:31 UTC 2016

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: output.c

Log Message:
Add references.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/cddl/osnet/dist/tools/ctf/cvt/output.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/output.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/output.c:1.6 src/external/cddl/osnet/dist/tools/ctf/cvt/output.c:1.7
--- src/external/cddl/osnet/dist/tools/ctf/cvt/output.c:1.6	Tue Sep 29 16:43:16 2015
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/output.c	Fri Mar 18 11:26:31 2016
@@ -104,6 +104,7 @@ static tdtrav_cb_f burst_types_cbs[] = {
 	NULL,
 	save_type_by_id,	/* intrinsic */
 	save_type_by_id,	/* pointer */
+	save_type_by_id,	/* reference */
 	save_type_by_id,	/* array */
 	save_type_by_id,	/* function */
 	save_type_by_id,	/* struct */



CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2016-03-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Mar 18 16:12:47 UTC 2016

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: tdata.c

Log Message:
add references.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/cddl/osnet/dist/tools/ctf/cvt/tdata.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/tdata.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/tdata.c:1.4 src/external/cddl/osnet/dist/tools/ctf/cvt/tdata.c:1.5
--- src/external/cddl/osnet/dist/tools/ctf/cvt/tdata.c:1.4	Sat Feb 27 18:43:53 2010
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/tdata.c	Fri Mar 18 12:12:46 2016
@@ -433,6 +433,7 @@ static tdtrav_cb_f build_hashes_cbs[] = 
 	NULL,
 	build_hashes,	/* intrinsic */
 	build_hashes,	/* pointer */
+	build_hashes,	/* reference */
 	build_hashes,	/* array */
 	build_hashes,	/* function */
 	build_hashes,	/* struct */



CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2016-03-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Mar 18 17:11:04 UTC 2016

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: ctf.c

Log Message:
write references as pointers XXX:


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c:1.12 src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c:1.13
--- src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c:1.12	Fri Mar 18 13:08:45 2016
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c	Fri Mar 18 13:11:04 2016
@@ -361,6 +361,7 @@ write_type(void *arg1, void *arg2)
 		break;
 
 	case POINTER:
+	case REFERENCE:	/* XXX: */
 		ctt.ctt_info = CTF_TYPE_INFO(CTF_K_POINTER, isroot, 0);
 		ctt.ctt_type = tp->t_tdesc->t_id;
 		write_unsized_type_rec(b, );



CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2016-03-01 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Tue Mar  1 14:52:14 UTC 2016

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: dwarf.c

Log Message:
Merge r274564 from FreeBSD:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.18 src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.19
--- src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.18	Sun Feb 21 13:33:47 2016
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c	Tue Mar  1 14:52:14 2016
@@ -782,7 +782,8 @@ die_array_resolve(tdesc_t *tdp, tdesc_t 
 	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);
@@ -1164,12 +1165,17 @@ die_sou_resolve(tdesc_t *tdp, tdesc_t **
 
 			/*
 			 * 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;
 
 			if (mt->t_type == STRUCT && 
 mt->t_members != NULL &&



CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2016-02-21 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sun Feb 21 13:33:47 UTC 2016

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: dwarf.c

Log Message:
Keep the if chain going.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.17 src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.18
--- src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.17	Sat Feb 20 23:09:03 2016
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c	Sun Feb 21 13:33:47 2016
@@ -693,7 +693,7 @@ tdesc_array_create(dwarf_t *dw, Dwarf_Di
 		ar->ad_nelems = uval + 1;
 	else if (die_signed(dw, dim, DW_AT_upper_bound, , 0))
 		ar->ad_nelems = sval + 1;
-	if (die_unsigned(dw, dim, DW_AT_count, , 0))
+	else if (die_unsigned(dw, dim, DW_AT_count, , 0))
 		ar->ad_nelems = uval + 1;
 	else if (die_signed(dw, dim, DW_AT_count, , 0))
 		ar->ad_nelems = sval + 1;



CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2016-02-20 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sat Feb 20 23:09:03 UTC 2016

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: dwarf.c

Log Message:
Clang 3.7 and newer provide the array size via DW_AT_count, not via
DW_AT_upper_bound. Recognize the former as well as the latter.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.16 src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.17
--- src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.16	Sat Feb 20 02:39:47 2016
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c	Sat Feb 20 23:09:03 2016
@@ -693,6 +693,10 @@ tdesc_array_create(dwarf_t *dw, Dwarf_Di
 		ar->ad_nelems = uval + 1;
 	else if (die_signed(dw, dim, DW_AT_upper_bound, , 0))
 		ar->ad_nelems = sval + 1;
+	if (die_unsigned(dw, dim, DW_AT_count, , 0))
+		ar->ad_nelems = uval + 1;
+	else if (die_signed(dw, dim, DW_AT_count, , 0))
+		ar->ad_nelems = sval + 1;
 	else
 		ar->ad_nelems = 0;
 



CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2016-02-20 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sat Feb 20 22:08:44 UTC 2016

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: ctfconvert.c ctfmerge.c

Log Message:
Don't nuke input on errors, it makes debugging a nightmare.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/external/cddl/osnet/dist/tools/ctf/cvt/ctfconvert.c
cvs rdiff -u -r1.14 -r1.15 \
src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/ctfconvert.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/ctfconvert.c:1.4 src/external/cddl/osnet/dist/tools/ctf/cvt/ctfconvert.c:1.5
--- src/external/cddl/osnet/dist/tools/ctf/cvt/ctfconvert.c:1.4	Thu Feb  4 17:40:55 2016
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/ctfconvert.c	Sat Feb 20 22:08:44 2016
@@ -68,7 +68,7 @@ usage(void)
 static void
 terminate_cleanup(void)
 {
-#if !defined(__FreeBSD__)
+#if 0
 	if (!outfile) {
 		fprintf(stderr, "Removing %s\n", infile);
 		unlink(infile);

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c:1.14 src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c:1.15
--- src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c:1.14	Thu Feb  4 17:47:43 2016
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c	Sat Feb 20 22:08:44 2016
@@ -624,7 +624,7 @@ terminate_cleanup(void)
 	if (outfile == NULL)
 		return;
 
-#if !defined(__FreeBSD__)
+#if 0
 	if (dounlink) {
 		fprintf(stderr, "Removing %s\n", outfile);
 		unlink(outfile);



CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2016-02-20 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sat Feb 20 21:50:02 UTC 2016

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: strtab.c

Log Message:
Shuffle include order to avoid missing free on glibc.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/cddl/osnet/dist/tools/ctf/cvt/strtab.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/strtab.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/strtab.c:1.2 src/external/cddl/osnet/dist/tools/ctf/cvt/strtab.c:1.3
--- src/external/cddl/osnet/dist/tools/ctf/cvt/strtab.c:1.2	Sun Feb 21 00:49:56 2010
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/strtab.c	Sat Feb 20 21:50:02 2016
@@ -28,8 +28,8 @@
 
 #include 
 #include 
-#include 
 #include 
+#include 
 #include 
 
 #include "strtab.h"



CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2016-02-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Feb 20 02:39:47 UTC 2016

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: dwarf.c

Log Message:
- don't barf if the object does not have DWARF debug data.
- bump size of types to 1K to avoid string overflow
(both are needed for the new elftoolchain).


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.15 src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.16
--- src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.15	Sun Dec 27 16:38:46 2015
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c	Fri Feb 19 21:39:47 2016
@@ -1325,7 +1325,7 @@ die_funcptr_create(dwarf_t *dw, Dwarf_Di
 static intr_t *
 die_base_name_parse(const char *name, char **newp)
 {
-	char buf[100];
+	char buf[1024];
 	char const *base;
 	char *c;
 	int nlong = 0, nshort = 0, nchar = 0, nint = 0;
@@ -2019,8 +2019,15 @@ dw_read(tdata_t *td, Elf *elf, char *fil
 	}
 
 	if ((rc = dwarf_next_cu_header_b(dw.dw_dw, , , ,
-	, , NULL, , _err)) != DW_DLV_OK)
+	, , NULL, , _err)) != DW_DLV_OK) {
+		if (dwarf_errno(dw.dw_err) == DW_DLE_NO_ENTRY) {
+			/*
+			 * There's no DWARF section...
+			 */
+			return (0);
+		}
 		terminate("rc = %d %s\n", rc, dwarf_errmsg(dw.dw_err));
+	}
 
 	if ((cu = die_sibling(, NULL)) == NULL)
 		goto out;



CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2016-02-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Feb 13 21:37:12 UTC 2016

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: barrier.c

Log Message:
reduce ifdefs


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/cddl/osnet/dist/tools/ctf/cvt/barrier.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/barrier.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/barrier.c:1.2 src/external/cddl/osnet/dist/tools/ctf/cvt/barrier.c:1.3
--- src/external/cddl/osnet/dist/tools/ctf/cvt/barrier.c:1.2	Sat Feb 20 19:49:55 2010
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/barrier.c	Sat Feb 13 16:37:12 2016
@@ -40,6 +40,11 @@
 #include 
 #if defined(sun)
 #include 
+#else
+#define USYNC_THREAD 1
+#define sema_init(a, b, c, d)	sem_init((a), (c) != USYNC_THREAD, (b))
+#define sema_wait(a)		sem_wait(a)
+#define sema_post(a)		sem_post(a)
 #endif
 #include 
 
@@ -49,12 +54,7 @@ void
 barrier_init(barrier_t *bar, int nthreads)
 {
 	pthread_mutex_init(>bar_lock, NULL);
-#if defined(sun)
 	sema_init(>bar_sem, 0, USYNC_THREAD, NULL);
-#else
-	sem_init(>bar_sem, 0, 0);
-#endif
-
 	bar->bar_numin = 0;
 	bar->bar_nthr = nthreads;
 }
@@ -66,12 +66,7 @@ barrier_wait(barrier_t *bar)
 
 	if (++bar->bar_numin < bar->bar_nthr) {
 		pthread_mutex_unlock(>bar_lock);
-#if defined(sun)
 		sema_wait(>bar_sem);
-#else
-		sem_wait(>bar_sem);
-#endif
-
 		return (0);
 
 	} else {
@@ -80,11 +75,7 @@ barrier_wait(barrier_t *bar)
 		/* reset for next use */
 		bar->bar_numin = 0;
 		for (i = 1; i < bar->bar_nthr; i++)
-#if defined(sun)
 			sema_post(>bar_sem);
-#else
-			sem_post(>bar_sem);
-#endif
 		pthread_mutex_unlock(>bar_lock);
 
 		return (1);



CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2016-02-04 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Thu Feb  4 17:40:55 UTC 2016

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: ctf.c ctfconvert.c
ctftools.h st_parse.c

Log Message:
More printflike and dead fixes.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c
cvs rdiff -u -r1.3 -r1.4 \
src/external/cddl/osnet/dist/tools/ctf/cvt/ctfconvert.c
cvs rdiff -u -r1.4 -r1.5 \
src/external/cddl/osnet/dist/tools/ctf/cvt/ctftools.h
cvs rdiff -u -r1.5 -r1.6 \
src/external/cddl/osnet/dist/tools/ctf/cvt/st_parse.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c:1.9 src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c:1.10
--- src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c:1.9	Wed Oct 21 13:43:49 2015
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c	Thu Feb  4 17:40:55 2016
@@ -81,7 +81,7 @@ struct ctf_buf {
 static int target_requires_swap;
 
 /*PRINTFLIKE1*/
-static void __printflike(1, 2)
+static void __printflike(1, 2) __dead
 parseterminate(const char *fmt, ...)
 {
 	static char msgbuf[1024]; /* sigh */

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/ctfconvert.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/ctfconvert.c:1.3 src/external/cddl/osnet/dist/tools/ctf/cvt/ctfconvert.c:1.4
--- src/external/cddl/osnet/dist/tools/ctf/cvt/ctfconvert.c:1.3	Wed Feb 24 21:53:26 2010
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/ctfconvert.c	Thu Feb  4 17:40:55 2016
@@ -76,7 +76,7 @@ terminate_cleanup(void)
 #endif
 }
 
-static void
+static void __dead
 handle_sig(int sig)
 {
 	terminate("Caught signal %d - exiting\n", sig);

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/ctftools.h
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/ctftools.h:1.4 src/external/cddl/osnet/dist/tools/ctf/cvt/ctftools.h:1.5
--- src/external/cddl/osnet/dist/tools/ctf/cvt/ctftools.h:1.4	Sat Feb  7 20:30:03 2015
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/ctftools.h	Thu Feb  4 17:40:55 2016
@@ -440,11 +440,11 @@ int findelfsecidx(Elf *, const char *, c
 size_t elf_ptrsz(Elf *);
 char *mktmpname(const char *, const char *);
 void terminate(const char *, ...) __printflike(1, 2) __dead;
-void aborterr(const char *, ...) __printflike(1, 2);
+void aborterr(const char *, ...) __printflike(1, 2) __dead;
 void set_terminate_cleanup(void (*)(void));
-void elfterminate(const char *, const char *, ...) __printflike(2, 3);
+void elfterminate(const char *, const char *, ...) __printflike(2, 3) __dead;
 void warning(const char *, ...) __printflike(1, 2);
-void vadebug(int, const char *, va_list);
+void vadebug(int, const char *, va_list) __printflike(2, 0);
 void debug(int, const char *, ...) __printflike(2, 3);
 
 

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/st_parse.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/st_parse.c:1.5 src/external/cddl/osnet/dist/tools/ctf/cvt/st_parse.c:1.6
--- src/external/cddl/osnet/dist/tools/ctf/cvt/st_parse.c:1.5	Sat Feb  7 20:30:03 2015
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/st_parse.c	Thu Feb  4 17:40:55 2016
@@ -1125,7 +1125,7 @@ compute_sum(const char *w)
 	return (HASH(sum));
 }
 
-static void
+static void __dead
 reset(void)
 {
 	longjmp(resetbuf, 1);



CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2015-12-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Dec 27 21:38:46 UTC 2015

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: dwarf.c

Log Message:
add return


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.14 src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.15
--- src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.14	Tue Sep 29 16:43:16 2015
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c	Sun Dec 27 16:38:46 2015
@@ -2088,4 +2088,5 @@ dw_read(tdata_t *td, Elf *elf, char *fil
 out:
 	terminate("file does not contain dwarf type data "
 	"(try compiling with -g)\n");
+	return -1;
 }



CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2015-10-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Oct 21 13:43:49 UTC 2015

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: ctf.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c:1.8 src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c:1.9
--- src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c:1.8	Sat Feb  7 15:30:03 2015
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c	Wed Oct 21 09:43:49 2015
@@ -387,8 +387,9 @@ write_type(void *arg1, void *arg2)
 			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_type(void *arg1, void *arg2)
 		write_sized_type_rec(b, , 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(>ctb_strtab,
 mp->ml_name);
 
@@ -413,9 +415,11 @@ write_type(void *arg1, void *arg2)
 	SWAP_16(ctm.ctm_offset);
 }
 ctf_buf_write(b, , 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(>ctb_strtab,
 mp->ml_name);
 
@@ -435,6 +439,7 @@ write_type(void *arg1, void *arg2)
 }
 
 ctf_buf_write(b, , sizeof (ctlm));
+i--;
 			}
 		}
 		break;



CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2015-09-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Sep 29 20:43:16 UTC 2015

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: dwarf.c output.c

Log Message:
for the endian macros don't use the _ names, Darwin does not define them.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c
cvs rdiff -u -r1.5 -r1.6 src/external/cddl/osnet/dist/tools/ctf/cvt/output.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.13 src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.14
--- src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.13	Thu Sep 24 15:16:06 2015
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c	Tue Sep 29 16:43:16 2015
@@ -952,7 +952,7 @@ die_sou_create(dwarf_t *dw, Dwarf_Die st
 int type, const char *typename)
 {
 	Dwarf_Unsigned sz, bitsz, bitoff, maxsz=0;
-#if BYTE_ORDER == _LITTLE_ENDIAN
+#if BYTE_ORDER == LITTLE_ENDIAN
 	Dwarf_Unsigned bysz;
 #endif
 	Dwarf_Die mem;
@@ -1027,7 +1027,7 @@ die_sou_create(dwarf_t *dw, Dwarf_Die st
 			ml->ml_size = tdesc_bitsize(ml->ml_type);
 
 		if (die_unsigned(dw, mem, DW_AT_bit_offset, , 0)) {
-#if BYTE_ORDER == _BIG_ENDIAN
+#if BYTE_ORDER == BIG_ENDIAN
 			ml->ml_offset += bitoff;
 #else
 			/*

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/output.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/output.c:1.5 src/external/cddl/osnet/dist/tools/ctf/cvt/output.c:1.6
--- src/external/cddl/osnet/dist/tools/ctf/cvt/output.c:1.5	Sun Mar  9 13:04:00 2014
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/output.c	Tue Sep 29 16:43:16 2015
@@ -755,7 +755,7 @@ write_ctf(tdata_t *td, const char *curna
 		elfterminate(curname, "Cannot write");
 
 	if (gelf_getehdr(elf, )) {
-#if BYTE_ORDER == _BIG_ENDIAN
+#if BYTE_ORDER == BIG_ENDIAN
 		byteorder = ELFDATA2MSB;
 #else
 		byteorder = ELFDATA2LSB;



CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2015-09-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Sep 24 19:16:06 UTC 2015

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: ctfmerge.c dwarf.c

Log Message:
%j needs uintmax_t not uintptr_t


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 \
src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c \
src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c:1.12 src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c:1.13
--- src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c:1.12	Sun Jul  5 20:21:51 2015
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c	Thu Sep 24 15:16:06 2015
@@ -400,7 +400,7 @@ wip_add_work(wip_t *slot, tdata_t *pow)
 		slot->wip_nmerged = 1;
 	} else {
 		debug(2, "0x%jx: merging %p into %p\n",
-		(uintptr_t)pthread_self(),
+		(uintmax_t)(uintptr_t)pthread_self(),
 		(void *)pow, (void *)slot->wip_td);
 
 		merge_into_master(pow, slot->wip_td, NULL, 0);
@@ -471,7 +471,7 @@ worker_runphase2(workqueue_t *wq)
 			pthread_mutex_unlock(>wq_queue_lock);
 
 			debug(2, "0x%jx: entering p2 completion barrier\n",
-			(uintptr_t)pthread_self());
+			(uintmax_t)(uintptr_t)pthread_self());
 			if (barrier_wait(>wq_bar1)) {
 pthread_mutex_lock(>wq_queue_lock);
 wq->wq_alldone = 1;
@@ -499,7 +499,7 @@ worker_runphase2(workqueue_t *wq)
 		pthread_mutex_unlock(>wq_queue_lock);
 
 		debug(2, "0x%jx: merging %p into %p\n",
-		(uintptr_t)pthread_self(),
+		(uintmax_t)(uintptr_t)pthread_self(),
 		(void *)pow1, (void *)pow2);
 		merge_into_master(pow1, pow2, NULL, 0);
 		tdata_free(pow1);
@@ -518,7 +518,7 @@ worker_runphase2(workqueue_t *wq)
 
 		fifo_add(wq->wq_queue, pow2);
 		debug(2, "0x%jx: added %p to queue, len now %d, ninqueue %d\n",
-		(uintptr_t)pthread_self(), (void *)pow2,
+		(uintmax_t)(uintptr_t)pthread_self(), (void *)pow2,
 		fifo_len(wq->wq_queue), wq->wq_ninqueue);
 		pthread_cond_broadcast(>wq_done_cv);
 		pthread_cond_signal(>wq_work_avail);
@@ -534,27 +534,30 @@ worker_thread(workqueue_t *wq)
 {
 	worker_runphase1(wq);
 
-	debug(2, "0x%jx: entering first barrier\n", (uintptr_t)pthread_self());
+	debug(2, "0x%jx: entering first barrier\n",
+	(uintmax_t)(uintptr_t)pthread_self());
 
 	if (barrier_wait(>wq_bar1)) {
 
 		debug(2, "0x%jx: doing work in first barrier\n",
-		(uintptr_t)pthread_self());
+		(uintmax_t)(uintptr_t)pthread_self());
 
 		finalize_phase_one(wq);
 
 		init_phase_two(wq);
 
 		debug(2, "0x%jx: ninqueue is %d, %d on queue\n",
-		(uintptr_t)pthread_self(),
+		(uintmax_t)(uintptr_t)pthread_self(),
 		wq->wq_ninqueue, fifo_len(wq->wq_queue));
 	}
 
-	debug(2, "0x%jx: entering second barrier\n", (uintptr_t)pthread_self());
+	debug(2, "0x%jx: entering second barrier\n",
+	(uintmax_t)(uintptr_t)pthread_self());
 
 	(void) barrier_wait(>wq_bar2);
 
-	debug(2, "0x%jx: phase 1 complete\n", (uintptr_t)pthread_self());
+	debug(2, "0x%jx: phase 1 complete\n",
+	(uintmax_t)(uintptr_t)pthread_self());
 
 	worker_runphase2(wq);
 }
@@ -578,8 +581,8 @@ merge_ctf_cb(tdata_t *td, char *name, vo
 	}
 
 	fifo_add(wq->wq_queue, td);
-	debug(1, "Thread 0x%jx announcing %s\n", (uintptr_t)pthread_self(),
-	name);
+	debug(1, "Thread 0x%jx announcing %s\n",
+	(uintmax_t)(uintptr_t)pthread_self(), name);
 	pthread_cond_broadcast(>wq_work_avail);
 	pthread_mutex_unlock(>wq_queue_lock);
 
Index: src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.12 src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.13
--- src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.12	Sat Feb  7 15:30:03 2015
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c	Thu Sep 24 15:16:06 2015
@@ -1672,7 +1672,7 @@ die_function_create(dwarf_t *dw, Dwarf_D
 
 		if ((name1 = die_name(dw, arg)) == NULL) {
 			terminate("die %ju: func arg %d has no name\n",
-			(uintptr_t)off, ii->ii_nargs + 1);
+			(uintmax_t)off, ii->ii_nargs + 1);
 		}
 
 		if (strcmp(name1, "...") == 0) {
@@ -1688,7 +1688,7 @@ die_function_create(dwarf_t *dw, Dwarf_D
 		int i;
 
 		debug(3, "die %ju: function has %d argument%s\n",
-		(uintptr_t)off, ii->ii_nargs, ii->ii_nargs == 1 ? "" : "s");
+		(uintmax_t)off, ii->ii_nargs, ii->ii_nargs == 1 ? "" : "s");
 
 		ii->ii_args = xcalloc(sizeof (tdesc_t) * ii->ii_nargs);
 
@@ -1713,7 +1713,7 @@ die_variable_create(dwarf_t *dw, Dwarf_D
 	iidesc_t *ii;
 	char *name;
 
-	debug(3, "die %ju: creating object definition\n", (uintptr_t)off);
+	debug(3, "die %ju: creating object definition\n", (uintmax_t)off);
 
 	if (die_isdecl(dw, die) || (name = die_name(dw, die)) == NULL)
 		return; /* skip prototypes and nameless objects */
@@ -1810,18 +1810,18 @@ 

CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2015-03-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Mar  6 11:49:31 UTC 2015

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: ctfmerge.c

Log Message:
XXX: Use only a single thread. We seem to have a bug in our threading code
that causes us to hang in the ksem code if we use more than one.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 \
src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c:1.10 src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c:1.11
--- src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c:1.10	Sat Feb  7 15:30:03 2015
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c	Fri Mar  6 06:49:30 2015
@@ -208,7 +208,12 @@
 #pragma init(bigheap)
 
 #define	MERGE_PHASE1_BATCH_SIZE		8
+#if 0
+// XXX: bug?
 #define	MERGE_PHASE1_MAX_SLOTS		5
+#else
+#define	MERGE_PHASE1_MAX_SLOTS		1
+#endif
 #define	MERGE_INPUT_THROTTLE_LEN	10
 
 const char *progname;



CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2014-11-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Nov  1 23:21:31 UTC 2014

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: dwarf.c

Log Message:
don't fail for anonymous unions.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.10 src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.11
--- src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.10	Sat Apr  5 19:33:15 2014
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c	Sat Nov  1 19:21:31 2014
@@ -1162,6 +1162,14 @@ die_sou_resolve(tdesc_t *tdp, tdesc_t **
 			continue;
 			}
 
+			/*
+			 * anonymous union members are OK.
+			 * XXX: we should consistently use NULL, instead of 
+			 */
+			if (mt-t_type == UNION 
+			(mt-t_name == NULL || mt-t_name[0] == '\0'))
+			continue;
+
 			printf(%s unresolved type = %d (%s)\n, tdesc_name(tdp),
 mt-t_type, tdesc_name(mt));
 			dw-dw_nunres++;



CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2014-04-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr  5 23:33:16 UTC 2014

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: dwarf.c

Log Message:
Handle assembly code built with -g


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.9 src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.10
--- src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.9	Sun Mar  9 16:48:01 2014
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c	Sat Apr  5 19:33:15 2014
@@ -1924,7 +1924,6 @@ should_have_dwarf(Elf *elf)
 			char *name;
 
 			name = elf_strptr(elf, shdr.sh_link, sym.st_name);
-fprintf(stderr, name = %s\n, name);
 
 			/* Studio emits these local symbols regardless */
 			if ((strcmp(name, Bbss.bss) != 0) 
@@ -1995,15 +1994,29 @@ dw_read(tdata_t *td, Elf *elf, char *fil
 	addrsz, offsz, NULL, nxthdr, dw.dw_err)) != DW_DLV_OK)
 		terminate(rc = %d %s\n, rc, dwarf_errmsg(dw.dw_err));
 
-	if ((cu = die_sibling(dw, NULL)) == NULL ||
-	(((child = die_child(dw, cu)) == NULL) 
-	should_have_dwarf(elf))) {
-		terminate(file does not contain dwarf type data 
-		(try compiling with -g)\n);
-	} else if (child == NULL) {
-		return (0);
+	if ((cu = die_sibling(dw, NULL)) == NULL)
+		goto out;
+
+	if ((child = die_child(dw, cu)) == NULL) {
+		Dwarf_Unsigned lang;
+		if (die_unsigned(dw, cu, DW_AT_language, lang, 0)) {
+			debug(1, DWARF language: %u\n, lang);
+			/*
+			 * Assembly languages are typically that.
+			 * They have some dwarf info, but not what
+			 * we expect. They have local symbols for
+			 * example, but they are missing the child info.
+			 */
+			if (lang = DW_LANG_lo_user)
+return 0;
+		}
+		if (should_have_dwarf(elf))
+			goto out;
 	}
 
+	if (child == NULL)
+		return (0);
+
 	dw.dw_maxoff = nxthdr - 1;
 
 	if (dw.dw_maxoff  TID_FILEMAX)
@@ -2044,4 +2057,7 @@ dw_read(tdata_t *td, Elf *elf, char *fil
 	/* leak the dwarf_t */
 
 	return (0);
+out:
+	terminate(file does not contain dwarf type data 
+	(try compiling with -g)\n);
 }



CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2014-03-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar  9 17:04:00 UTC 2014

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: ctf.c ctfmerge.c ctfmerge.h
ctftools.h dwarf.c input.c output.c st_parse.c stabs.c traverse.c
util.c

Log Message:
sync with freebsd


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c \
src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c
cvs rdiff -u -r1.3 -r1.4 \
src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.h \
src/external/cddl/osnet/dist/tools/ctf/cvt/input.c \
src/external/cddl/osnet/dist/tools/ctf/cvt/st_parse.c \
src/external/cddl/osnet/dist/tools/ctf/cvt/stabs.c \
src/external/cddl/osnet/dist/tools/ctf/cvt/traverse.c \
src/external/cddl/osnet/dist/tools/ctf/cvt/util.c
cvs rdiff -u -r1.2 -r1.3 \
src/external/cddl/osnet/dist/tools/ctf/cvt/ctftools.h
cvs rdiff -u -r1.7 -r1.8 src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c
cvs rdiff -u -r1.4 -r1.5 src/external/cddl/osnet/dist/tools/ctf/cvt/output.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c:1.6 src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c:1.7
--- src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c:1.6	Tue Jan 10 03:42:22 2012
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c	Sun Mar  9 13:04:00 2014
@@ -51,15 +51,13 @@
  *
  * The value is only valid during a call to ctf_load.
  */
-char *curfile;
-
-
-/* The number of types. */
-static int ntypes=0;
+static char *curfile;
 
 #define	CTF_BUF_CHUNK_SIZE	(64 * 1024)
 #define	RES_BUF_CHUNK_SIZE	(64 * 1024)
 
+static int ntypes = 0;		/* The number of types. */
+
 struct ctf_buf {
 	strtab_t ctb_strtab;	/* string table */
 	caddr_t ctb_base;	/* pointer to base of buffer */
@@ -70,6 +68,18 @@ struct ctf_buf {
 	int ntholes;		/* number of type holes */
 };
 
+/*
+ * Macros to reverse byte order
+ */
+#define	BSWAP_8(x)	((x)  0xff)
+#define	BSWAP_16(x)	((BSWAP_8(x)  8) | BSWAP_8((x)  8))
+#define	BSWAP_32(x)	((BSWAP_16(x)  16) | BSWAP_16((x)  16))
+
+#define	SWAP_16(x)	(x) = BSWAP_16(x)
+#define	SWAP_32(x)	(x) = BSWAP_32(x)
+
+static int target_requires_swap;
+
 /*PRINTFLIKE1*/
 static void
 parseterminate(const char *fmt, ...)
@@ -148,6 +158,11 @@ write_label(void *arg1, void *arg2)
 	ctl.ctl_label = strtab_insert(b-ctb_strtab, le-le_name);
 	ctl.ctl_typeidx = le-le_idx;
 
+	if (target_requires_swap) {
+		SWAP_32(ctl.ctl_label);
+		SWAP_32(ctl.ctl_typeidx);
+	}
+
 	ctf_buf_write(b, ctl, sizeof (ctl));
 
 	return (1);
@@ -160,6 +175,10 @@ write_objects(iidesc_t *idp, ctf_buf_t *
 
 	ctf_buf_write(b, id, sizeof (id));
 
+	if (target_requires_swap) {
+		SWAP_16(id);
+	}
+
 	debug(3, Wrote object %s (%d)\n, (idp ? idp-ii_name : (null)), id);
 }
 
@@ -188,10 +207,21 @@ write_functions(iidesc_t *idp, ctf_buf_t
 
 	fdata[0] = CTF_TYPE_INFO(CTF_K_FUNCTION, 1, nargs);
 	fdata[1] = idp-ii_dtype-t_id;
+
+	if (target_requires_swap) {
+		SWAP_16(fdata[0]);
+		SWAP_16(fdata[1]);
+	}
+
 	ctf_buf_write(b, fdata, sizeof (fdata));
 
 	for (i = 0; i  idp-ii_nargs; i++) {
 		id = idp-ii_args[i]-t_id;
+
+		if (target_requires_swap) {
+			SWAP_16(id);
+		}
+
 		ctf_buf_write(b, id, sizeof (id));
 	}
 
@@ -216,11 +246,25 @@ write_sized_type_rec(ctf_buf_t *b, ctf_t
 		ctt-ctt_size = CTF_LSIZE_SENT;
 		ctt-ctt_lsizehi = CTF_SIZE_TO_LSIZE_HI(size);
 		ctt-ctt_lsizelo = CTF_SIZE_TO_LSIZE_LO(size);
+		if (target_requires_swap) {
+			SWAP_32(ctt-ctt_name);
+			SWAP_16(ctt-ctt_info);
+			SWAP_16(ctt-ctt_size);
+			SWAP_32(ctt-ctt_lsizehi);
+			SWAP_32(ctt-ctt_lsizelo);
+		}
 		ctf_buf_write(b, ctt, sizeof (*ctt));
 	} else {
 		ctf_stype_t *cts = (ctf_stype_t *)ctt;
 
 		cts-ctt_size = (ushort_t)size;
+
+		if (target_requires_swap) {
+			SWAP_32(cts-ctt_name);
+			SWAP_16(cts-ctt_info);
+			SWAP_16(cts-ctt_size);
+		}
+
 		ctf_buf_write(b, cts, sizeof (*cts));
 	}
 }
@@ -230,6 +274,12 @@ write_unsized_type_rec(ctf_buf_t *b, ctf
 {
 	ctf_stype_t *cts = (ctf_stype_t *)ctt;
 
+	if (target_requires_swap) {
+		SWAP_32(cts-ctt_name);
+		SWAP_16(cts-ctt_info);
+		SWAP_16(cts-ctt_size);
+	}
+
 	ctf_buf_write(b, cts, sizeof (*cts));
 }
 
@@ -304,6 +354,9 @@ write_type(void *arg1, void *arg2)
 			encoding = ip-intr_fformat;
 
 		data = CTF_INT_DATA(encoding, ip-intr_offset, ip-intr_nbits);
+		if (target_requires_swap) {
+			SWAP_32(data);
+		}
 		ctf_buf_write(b, data, sizeof (data));
 		break;
 
@@ -320,6 +373,11 @@ write_type(void *arg1, void *arg2)
 		cta.cta_contents = tp-t_ardef-ad_contents-t_id;
 		cta.cta_index = tp-t_ardef-ad_idxtype-t_id;
 		cta.cta_nelems = tp-t_ardef-ad_nelems;
+		if (target_requires_swap) {
+			SWAP_16(cta.cta_contents);
+			SWAP_16(cta.cta_index);
+			SWAP_32(cta.cta_nelems);
+		}
 		ctf_buf_write(b, cta, sizeof (cta));
 		break;
 
@@ 

CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2014-03-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar  9 17:07:46 UTC 2014

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: ctfmerge.c

Log Message:
fix constant name


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 \
src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c:1.7 src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c:1.8
--- src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c:1.7	Sun Mar  9 13:04:00 2014
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c	Sun Mar  9 13:07:46 2014
@@ -641,7 +641,7 @@ wq_init(workqueue_t *wq, int nfiles)
 	if (getenv(CTFMERGE_MAX_SLOTS))
 		nslots = atoi(getenv(CTFMERGE_MAX_SLOTS));
 	else
-		nslots = CTFMERGE_MAX_SLOTS;
+		nslots = MERGE_PHASE1_MAX_SLOTS;
 
 	if (getenv(CTFMERGE_PHASE1_BATCH_SIZE))
 		wq-wq_maxbatchsz = atoi(getenv(CTFMERGE_PHASE1_BATCH_SIZE));



CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2014-03-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar  9 19:14:15 UTC 2014

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: ctfmerge.c

Log Message:
Temporarily add a -S flag to limit the number of threads.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 \
src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c:1.8 src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c:1.9
--- src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c:1.8	Sun Mar  9 13:07:46 2014
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c	Sun Mar  9 15:14:15 2014
@@ -217,6 +217,7 @@ static char *tmpname = NULL;
 static int dynsym;
 int debug_level = DEBUG_LEVEL;
 static size_t maxpgsize = 0x40;
+static int maxslots = MERGE_PHASE1_MAX_SLOTS;
 
 
 void
@@ -641,7 +642,7 @@ wq_init(workqueue_t *wq, int nfiles)
 	if (getenv(CTFMERGE_MAX_SLOTS))
 		nslots = atoi(getenv(CTFMERGE_MAX_SLOTS));
 	else
-		nslots = MERGE_PHASE1_MAX_SLOTS;
+		nslots = maxslots;
 
 	if (getenv(CTFMERGE_PHASE1_BATCH_SIZE))
 		wq-wq_maxbatchsz = atoi(getenv(CTFMERGE_PHASE1_BATCH_SIZE));
@@ -776,7 +777,7 @@ main(int argc, char **argv)
 		debug_level = atoi(getenv(CTFMERGE_DEBUG_LEVEL));
 
 	err = 0;
-	while ((c = getopt(argc, argv, :cd:D:fgl:L:o:tvw:s)) != EOF) {
+	while ((c = getopt(argc, argv, :cd:D:fgl:L:o:tvw:sS:)) != EOF) {
 		switch (c) {
 		case 'c':
 			docopy = 1;
@@ -824,6 +825,9 @@ main(int argc, char **argv)
 			/* use the dynsym rather than the symtab */
 			dynsym = CTF_USE_DYNSYM;
 			break;
+		case 'S':
+			maxslots = atoi(optarg);
+			break;
 		default:
 			usage();
 			exit(2);



CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2014-03-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar  9 20:48:01 UTC 2014

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: dwarf.c

Log Message:
put back our local fixes:
- don't die on unresolved types.
- it is ok to have 0 sized arrays in structs
- forward enum decls.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.8 src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.9
--- src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.8	Sun Mar  9 13:04:00 2014
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c	Sun Mar  9 16:48:01 2014
@@ -817,7 +817,9 @@ die_enum_create(dwarf_t *dw, Dwarf_Die d
 
 	debug(3, die %llu: creating enum\n, off);
 
-	tdp-t_type = ENUM;
+	tdp-t_type = (die_isdecl(dw, die) ? FORWARD : ENUM);
+	if (tdp-t_type != ENUM)
+		return;
 
 	(void) die_unsigned(dw, die, DW_AT_byte_size, uval, DW_ATTR_REQ);
 	/* Check for bogus gcc DW_AT_byte_size attribute */
@@ -1137,6 +1139,9 @@ die_sou_resolve(tdesc_t *tdp, tdesc_t **
 		if (ml-ml_size == 0) {
 			mt = tdesc_basetype(ml-ml_type);
 
+			if (mt == NULL)
+continue;
+
 			if ((ml-ml_size = tdesc_bitsize(mt)) != 0)
 continue;
 
@@ -1149,6 +1154,16 @@ die_sou_resolve(tdesc_t *tdp, tdesc_t **
 			if (mt-t_type == ARRAY  mt-t_ardef-ad_nelems == 0)
 continue;
 
+			if (mt-t_type == STRUCT  
+mt-t_members != NULL 
+mt-t_members-ml_type-t_type == ARRAY 
+mt-t_members-ml_type-t_ardef-ad_nelems == 0) {
+			/* struct with zero sized array */
+			continue;
+			}
+
+			printf(%s unresolved type = %d (%s)\n, tdesc_name(tdp),
+mt-t_type, tdesc_name(mt));
 			dw-dw_nunres++;
 			return (1);
 		}



CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2014-03-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar  3 00:09:52 UTC 2014

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: dwarf.c

Log Message:
Don't core-dump if a type cannot be resolved. Still gives an error.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.6 src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.7
--- src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.6	Fri Jan 18 11:23:48 2013
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c	Sun Mar  2 19:09:52 2014
@@ -1064,6 +1064,9 @@ die_sou_resolve(tdesc_t *tdp, tdesc_t **
 		if (ml-ml_size == 0) {
 			mt = tdesc_basetype(ml-ml_type);
 
+			if (mt == NULL)
+continue;
+
 			if ((ml-ml_size = tdesc_bitsize(mt)) != 0)
 continue;
 



CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2014-01-12 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sun Jan 12 17:48:59 UTC 2014

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: ctfmerge.c

Log Message:
Field width is an int, so cast the result of strlen() appropriately.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 \
src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c:1.5 src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c:1.6
--- src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c:1.5	Thu Feb 25 00:18:44 2010
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c	Sun Jan 12 17:48:59 2014
@@ -238,7 +238,7 @@ usage(void)
 	\n
 	  Note: if -L labelenv is specified and labelenv is not set in\n
 	  the environment, a default value is used.\n,
-	progname, progname, strlen(progname),  ,
+	progname, progname, (int)strlen(progname),  ,
 	progname, progname);
 }
 



CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2013-01-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan 18 16:23:48 UTC 2013

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: dwarf.c

Log Message:
Handle enum forward declarations.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.5 src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.6
--- src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.5	Tue Jan 10 03:42:22 2012
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c	Fri Jan 18 11:23:48 2013
@@ -767,7 +767,9 @@ die_enum_create(dwarf_t *dw, Dwarf_Die d
 
 	debug(3, die %llu: creating enum\n, off);
 
-	tdp-t_type = ENUM;
+	tdp-t_type = (die_isdecl(dw, die) ? FORWARD : ENUM);
+	if (tdp-t_type != ENUM)
+		return;
 
 	(void) die_unsigned(dw, die, DW_AT_byte_size, uval, DW_ATTR_REQ);
 	/* Check for bogus gcc DW_AT_byte_size attribute */



CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2012-01-10 Thread Darran Hunt
Module Name:src
Committed By:   darran
Date:   Tue Jan 10 08:42:22 UTC 2012

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: ctf.c dwarf.c

Log Message:
Fix a segfault in ctfmerge.

GCC can generate bogus dwarf attributes with DW_AT_byte_size set to 0x.
See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35998 .

GCC is currently doing this for external/bsd/tmux/dist/compat/imsg-buffer.c:
readelf -a --debug-dump imsg-buffer.o
...
 26e3: Abbrev Number: 32 (DW_TAG_union_type)
6e4   DW_AT_byte_size   : 0x
6e8   DW_AT_decl_file   : 1
6e9   DW_AT_decl_line   : 229
6ea   DW_AT_sibling : 0x705

This resulted in ctfconvert generating a faulty CTF entry which then caused the
segfault in ctfmerge.

The fix has ctfconvert check for the bogus 0x value and works around it.
It also adds some protection to ctfmerge to avoid the segfault and fail
more gracefully if the error should occur in the future.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c
cvs rdiff -u -r1.4 -r1.5 src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c:1.5 src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c:1.6
--- src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c:1.5	Thu Mar 11 23:26:33 2010
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c	Tue Jan 10 08:42:22 2012
@@ -53,6 +53,10 @@
  */
 char *curfile;
 
+
+/* The number of types. */
+static int ntypes=0;
+
 #define	CTF_BUF_CHUNK_SIZE	(64 * 1024)
 #define	RES_BUF_CHUNK_SIZE	(64 * 1024)
 
@@ -1048,6 +1052,9 @@ resurrect_types(ctf_header_t *h, tdata_t
 	(*mpp)-ml_type = tdarr[ctm-ctm_type];
 	(*mpp)-ml_offset = ctm-ctm_offset;
 	(*mpp)-ml_size = 0;
+	if (ctm-ctm_type  ntypes) {
+	parseterminate(Invalid member type ctm_type=%d, ctm-ctm_type);
+	}
 }
 			} else {
 for (i = 0, mpp = tdp-t_members; i  vlen;
@@ -1064,6 +1071,9 @@ resurrect_types(ctf_header_t *h, tdata_t
 	(*mpp)-ml_offset =
 	(int)CTF_LMEM_OFFSET(ctlm);
 	(*mpp)-ml_size = 0;
+	if (ctlm-ctlm_type  ntypes) {
+	parseterminate(Invalid lmember type ctlm_type=%d, ctlm-ctlm_type);
+	}
 }
 			}
 
@@ -1177,9 +1187,10 @@ ctf_parse(ctf_header_t *h, caddr_t buf, 
 {
 	tdata_t *td = tdata_new();
 	tdesc_t **tdarr;
-	int ntypes = count_types(h, buf);
 	int idx, i;
 
+	ntypes = count_types(h, buf);
+
 	/* shudder */
 	tdarr = xcalloc(sizeof (tdesc_t *) * (ntypes + 1));
 	tdarr[0] = NULL;

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.4 src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.5
--- src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c:1.4	Wed Feb 24 21:53:26 2010
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c	Tue Jan 10 08:42:22 2012
@@ -678,6 +678,12 @@ die_array_create(dwarf_t *dw, Dwarf_Die 
 		tdesc_t *dimtdp;
 		int flags;
 
+		/* Check for bogus gcc DW_AT_byte_size attribute */
+		if (uval == 0x) {
+		printf(dwarf.c:%s() working around bogus DW_AT_byte_size = 0x\n, __func__);
+		uval = 0;
+		}
+
 		tdp-t_size = uval;
 
 		/*
@@ -764,6 +770,11 @@ die_enum_create(dwarf_t *dw, Dwarf_Die d
 	tdp-t_type = ENUM;
 
 	(void) die_unsigned(dw, die, DW_AT_byte_size, uval, DW_ATTR_REQ);
+	/* Check for bogus gcc DW_AT_byte_size attribute */
+	if (uval == 0x) {
+	printf(dwarf.c:%s() working around bogus DW_AT_byte_size = 0x\n, __func__);
+	uval = 0;
+	}
 	tdp-t_size = uval;
 
 	if ((mem = die_child(dw, die)) != NULL) {
@@ -877,7 +888,7 @@ static void
 die_sou_create(dwarf_t *dw, Dwarf_Die str, Dwarf_Off off, tdesc_t *tdp,
 int type, const char *typename)
 {
-	Dwarf_Unsigned sz, bitsz, bitoff;
+	Dwarf_Unsigned sz, bitsz, bitoff, maxsz=0;
 	Dwarf_Die mem;
 	mlist_t *ml, **mlastp;
 	iidesc_t *ii;
@@ -933,6 +944,8 @@ die_sou_create(dwarf_t *dw, Dwarf_Die st
 			ml-ml_name = NULL;
 
 		ml-ml_type = die_lookup_pass1(dw, mem, DW_AT_type);
+		debug(3, die_sou_create(): ml_type = %p t_id = %d\n, ml-ml_type,
+			ml-ml_type-t_id);
 
 		if (die_mem_offset(dw, mem, DW_AT_data_member_location,
 		mloff, 0)) {
@@ -960,8 +973,21 @@ die_sou_create(dwarf_t *dw, Dwarf_Die st
 
 		*mlastp = ml;
 		mlastp = ml-ml_next;
+
+		/* work out the size of the largest member to work around a gcc bug */
+		if (maxsz  ml-ml_size) {
+		maxsz = ml-ml_size;
+		}
 	} while ((mem = die_sibling(dw, mem)) != NULL);
 
+	/* See if we got a bogus DW_AT_byte_size.  GCC will sometimes
+	 * emit this.
+	 */
+	if (sz == 0x) {
+	printf(dwarf.c:%s() working around bogus DW_AT_byte_size = 0x\n, __func__);
+	tdp-t_size = maxsz / 8;	/* maxsz is in 

CVS commit: src/external/cddl/osnet/dist/tools/ctf/cvt

2010-03-11 Thread Darran Hunt
Module Name:src
Committed By:   darran
Date:   Thu Mar 11 23:26:34 UTC 2010

Modified Files:
src/external/cddl/osnet/dist/tools/ctf/cvt: ctf.c

Log Message:
DTrace: The CTF format is limited to only 1024 elements in an enum,
so rather than error out when there are more than this just truncate the
length.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c
diff -u src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c:1.4 src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c:1.5
--- src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c:1.4	Sat Feb 27 23:43:53 2010
+++ src/external/cddl/osnet/dist/tools/ctf/cvt/ctf.c	Thu Mar 11 23:26:33 2010
@@ -369,14 +369,16 @@
 			i++; /* count up enum members */
 
 		if (i  CTF_MAX_VLEN) {
-			terminate(enum %s has too many values: %d  %d\n,
+			printf(enum %s has too many values: %d  %d, truncating\n,
 			tdesc_name(tp), i, CTF_MAX_VLEN);
+
+		i = CTF_MAX_VLEN;
 		}
 
 		ctt.ctt_info = CTF_TYPE_INFO(CTF_K_ENUM, isroot, i);
 		write_sized_type_rec(b, ctt, tp-t_size);
 
-		for (ep = tp-t_emem; ep != NULL; ep = ep-el_next) {
+		for (ep = tp-t_emem; i  ep != NULL; ep = ep-el_next, i--) {
 			offset = strtab_insert(b-ctb_strtab, ep-el_name);
 			cte.cte_name = CTF_TYPE_NAME(CTF_STRTAB_0, offset);
 			cte.cte_value = ep-el_number;
@@ -818,7 +820,7 @@
 			debug(3, Skipping null object\n);
 			continue;
 		} else if (id = tdsize) {
-			parseterminate(Reference to invalid type %d, id);
+			parseterminate((1) Reference to invalid type %d, id);
 		}
 
 		ii = iidesc_new(symit_name(si));
@@ -869,7 +871,7 @@
 		dptr += 2;
 
 		if (retid = tdsize)
-			parseterminate(Reference to invalid type %d, retid);
+			parseterminate((2) Reference to invalid type %d, retid);
 
 		ii = iidesc_new(symit_name(si));
 		ii-ii_dtype = tdarr[retid];
@@ -887,8 +889,8 @@
 			v = (void *) dptr;
 			ushort_t id = *((ushort_t *)v);
 			if (id = tdsize)
-parseterminate(Reference to invalid type %d,
-id);
+parseterminate((3) Reference to invalid type %d (tdsize %d) ii_nargs %d %s,
+id, tdsize, ii-ii_nargs, ii-ii_name);
 			ii-ii_args[i] = tdarr[id];
 		}
 
@@ -943,7 +945,7 @@
 			break;
 
 		if (tid = tdsize)
-			parseterminate(Reference to invalid type %d, tid);
+			parseterminate((4) Reference to invalid type %d, tid);
 
 		void *v = (void *) dptr;
 		ctt = v;