Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Feb 2008 20:59:03 GMT
From:      John Birrell <jb@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 135411 for review
Message-ID:  <200802142059.m1EKx3iq033150@repoman.freebsd.org>

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

Change 135411 by jb@jb_freebsd1 on 2008/02/14 20:58:10

	WIP for the printt() action.

Affected files ...

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

Differences ...

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

@@ -965,8 +965,8 @@
 
 	if (dt_node_is_pointer(addr) == 0) {
 		dnerror(addr, D_PRINTM_ADDR,
-		    "tracemem( ) argument #2 is incompatible with "
-		    "prototype:\n\tprototype: integer\n"
+		    "printm( ) argument #2 is incompatible with "
+		    "prototype:\n\tprototype: pointer\n"
 		    "\t argument: %s\n",
 		    dt_node_type_name(addr, n, sizeof (n)));
 	}
@@ -976,7 +976,38 @@
 	ap->dtad_kind = DTRACEACT_PRINTM;
 
 	ap->dtad_difo->dtdo_rtype.dtdt_flags |= DIF_TF_BYREF;
-	ap->dtad_difo->dtdo_rtype.dtdt_size = size->dn_value + sizeof(uint64_t);
+	ap->dtad_difo->dtdo_rtype.dtdt_size = size->dn_value + sizeof(uintptr_t);
+}
+
+static void
+dt_action_printt(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp)
+{
+	dtrace_actdesc_t *ap = dt_stmt_action(dtp, sdp);
+
+	dt_node_t *size = dnp->dn_args;
+	dt_node_t *addr = dnp->dn_args->dn_list;
+
+	char n[DT_TYPE_NAMELEN];
+
+	if (dt_node_is_posconst(size) == 0) {
+		dnerror(size, D_PRINTT_SIZE, "printt( ) argument #1 must "
+		    "be a non-zero positive integral constant expression\n");
+	}
+
+	if (dt_node_is_pointer(addr) == 0) {
+		dnerror(addr, D_PRINTT_ADDR,
+		    "printt( ) argument #2 is incompatible with "
+		    "prototype:\n\tprototype: pointer\n"
+		    "\t argument: %s\n",
+		    dt_node_type_name(addr, n, sizeof (n)));
+	}
+
+	dt_cg(yypcb, addr);
+	ap->dtad_difo = dt_as(yypcb);
+	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);
 }
 
 static void
@@ -1048,6 +1079,9 @@
 	case DT_ACT_PRINTM:
 		dt_action_printm(dtp, dnp->dn_expr, sdp);
 		break;
+	case DT_ACT_PRINTT:
+		dt_action_printt(dtp, dnp->dn_expr, sdp);
+		break;
 	case DT_ACT_RAISE:
 		dt_action_raise(dtp, dnp->dn_expr, sdp);
 		break;

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

@@ -1801,6 +1801,13 @@
 				    dt_idkind_name(idp->di_kind), idp->di_name);
 			}
 
+			if (idp->di_id == DIF_SUBR_TYPEREF) {
+				dt_node_t *size = dnp->dn_args;
+				char buf[64];
+				ctf_type_name(size->dn_ctfp, size->dn_type, buf, sizeof (buf));
+printf("%s(%d); %s %s( ) '%s'<----- DIF_SUBR_TYPEREF\n",__func__,__LINE__,dt_idkind_name(idp->di_kind), idp->di_name,buf);
+			}
+
 			dt_cg_arglist(dnp->dn_ident, dnp->dn_args, dlp, drp);
 
 			if ((dnp->dn_reg = dt_regset_alloc(drp)) == -1)



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