svn commit: r253725 - in head/cddl/contrib/opensolaris: cmd/dtrace/test/cmd/scripts cmd/dtrace/test/tst/common/aggs cmd/dtrace/test/tst/common/arithmetic cmd/dtrace/test/tst/common/print cmd/dtrace...

Pedro F. Giffuni pfg at FreeBSD.org
Sun Jul 28 00:45:25 UTC 2013


Author: pfg
Date: Sun Jul 28 00:45:20 2013
New Revision: 253725
URL: http://svnweb.freebsd.org/changeset/base/253725

Log:
  DTrace: re-merge remainder of r249367 (original from Illumos).
  
  Bring back some important fixes from Illumos:
  
  3022 DTrace: keys should not affect the sort order when sorting by value
  3023 it should be possible to dereference dynamic variables
  3024 D integer narrowing needs some work
  
  We particularly avoid the LD_NOLAZYLOAD changes that Illumos made
  as those don't apply to FreeBSD and were causing problems in
  interactive mode.
  
  Illumos Revision:	13758:23432da34147
  
  Reference:
  
  https://www.illumos.org/issues/3022
  https://www.illumos.org/issues/3023
  https://www.illumos.org/issues/3024
  
  MFC after:	1 month
  Tested by:	markj

Added:
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.sizedkeys.d
     - copied unchanged from r253680, vendor/illumos/dist/cmd/dtrace/test/tst/common/aggs/tst.sizedkeys.d
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.sizedkeys.d.out
     - copied unchanged from r253680, vendor/illumos/dist/cmd/dtrace/test/tst/common/aggs/tst.sizedkeys.d.out
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.basics.d.out
     - copied unchanged from r253680, vendor/illumos/dist/cmd/dtrace/test/tst/common/arithmetic/tst.basics.d.out
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.compcast.d
     - copied unchanged from r253680, vendor/illumos/dist/cmd/dtrace/test/tst/common/arithmetic/tst.compcast.d
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.compcast.d.out
     - copied unchanged from r253680, vendor/illumos/dist/cmd/dtrace/test/tst/common/arithmetic/tst.compcast.d.out
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.compnarrowassign.d
     - copied unchanged from r253680, vendor/illumos/dist/cmd/dtrace/test/tst/common/arithmetic/tst.compnarrowassign.d
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.compnarrowassign.d.out
     - copied unchanged from r253680, vendor/illumos/dist/cmd/dtrace/test/tst/common/arithmetic/tst.compnarrowassign.d.out
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.execcast.d
     - copied unchanged from r253680, vendor/illumos/dist/cmd/dtrace/test/tst/common/arithmetic/tst.execcast.d
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.execcast.d.out
     - copied unchanged from r253680, vendor/illumos/dist/cmd/dtrace/test/tst/common/arithmetic/tst.execcast.d.out
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/tst.dyn.d
     - copied unchanged from r253680, vendor/illumos/dist/cmd/dtrace/test/tst/common/print/tst.dyn.d
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/tst.xlate.d
     - copied unchanged from r253680, vendor/illumos/dist/cmd/dtrace/test/tst/common/print/tst.xlate.d
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/tst.xlate.d.out
     - copied unchanged from r253680, vendor/illumos/dist/cmd/dtrace/test/tst/common/print/tst.xlate.d.out
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.signs.d
     - copied unchanged from r253680, vendor/illumos/dist/cmd/dtrace/test/tst/common/printf/tst.signs.d
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.signs.d.out
     - copied unchanged from r253680, vendor/illumos/dist/cmd/dtrace/test/tst/common/printf/tst.signs.d.out
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/trace/tst.dyn.d
     - copied unchanged from r253680, vendor/illumos/dist/cmd/dtrace/test/tst/common/trace/tst.dyn.d
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/translators/tst.TestTransStability1.ksh
     - copied unchanged from r253680, vendor/illumos/dist/cmd/dtrace/test/tst/common/translators/tst.TestTransStability1.ksh
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/translators/tst.TestTransStability1.ksh.out
     - copied unchanged from r253680, vendor/illumos/dist/cmd/dtrace/test/tst/common/translators/tst.TestTransStability1.ksh.out
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/translators/tst.TestTransStability2.ksh
     - copied unchanged from r253680, vendor/illumos/dist/cmd/dtrace/test/tst/common/translators/tst.TestTransStability2.ksh
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/translators/tst.TestTransStability2.ksh.out
     - copied unchanged from r253680, vendor/illumos/dist/cmd/dtrace/test/tst/common/translators/tst.TestTransStability2.ksh.out
