PERFORCE change 136006 for review
John Birrell
jb at FreeBSD.org
Sat Feb 23 01:47:38 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=136006
Change 136006 by jb at jb_freebsd1 on 2008/02/23 01:46:57
We need to get the size of the type we're pointing to rather
than the size of the pointer. Oops.
Affected files ...
.. //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_cg.c#13 edit
Differences ...
==== //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_cg.c#13 (text) ====
@@ -1339,13 +1339,15 @@
}
static void
-dt_cg_func_typeref(dt_node_t *dnp)
+dt_cg_func_typeref(dtrace_hdl_t *dtp, dt_node_t *dnp)
{
+ dtrace_typeinfo_t dtt;
dt_node_t *addr = dnp->dn_args;
dt_node_t *nelm = addr->dn_list;
dt_node_t *strp = nelm->dn_list;
dt_node_t *typs = strp->dn_list;
char buf[DT_TYPE_NAMELEN];
+ char *p;
ctf_type_name(addr->dn_ctfp, addr->dn_type, buf, sizeof (buf));
@@ -1358,9 +1360,16 @@
* up with a more elegant implementation later. :-)
*/
free(strp->dn_string);
+
+ if ((p = strchr(buf, '*')) != NULL)
+ *p = '\0';
+
strp->dn_string = strdup(buf);
- typs->dn_value = ctf_type_size(addr->dn_ctfp, addr->dn_type);
+ if (dtrace_lookup_by_type(dtp, DTRACE_OBJ_EVERY, buf, &dtt) < 0)
+ return;
+
+ typs->dn_value = ctf_type_size(dtt.dtt_ctfp, dtt.dtt_type);
}
static void
@@ -1818,7 +1827,9 @@
}
switch (dnp->dn_kind) {
- case DT_NODE_FUNC:
+ case DT_NODE_FUNC: {
+ dtrace_hdl_t *dtp = yypcb->pcb_hdl;
+
if ((idp = dnp->dn_ident)->di_kind != DT_IDENT_FUNC) {
dnerror(dnp, D_CG_EXPR, "%s %s( ) may not be "
"called from a D expression (D program "
@@ -1828,7 +1839,7 @@
switch (idp->di_id) {
case DIF_SUBR_TYPEREF:
- dt_cg_func_typeref(dnp);
+ dt_cg_func_typeref(dtp, dnp);
break;
default:
@@ -1847,6 +1858,7 @@
dt_cg_node_alloc(DT_LBL_NONE, instr));
break;
+ }
case DT_NODE_VAR:
if (dnp->dn_ident->di_kind == DT_IDENT_XLSOU ||
More information about the p4-projects
mailing list