PERFORCE change 135999 for review
John Birrell
jb at FreeBSD.org
Sat Feb 23 00:17:59 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=135999
Change 135999 by jb at 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
More information about the p4-projects
mailing list