Deleted:
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.complex.d
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/err.D_PRINT_DYN.bad.d
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/translators/man.TestTransStability.d
Modified:
  head/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/scripts/dtest.pl
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.ints.d.out
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_aggregate.c
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cg.c
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_error.c
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_parser.c
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_printf.c
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.c
  head/cddl/contrib/opensolaris/lib/libdtrace/i386/dt_isadep.c

Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/scripts/dtest.pl
==============================================================================
--- head/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/scripts/dtest.pl	Sat Jul 27 22:44:55 2013	(r253724)
+++ head/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/scripts/dtest.pl	Sun Jul 28 00:45:20 2013	(r253725)
@@ -583,6 +583,8 @@ if ($opt_x) {
 die "$PNAME: failed to open $PNAME.$$.log: $!\n"
     unless (!$opt_l || open(LOG, ">$PNAME.$$.log"));
 
+$ENV{'DTRACE_DEBUG_REGSET'} = 'true';
+
 if ($opt_g) {
 	$ENV{'UMEM_DEBUG'} = 'default,verbose';
 	$ENV{'UMEM_LOGGING'} = 'fail,contents';

Copied: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.sizedkeys.d (from r253680, vendor/illumos/dist/cmd/dtrace/test/tst/common/aggs/tst.sizedkeys.d)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.sizedkeys.d	Sun Jul 28 00:45:20 2013	(r253725, copy of r253680, vendor/illumos/dist/cmd/dtrace/test/tst/common/aggs/tst.sizedkeys.d)
@@ -0,0 +1,35 @@
+/*
+ * CDDL HEADER START
+ *
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source.  A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2012 by Delphix. All rights reserved.
+ */
+
+#pragma D option quiet
+
+/*
+ * Make sure the sizes of compatible keys doesn't affect the sort order.
+ */
+
+BEGIN
+{
+	@[(int)1, 0] = sum(10);
+	@[(uint64_t)2, 0] = sum(20);
+	@[(int)3, 0] = sum(30);
+	@[(uint64_t)4, 0] = sum(40);
+	printa(@);
+
+	exit(0);
+}

Copied: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.sizedkeys.d.out (from r253680, vendor/illumos/dist/cmd/dtrace/test/tst/common/aggs/tst.sizedkeys.d.out)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.sizedkeys.d.out	Sun Jul 28 00:45:20 2013	(r253725, copy of r253680, vendor/illumos/dist/cmd/dtrace/test/tst/common/aggs/tst.sizedkeys.d.out)
@@ -0,0 +1,6 @@
+
+        1        0               10
+                2        0               20
+        3        0               30
+                4        0               40
+

Copied: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.basics.d.out (from r253680, vendor/illumos/dist/cmd/dtrace/test/tst/common/arithmetic/tst.basics.d.out)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.basics.d.out	Sun Jul 28 00:45:20 2013	(r253725, copy of r253680, vendor/illumos/dist/cmd/dtrace/test/tst/common/arithmetic/tst.basics.d.out)
@@ -0,0 +1,8 @@
+The value of i is 6
+The value of i is 18
+The value of i is 72
+The value of i is 25920
+The value of i is 935761216
+The value of i is -91738734
+The value of i is -91738729
+

Copied: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.compcast.d (from r253680, vendor/illumos/dist/cmd/dtrace/test/tst/common/arithmetic/tst.compcast.d)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.compcast.d	Sun Jul 28 00:45:20 2013	(r253725, copy of r253680, vendor/illumos/dist/cmd/dtrace/test/tst/common/arithmetic/tst.compcast.d)
@@ -0,0 +1,50 @@
+/*
+ * CDDL HEADER START
+ *
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source.  A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2012 by Delphix. All rights reserved.
+ */
+
+/*
+ * Test compile-time casting between integer types of different size.
+ */
+
+#pragma D option quiet
+
+int64_t x;
+
+BEGIN
+{
+	x = (int32_t)(int16_t)0xfff0;
+	printf("%16x %20d %20u\n", x, x, x);
+	x = (int32_t)(uint16_t)0xfff0;
+	printf("%16x %20d %20u\n", x, x, x);
+	x = (uint32_t)(int16_t)0xfff0;
+	printf("%16x %20d %20u\n", x, x, x);
+	x = (uint32_t)(uint16_t)0xfff0;
+	printf("%16x %20d %20u\n", x, x, x);
+	printf("\n");
+
+	x = (int16_t)(int32_t)0xfff0;
+	printf("%16x %20d %20u\n", x, x, x);
+	x = (int16_t)(uint32_t)0xfff0;
+	printf("%16x %20d %20u\n", x, x, x);
+	x = (uint16_t)(int32_t)0xfff0;
+	printf("%16x %20d %20u\n", x, x, x);
+	x = (uint16_t)(uint32_t)0xfff0;
+	printf("%16x %20d %20u\n", x, x, x);
+
+	exit(0);
+}

Copied: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.compcast.d.out (from r253680, vendor/illumos/dist/cmd/dtrace/test/tst/common/arithmetic/tst.compcast.d.out)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.compcast.d.out	Sun Jul 28 00:45:20 2013	(r253725, copy of r253680, vendor/illumos/dist/cmd/dtrace/test/tst/common/arithmetic/tst.compcast.d.out)
@@ -0,0 +1,10 @@
+fffffffffffffff0                  -16 18446744073709551600
+            fff0                65520                65520
+        fffffff0           4294967280           4294967280
+            fff0                65520                65520
+
+fffffffffffffff0                  -16 18446744073709551600
+fffffffffffffff0                  -16 18446744073709551600
+            fff0                65520                65520
+            fff0                65520                65520
+

Copied: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.compnarrowassign.d (from r253680, vendor/illumos/dist/cmd/dtrace/test/tst/common/arithmetic/tst.compnarrowassign.d)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.compnarrowassign.d	Sun Jul 28 00:45:20 2013	(r253725, copy of r253680, vendor/illumos/dist/cmd/dtrace/test/tst/common/arithmetic/tst.compnarrowassign.d)
@@ -0,0 +1,36 @@
+/*
+ * CDDL HEADER START
+ *
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source.  A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2012 by Delphix. All rights reserved.
+ */
+
+/*
+ * Test narrowing at assignment.
+ */
+
+#pragma D option quiet
+
+uint16_t x;
+uint32_t y;
+
+BEGIN
+{
+	x = 0xbeefcafe;
+	y = x;
+	printf("%x", y); /* where's the beef? */
+
+	exit(0);
+}

Copied: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.compnarrowassign.d.out (from r253680, vendor/illumos/dist/cmd/dtrace/test/tst/common/arithmetic/tst.compnarrowassign.d.out)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.compnarrowassign.d.out	Sun Jul 28 00:45:20 2013	(r253725, copy of r253680, vendor/illumos/dist/cmd/dtrace/test/tst/common/arithmetic/tst.compnarrowassign.d.out)
@@ -0,0 +1 @@
+cafe

Copied: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.execcast.d (from r253680, vendor/illumos/dist/cmd/dtrace/test/tst/common/arithmetic/tst.execcast.d)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.execcast.d	Sun Jul 28 00:45:20 2013	(r253725, copy of r253680, vendor/illumos/dist/cmd/dtrace/test/tst/common/arithmetic/tst.execcast.d)
@@ -0,0 +1,52 @@
+/*
+ * CDDL HEADER START
+ *
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source.  A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2012 by Delphix. All rights reserved.
+ */
+
+/*
+ * Test execution-time casting between integer types of different size.
+ */
+
+#pragma D option quiet
+
+int64_t x;
+
+BEGIN
+{
+	z = 0xfff0;
+
+	x = (int32_t)(int16_t)z;
+	printf("%16x %20d %20u\n", x, x, x);
+	x = (int32_t)(uint16_t)z;
+	printf("%16x %20d %20u\n", x, x, x);
+	x = (uint32_t)(int16_t)z;
+	printf("%16x %20d %20u\n", x, x, x);
+	x = (uint32_t)(uint16_t)z;
+	printf("%16x %20d %20u\n", x, x, x);
+	printf("\n");
+
+	x = (int16_t)(int32_t)z;
+	printf("%16x %20d %20u\n", x, x, x);
+	x = (int16_t)(uint32_t)z;
+	printf("%16x %20d %20u\n", x, x, x);
+	x = (uint16_t)(int32_t)z;
+	printf("%16x %20d %20u\n", x, x, x);
+	x = (uint16_t)(uint32_t)z;
+	printf("%16x %20d %20u\n", x, x, x);
+
+	exit(0);
+}

Copied: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.execcast.d.out (from r253680, vendor/illumos/dist/cmd/dtrace/test/tst/common/arithmetic/tst.execcast.d.out)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.execcast.d.out	Sun Jul 28 00:45:20 2013	(r253725, copy of r253680, vendor/illumos/dist/cmd/dtrace/test/tst/common/arithmetic/tst.execcast.d.out)
@@ -0,0 +1,10 @@
+fffffffffffffff0                  -16 18446744073709551600
+            fff0                65520                65520
+        fffffff0           4294967280           4294967280
+            fff0                65520                65520
+
+fffffffffffffff0                  -16 18446744073709551600
+fffffffffffffff0                  -16 18446744073709551600
+            fff0                65520                65520
+            fff0                65520                65520
+

Copied: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/tst.dyn.d (from r253680, vendor/illumos/dist/cmd/dtrace/test/tst/common/print/tst.dyn.d)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/tst.dyn.d	Sun Jul 28 00:45:20 2013	(r253725, copy of r253680, vendor/illumos/dist/cmd/dtrace/test/tst/common/print/tst.dyn.d)
@@ -0,0 +1,28 @@
+/*
+ * CDDL HEADER START
+ *
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source.  A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2012 by Delphix. All rights reserved.
+ */
+
+BEGIN
+{
+	print(*curpsinfo);
+}
+
+BEGIN
+{
+	exit(0);
+}

Copied: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/tst.xlate.d (from r253680, vendor/illumos/dist/cmd/dtrace/test/tst/common/print/tst.xlate.d)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/tst.xlate.d	Sun Jul 28 00:45:20 2013	(r253725, copy of r253680, vendor/illumos/dist/cmd/dtrace/test/tst/common/print/tst.xlate.d)
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source.  A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2012 by Delphix. All rights reserved.
+ */
+
+#pragma D option quiet
+
+typedef struct pancakes {
+	int i;
+	string s;
+	timespec_t t;
+} pancakes_t;
+
+translator pancakes_t < void *V > {
+	i = 2 * 10;
+	s = strjoin("I like ", "pancakes");
+	t = *(timespec_t *)`dtrace_zero;
+};
+
+BEGIN
+{
+	print(*(xlate < pancakes_t * > ((void *)NULL)));
+}
+
+BEGIN
+{
+	exit(0);
+}

Copied: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/tst.xlate.d.out (from r253680, vendor/illumos/dist/cmd/dtrace/test/tst/common/print/tst.xlate.d.out)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/tst.xlate.d.out	Sun Jul 28 00:45:20 2013	(r253725, copy of r253680, vendor/illumos/dist/cmd/dtrace/test/tst/common/print/tst.xlate.d.out)
@@ -0,0 +1,8 @@
+pancakes_t {
+    int i = 0x14
+    string s = [ "I like pancakes" ]
+    timespec_t t = {
+        time_t tv_sec = 0
+        long tv_nsec = 0
+    }
+}

Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.ints.d.out
==============================================================================
--- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.ints.d.out	Sat Jul 27 22:44:55 2013	(r253724)
+++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.ints.d.out	Sun Jul 28 00:45:20 2013	(r253725)
@@ -1,6 +1,6 @@
 
-239
-52719
+-17
+-12817
 -1867788817
 1311768467294899695
 

Copied: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.signs.d (from r253680, vendor/illumos/dist/cmd/dtrace/test/tst/common/printf/tst.signs.d)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.signs.d	Sun Jul 28 00:45:20 2013	(r253725, copy of r253680, vendor/illumos/dist/cmd/dtrace/test/tst/common/printf/tst.signs.d)
@@ -0,0 +1,38 @@
+/*
+ * CDDL HEADER START
+ *
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source.  A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2012 by Delphix. All rights reserved.
+ */
+
+/*
+ * Check %d v. %i v. %u.
+ */
+
+#pragma D option quiet
+
+uint16_t x;
+int16_t y;
+
+BEGIN
+{
+	x = 0xffffffff;
+	y = 0xffffffff;
+
+	printf("%d %i %u\n", x, x, x);
+	printf("%d %i %u\n", y, y, y);
+
+	exit(0);
+}

Copied: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.signs.d.out (from r253680, vendor/illumos/dist/cmd/dtrace/test/tst/common/printf/tst.signs.d.out)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.signs.d.out	Sun Jul 28 00:45:20 2013	(r253725, copy of r253680, vendor/illumos/dist/cmd/dtrace/test/tst/common/printf/tst.signs.d.out)
@@ -0,0 +1,3 @@
+65535 -1 65535
+-1 -1 65535
+

Copied: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/trace/tst.dyn.d (from r253680, vendor/illumos/dist/cmd/dtrace/test/tst/common/trace/tst.dyn.d)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/trace/tst.dyn.d	Sun Jul 28 00:45:20 2013	(r253725, copy of r253680, vendor/illumos/dist/cmd/dtrace/test/tst/common/trace/tst.dyn.d)
@@ -0,0 +1,28 @@
+/*
+ * CDDL HEADER START
+ *
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source.  A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2012 by Delphix. All rights reserved.
+ */
+
+BEGIN
+{
+	trace(*curpsinfo);
+}
+
+BEGIN
+{
+	exit(0);
+}

Copied: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/translators/tst.TestTransStability1.ksh (from r253680, vendor/illumos/dist/cmd/dtrace/test/tst/common/translators/tst.TestTransStability1.ksh)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/translators/tst.TestTransStability1.ksh	Sun Jul 28 00:45:20 2013	(r253725, copy of r253680, vendor/illumos/dist/cmd/dtrace/test/tst/common/translators/tst.TestTransStability1.ksh)
@@ -0,0 +1,62 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#
+# Copyright (c) 2012 by Delphix. All rights reserved.
+#
+
+#
+# Test the output for stable translations.
+#
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -v -s /dev/stdin <<EOF
+
+#pragma D option quiet
+
+inline lwpsinfo_t *myinfo = xlate < lwpsinfo_t *> (curthread);
+
+#pragma D attributes Stable/Stable/Common myinfo
+
+BEGIN
+{
+	this->a = myinfo->pr_flag;
+	exit(0);
+}
+
+BEGIN
+{
+	exit(1);
+}
+EOF
+
+exit $?

Copied: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/translators/tst.TestTransStability1.ksh.out (from r253680, vendor/illumos/dist/cmd/dtrace/test/tst/common/translators/tst.TestTransStability1.ksh.out)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/translators/tst.TestTransStability1.ksh.out	Sun Jul 28 00:45:20 2013	(r253725, copy of r253680, vendor/illumos/dist/cmd/dtrace/test/tst/common/translators/tst.TestTransStability1.ksh.out)
@@ -0,0 +1,14 @@
+
+Stability attributes for script /dev/stdin:
+
+	Minimum Probe Description Attributes
+		Identifier Names: Unstable
+		Data Semantics:   Unstable
+		Dependency Class: Common
+
+	Minimum Statement Attributes
+		Identifier Names: Stable
+		Data Semantics:   Stable
+		Dependency Class: Common
+
+

Copied: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/translators/tst.TestTransStability2.ksh (from r253680, vendor/illumos/dist/cmd/dtrace/test/tst/common/translators/tst.TestTransStability2.ksh)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/translators/tst.TestTransStability2.ksh	Sun Jul 28 00:45:20 2013	(r253725, copy of r253680, vendor/illumos/dist/cmd/dtrace/test/tst/common/translators/tst.TestTransStability2.ksh)
@@ -0,0 +1,60 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Use is subject to license terms.
+#
+
+#
+# Copyright (c) 2012 by Delphix. All rights reserved.
+#
+
+#
+# Test the output of unstable translations.
+#
+
+if [ $# != 1 ]; then
+	echo expected one argument: '<'dtrace-path'>'
+	exit 2
+fi
+
+dtrace=$1
+
+$dtrace -v -s /dev/stdin <<EOF
+
+#pragma D option quiet
+
+inline lwpsinfo_t *myinfo = xlate < lwpsinfo_t *> (curthread);
+
+BEGIN
+{
+	this->a = myinfo->pr_flag;
+	exit(0);
+}
+
+BEGIN
+{
+	exit(1);
+}
+EOF
+
+exit $?

Copied: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/translators/tst.TestTransStability2.ksh.out (from r253680, vendor/illumos/dist/cmd/dtrace/test/tst/common/translators/tst.TestTransStability2.ksh.out)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/translators/tst.TestTransStability2.ksh.out	Sun Jul 28 00:45:20 2013	(r253725, copy of r253680, vendor/illumos/dist/cmd/dtrace/test/tst/common/translators/tst.TestTransStability2.ksh.out)
@@ -0,0 +1,14 @@
+
+Stability attributes for script /dev/stdin:
+
+	Minimum Probe Description Attributes
+		Identifier Names: Unstable
+		Data Semantics:   Unstable
+		Dependency Class: Common
+
+	Minimum Statement Attributes
+		Identifier Names: Private
+		Data Semantics:   Private
+		Dependency Class: Unknown
+
+

Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_aggregate.c
==============================================================================
--- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_aggregate.c	Sat Jul 27 22:44:55 2013	(r253724)
+++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_aggregate.c	Sun Jul 28 00:45:20 2013	(r253725)
@@ -26,6 +26,7 @@
 
 /*
  * Copyright (c) 2011, Joyent, Inc. All rights reserved.
+ * Copyright (c) 2012 by Delphix. All rights reserved.
  */
 
 #include <stdlib.h>
@@ -894,33 +895,14 @@ dt_aggregate_valcmp(const void *lhs, con
 	caddr_t rdata = rh->dtahe_data.dtada_data;
 	dtrace_recdesc_t *lrec, *rrec;
 	int64_t *laddr, *raddr;
-	int rval, i;
-
-	if ((rval = dt_aggregate_hashcmp(lhs, rhs)) != 0)
-		return (rval);
-
-	if (lagg->dtagd_nrecs > ragg->dtagd_nrecs)
-		return (DT_GREATERTHAN);
-
-	if (lagg->dtagd_nrecs < ragg->dtagd_nrecs)
-		return (DT_LESSTHAN);
+	int rval;
 
-	for (i = 0; i < lagg->dtagd_nrecs; i++) {
-		lrec = &lagg->dtagd_rec[i];
-		rrec = &ragg->dtagd_rec[i];
+	assert(lagg->dtagd_nrecs == ragg->dtagd_nrecs);
 
-		if (lrec->dtrd_offset < rrec->dtrd_offset)
-			return (DT_LESSTHAN);
-
-		if (lrec->dtrd_offset > rrec->dtrd_offset)
-			return (DT_GREATERTHAN);
+	lrec = &lagg->dtagd_rec[lagg->dtagd_nrecs - 1];
+	rrec = &ragg->dtagd_rec[ragg->dtagd_nrecs - 1];
 
-		if (lrec->dtrd_action < rrec->dtrd_action)
-			return (DT_LESSTHAN);
-
-		if (lrec->dtrd_action > rrec->dtrd_action)
-			return (DT_GREATERTHAN);
-	}
+	assert(lrec->dtrd_action == rrec->dtrd_action);
 
 	laddr = (int64_t *)(uintptr_t)(ldata + lrec->dtrd_offset);
 	raddr = (int64_t *)(uintptr_t)(rdata + rrec->dtrd_offset);

Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c
==============================================================================
--- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c	Sat Jul 27 22:44:55 2013	(r253724)
+++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c	Sun Jul 28 00:45:20 2013	(r253725)
@@ -22,7 +22,7 @@
 /*
  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2011, Joyent Inc. All rights reserved.
- * Copyright (c) 2011 by Delphix. All rights reserved.
+ * Copyright (c) 2012 by Delphix. All rights reserved.
  */
 
 /*
@@ -664,63 +664,48 @@ static void
 dt_action_trace(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp)
 {
 	dtrace_actdesc_t *ap = dt_stmt_action(dtp, sdp);
+	boolean_t istrace = (dnp->dn_ident->di_id == DT_ACT_TRACE);
+	const char *act = istrace ?  "trace" : "print";
 
 	if (dt_node_is_void(dnp->dn_args)) {
-		dnerror(dnp->dn_args, D_TRACE_VOID,
-		    "trace( ) may not be applied to a void expression\n");
+		dnerror(dnp->dn_args, istrace ? D_TRACE_VOID : D_PRINT_VOID,
+		    "%s( ) may not be applied to a void expression\n", act);
 	}
 
-	if (dt_node_is_dynamic(dnp->dn_args)) {
-		dnerror(dnp->dn_args, D_TRACE_DYN,
-		    "trace( ) may not be applied to a dynamic expression\n");
+	if (dt_node_resolve(dnp->dn_args, DT_IDENT_XLPTR) != NULL) {
+		dnerror(dnp->dn_args, istrace ? D_TRACE_DYN : D_PRINT_DYN,
+		    "%s( ) may not be applied to a translated pointer\n", act);
 	}
 
 	dt_cg(yypcb, dnp->dn_args);
-	ap->dtad_difo = dt_as(yypcb);
-	ap->dtad_kind = DTRACEACT_DIFEXPR;
-}
 
-/*
- * The print() action behaves identically to trace(), except that it stores the
- * CTF type of the argument (if present) within the DOF for the DIFEXPR action.
- * To do this, we set the 'dtsd_strdata' to point to the fully-qualified CTF
- * type ID for the result of the DIF action.  We use the ID instead of the name
- * to handles complex types like arrays and function pointers that can't be
- * resolved by ctf_type_lookup().  This is later processed by
- * dtrace_dof_create() and turned into a reference into the string table so
- * that we can get the type information when we process the data after the
- * fact.
- */
-static void
-dt_action_print(dtrace_hdl_t *dtp, dt_node_t *dnp, dtrace_stmtdesc_t *sdp)
-{
-	dtrace_actdesc_t *ap = dt_stmt_action(dtp, sdp);
-	dt_node_t *dret;
-	size_t len;
-	dt_module_t *dmp;
-
-	if (dt_node_is_void(dnp->dn_args)) {
-		dnerror(dnp->dn_args, D_PRINT_VOID,
-		    "print( ) may not be applied to a void expression\n");
-	}
-
-	if (dt_node_is_dynamic(dnp->dn_args)) {
-		dnerror(dnp->dn_args, D_PRINT_DYN,
-		    "print( ) may not be applied to a dynamic expression\n");
+	/*
+	 * The print() action behaves identically to trace(), except that it
+	 * stores the CTF type of the argument (if present) within the DOF for
+	 * the DIFEXPR action.  To do this, we set the 'dtsd_strdata' to point
+	 * to the fully-qualified CTF type ID for the result of the DIF
+	 * action.  We use the ID instead of the name to handles complex types
+	 * like arrays and function pointers that can't be resolved by
+	 * ctf_type_lookup().  This is later processed by dtrace_dof_create()
+	 * and turned into a reference into the string table so that we can
+	 * get the type information when we process the data after the fact.
+	 */
+	if (dnp->dn_ident->di_id == DT_ACT_PRINT) {
+		dt_node_t *dret;
+		size_t n;
+		dt_module_t *dmp;
+
+		dret = yypcb->pcb_dret;
+		dmp = dt_module_lookup_by_ctf(dtp, dret->dn_ctfp);
+
+		n = snprintf(NULL, 0, "%s`%ld", dmp->dm_name, dret->dn_type) + 1;
+		sdp->dtsd_strdata = dt_alloc(dtp, n);
+		if (sdp->dtsd_strdata == NULL)
+			longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
+		(void) snprintf(sdp->dtsd_strdata, n, "%s`%ld", dmp->dm_name,
+		    dret->dn_type);
 	}
 
-	dt_cg(yypcb, dnp->dn_args);
-
-	dret = yypcb->pcb_dret;
-	dmp = dt_module_lookup_by_ctf(dtp, dret->dn_ctfp);
-
-	len = snprintf(NULL, 0, "%s`%ld", dmp->dm_name, dret->dn_type) + 1;
-	sdp->dtsd_strdata = dt_alloc(dtp, len);
-	if (sdp->dtsd_strdata == NULL)
-		longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
-	(void) snprintf(sdp->dtsd_strdata, len, "%s`%ld", dmp->dm_name,
-	    dret->dn_type);
-
 	ap->dtad_difo = dt_as(yypcb);
 	ap->dtad_kind = DTRACEACT_DIFEXPR;
 }
@@ -1145,6 +1130,9 @@ dt_compile_fun(dtrace_hdl_t *dtp, dt_nod
 	case DT_ACT_PANIC:
 		dt_action_panic(dtp, dnp->dn_expr, sdp);
 		break;
+	case DT_ACT_PRINT:
+		dt_action_trace(dtp, dnp->dn_expr, sdp);
+		break;
 	case DT_ACT_PRINTA:
 		dt_action_printa(dtp, dnp->dn_expr, sdp);
 		break;
@@ -1181,9 +1169,6 @@ dt_compile_fun(dtrace_hdl_t *dtp, dt_nod
 	case DT_ACT_TRACE:
 		dt_action_trace(dtp, dnp->dn_expr, sdp);
 		break;
-	case DT_ACT_PRINT:
-		dt_action_print(dtp, dnp->dn_expr, sdp);
-		break;
 	case DT_ACT_TRACEMEM:
 		dt_action_tracemem(dtp, dnp->dn_expr, sdp);
 		break;
@@ -2559,7 +2544,8 @@ dt_compile(dtrace_hdl_t *dtp, int contex
 	}
 
 out:
-	if (context != DT_CTX_DTYPE && DT_TREEDUMP_PASS(dtp, 3))
+	if (context != DT_CTX_DTYPE && yypcb->pcb_root != NULL &&
+	    DT_TREEDUMP_PASS(dtp, 3))
 		dt_node_printr(yypcb->pcb_root, stderr, 0);
 
 	if (dtp->dt_cdefs_fd != -1 && (ftruncate64(dtp->dt_cdefs_fd, 0) == -1 ||

Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cg.c
==============================================================================
--- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cg.c	Sat Jul 27 22:44:55 2013	(r253724)
+++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cg.c	Sun Jul 28 00:45:20 2013	(r253725)
@@ -1387,6 +1387,162 @@ dt_cg_func_typeref(dtrace_hdl_t *dtp, dt
 	typs->dn_value = ctf_type_size(dtt.dtt_ctfp, dtt.dtt_type);
 }
 
+typedef struct dt_xlmemb {
+	dt_ident_t *dtxl_idp;		/* translated ident */
+	dt_irlist_t *dtxl_dlp;		/* instruction list */
+	dt_regset_t *dtxl_drp;		/* register set */
+	int dtxl_sreg;			/* location of the translation input */
+	int dtxl_dreg;			/* location of our allocated buffer */
+} dt_xlmemb_t;
+
+/*ARGSUSED*/
+static int
+dt_cg_xlate_member(const char *name, ctf_id_t type, ulong_t off, void *arg)
+{
+	dt_xlmemb_t *dx = arg;
+	dt_ident_t *idp = dx->dtxl_idp;
+	dt_irlist_t *dlp = dx->dtxl_dlp;
+	dt_regset_t *drp = dx->dtxl_drp;
+
+	dt_node_t *mnp;
+	dt_xlator_t *dxp;
+
+	int reg, treg;
+	uint32_t instr;
+	size_t size;
+
+	/* Generate code for the translation. */
+	dxp = idp->di_data;
+	mnp = dt_xlator_member(dxp, name);
+
+	/* If there's no translator for the given member, skip it. */
+	if (mnp == NULL)
+		return (0);
+
+	dxp->dx_ident->di_flags |= DT_IDFLG_CGREG;
+	dxp->dx_ident->di_id = dx->dtxl_sreg;
+
+	dt_cg_node(mnp->dn_membexpr, dlp, drp);
+
+	dxp->dx_ident->di_flags &= ~DT_IDFLG_CGREG;
+	dxp->dx_ident->di_id = 0;
+
+	treg = mnp->dn_membexpr->dn_reg;
+
+	/* Compute the offset into our buffer and store the result there. */
+	reg = dt_regset_alloc(drp);
+
+	dt_cg_setx(dlp, reg, off / NBBY);
+	instr = DIF_INSTR_FMT(DIF_OP_ADD, dx->dtxl_dreg, reg, reg);
+	dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+
+	size = ctf_type_size(mnp->dn_membexpr->dn_ctfp,
+	    mnp->dn_membexpr->dn_type);
+	if (dt_node_is_scalar(mnp->dn_membexpr)) {
+		/*
+		 * Copying scalars is simple.
+		 */
+		switch (size) {
+		case 1:
+			instr = DIF_INSTR_STORE(DIF_OP_STB, treg, reg);
+			break;
+		case 2:
+			instr = DIF_INSTR_STORE(DIF_OP_STH, treg, reg);
+			break;
+		case 4:
+			instr = DIF_INSTR_STORE(DIF_OP_STW, treg, reg);
+			break;
+		case 8:
+			instr = DIF_INSTR_STORE(DIF_OP_STX, treg, reg);
+			break;
+		default:
+			xyerror(D_UNKNOWN, "internal error -- unexpected "
+			    "size: %lu\n", (ulong_t)size);
+		}
+
+		dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+
+	} else if (dt_node_is_string(mnp->dn_membexpr)) {
+		int szreg;
+
+		/*
+		 * Use the copys instruction for strings.
+		 */
+		szreg = dt_regset_alloc(drp);
+		dt_cg_setx(dlp, szreg, size);
+		instr = DIF_INSTR_COPYS(treg, szreg, reg);
+		dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+		dt_regset_free(drp, szreg);
+	} else {
+		int szreg;
+
+		/*
+		 * If it's anything else then we'll just bcopy it.
+		 */
+		szreg = dt_regset_alloc(drp);
+		dt_cg_setx(dlp, szreg, size);
+		dt_irlist_append(dlp,
+		    dt_cg_node_alloc(DT_LBL_NONE, DIF_INSTR_FLUSHTS));
+		instr = DIF_INSTR_PUSHTS(DIF_OP_PUSHTV, DIF_TYPE_CTF,
+		    DIF_REG_R0, treg);
+		dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+		instr = DIF_INSTR_PUSHTS(DIF_OP_PUSHTV, DIF_TYPE_CTF,
+		    DIF_REG_R0, reg);
+		dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+		instr = DIF_INSTR_PUSHTS(DIF_OP_PUSHTV, DIF_TYPE_CTF,
+		    DIF_REG_R0, szreg);
+		dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+		instr = DIF_INSTR_CALL(DIF_SUBR_BCOPY, szreg);
+		dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+		dt_regset_free(drp, szreg);
+	}
+
+	dt_regset_free(drp, reg);
+	dt_regset_free(drp, treg);
+
+	return (0);
+}
+
+/*
+ * If we're expanding a translated type, we create an appropriately sized
+ * buffer with alloca() and then translate each member into it.
+ */
+static int
+dt_cg_xlate_expand(dt_node_t *dnp, dt_ident_t *idp, dt_irlist_t *dlp,
+    dt_regset_t *drp)
+{
+	dt_xlmemb_t dlm;
+	uint32_t instr;
+	int dreg;
+	size_t size;
+
+	dreg = dt_regset_alloc(drp);
+	size = ctf_type_size(dnp->dn_ident->di_ctfp, dnp->dn_ident->di_type);
+
+	/* Call alloca() to create the buffer. */
+	dt_cg_setx(dlp, dreg, size);
+
+	dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, DIF_INSTR_FLUSHTS));
+
+	instr = DIF_INSTR_PUSHTS(DIF_OP_PUSHTV, DIF_TYPE_CTF, DIF_REG_R0, dreg);
+	dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+
+	instr = DIF_INSTR_CALL(DIF_SUBR_ALLOCA, dreg);
+	dt_irlist_append(dlp, dt_cg_node_alloc(DT_LBL_NONE, instr));
+
+	/* Generate the translation for each member. */
+	dlm.dtxl_idp = idp;
+	dlm.dtxl_dlp = dlp;
+	dlm.dtxl_drp = drp;
+	dlm.dtxl_sreg = dnp->dn_reg;
+	dlm.dtxl_dreg = dreg;
+	(void) ctf_member_iter(dnp->dn_ident->di_ctfp,
+	    dnp->dn_ident->di_type, dt_cg_xlate_member,
+	    &dlm);
+
+	return (dreg);
+}
+
 static void
 dt_cg_node(dt_node_t *dnp, dt_irlist_t *dlp, dt_regset_t *drp)
 {
@@ -1600,7 +1756,16 @@ dt_cg_node(dt_node_t *dnp, dt_irlist_t *
 		dt_cg_node(dnp->dn_child, dlp, drp);
 		dnp->dn_reg = dnp->dn_child->dn_reg;
 
-		if (!(dnp->dn_flags & DT_NF_REF)) {
+		if (dt_node_is_dynamic(dnp->dn_child)) {
+			int reg;
+			idp = dt_node_resolve(dnp->dn_child, DT_IDENT_XLPTR);
+			assert(idp != NULL);
+			reg = dt_cg_xlate_expand(dnp, idp, dlp, drp);
+
+			dt_regset_free(drp, dnp->dn_child->dn_reg);
+			dnp->dn_reg = reg;
+
+		} else if (!(dnp->dn_flags & DT_NF_REF)) {
 			uint_t ubit = dnp->dn_flags & DT_NF_USERLAND;
 
 			/*
@@ -1998,6 +2163,13 @@ dt_cg(dt_pcb_t *pcb, dt_node_t *dnp)
 
 	dt_cg_node(dnp, &pcb->pcb_ir, pcb->pcb_regs);
 
+	if ((idp = dt_node_resolve(dnp, DT_IDENT_XLSOU)) != NULL) {
+		int reg = dt_cg_xlate_expand(dnp, idp,
+		    &pcb->pcb_ir, pcb->pcb_regs);
+		dt_regset_free(pcb->pcb_regs, dnp->dn_reg);
+		dnp->dn_reg = reg;
+	}
+
 	instr = DIF_INSTR_RET(dnp->dn_reg);
 	dt_regset_free(pcb->pcb_regs, dnp->dn_reg);
 	dt_irlist_append(&pcb->pcb_ir, dt_cg_node_alloc(DT_LBL_NONE, instr));

Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c
==============================================================================
--- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c	Sat Jul 27 22:44:55 2013	(r253724)
+++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c	Sun Jul 28 00:45:20 2013	(r253725)
@@ -2018,13 +2018,13 @@ dt_consume_cpu(dtrace_hdl_t *dtp, FILE *
 	uint64_t tracememsize = 0;
 	dtrace_probedata_t data;
 	uint64_t drops;
-	data.dtpda_flow = dtp->dt_flow;
-	data.dtpda_indent = dtp->dt_indent;
-	data.dtpda_prefix = dtp->dt_prefix;
 
 	bzero(&data, sizeof (data));
 	data.dtpda_handle = dtp;
 	data.dtpda_cpu = cpu;
+	data.dtpda_flow = dtp->dt_flow;
+	data.dtpda_indent = dtp->dt_indent;
+	data.dtpda_prefix = dtp->dt_prefix;
 
 	for (offs = buf->dtbd_oldest; offs < buf->dtbd_size; ) {
 		dtrace_eprobedesc_t *epd;
@@ -2611,7 +2611,7 @@ typedef struct dt_begin {
 static int
 dt_consume_begin_probe(const dtrace_probedata_t *data, void *arg)
 {
-	dt_begin_t *begin = (dt_begin_t *)arg;
+	dt_begin_t *begin = arg;
 	dtrace_probedesc_t *pd = data->dtpda_pdesc;
 
 	int r1 = (strcmp(pd->dtpd_provider, "dtrace") == 0);
@@ -2636,7 +2636,7 @@ static int
 dt_consume_begin_record(const dtrace_probedata_t *data,
     const dtrace_recdesc_t *rec, void *arg)
 {
-	dt_begin_t *begin = (dt_begin_t *)arg;

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-src-head mailing list