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

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

Change 136000 by jb@jb_freebsd1 on 2008/02/23 00:20:36

	Add a hack to whip a couple of the dummy args to typeref() into
	shape by replacing the string with one containing the type string
	and the integer with the type size.
	
	Yes, this is a hack to get some functionality I really, really,
	want but the DTrace parser design doesn't really allow for.

Affected files ...

.. //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_cg.c#12 edit

Differences ...

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

@@ -1339,6 +1339,31 @@
 }
 
 static void
+dt_cg_func_typeref(dt_node_t *dnp)
+{
+	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];
+
+	ctf_type_name(addr->dn_ctfp, addr->dn_type, buf, sizeof (buf));
+
+	/*
+	 * XXX Hack alert! XXX
+	 * The prototype has two dummy args that we munge to represent
+	 * the type string and the type size.
+	 *
+	 * Yes, I hear your grumble, but it works for now. We'll come
+	 * up with a more elegant implementation later. :-)
+	 */
+	free(strp->dn_string);
+	strp->dn_string = strdup(buf);
+
+	typs->dn_value = ctf_type_size(addr->dn_ctfp, addr->dn_type);
+}
+
+static void
 dt_cg_node(dt_node_t *dnp, dt_irlist_t *dlp, dt_regset_t *drp)
 {
 	ctf_file_t *ctfp = dnp->dn_ctfp;
@@ -1801,11 +1826,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);
+			switch (idp->di_id) {
+			case DIF_SUBR_TYPEREF:
+				dt_cg_func_typeref(dnp);
+				break;
+
+			default:
+				break;
 			}
 
 			dt_cg_arglist(dnp->dn_ident, dnp->dn_args, dlp, drp);



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