Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 23 Feb 2008 00:17:59 GMT
From:      John Birrell <jb@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 135999 for review
Message-ID:  <200802230017.m1N0HxWv077595@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=135999

Change 135999 by jb@jb_freebsd1 on 2008/02/23 00:17:24

	Add a chyeck that the second arg to printt() is a typeref(). Ideally
	we'd just silently insert the typeref by munging the args passed to
	printt(), but the parser design pretty much limits that.

Affected files ...

.. //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_cc.c#11 edit

Differences ...

==== //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_cc.c#11 (text) ====

@@ -994,10 +994,11 @@
 		    "be a non-zero positive integral constant expression\n");
 	}
 
-	if (dt_node_is_pointer(addr) == 0) {
+	if (addr == NULL || addr->dn_kind != DT_NODE_FUNC ||
+	    addr->dn_ident != dt_idhash_lookup(dtp->dt_globals, "typeref")) {
 		dnerror(addr, D_PRINTT_ADDR,
 		    "printt( ) argument #2 is incompatible with "
-		    "prototype:\n\tprototype: pointer\n"
+		    "prototype:\n\tprototype: typeref()\n"
 		    "\t argument: %s\n",
 		    dt_node_type_name(addr, n, sizeof (n)));
 	}
@@ -1007,7 +1008,15 @@
 	ap->dtad_kind = DTRACEACT_PRINTT;
 
 	ap->dtad_difo->dtdo_rtype.dtdt_flags |= DIF_TF_BYREF;
-	ap->dtad_difo->dtdo_rtype.dtdt_size = size->dn_value + sizeof(uintptr_t);
+
+	/*
+	 * Allow additional buffer space for the data size, type size,
+	 * type string length and a stab in the dark (32 bytes) for the
+	 * type string. The type string is part of the typeref() that
+	 * this action references.
+	 */
+	ap->dtad_difo->dtdo_rtype.dtdt_size = size->dn_value + 3 * sizeof(uintptr_t) + 32;
+
 }
 
 static void



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200802230017.m1N0HxWv077595>