Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 Jun 2014 01:24:47 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org
Subject:   svn commit: r266989 - vendor-sys/illumos/dist/uts/common/dtrace vendor-sys/illumos/dist/uts/common/sys vendor/illumos/dist/cmd/dtrace vendor/illumos/dist/cmd/dtrace/test/tst/common/pid vendor/illum...
Message-ID:  <201406030124.s531Ol97043176@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Tue Jun  3 01:24:46 2014
New Revision: 266989
URL: http://svnweb.freebsd.org/changeset/base/266989

Log:
  4474 DTrace Userland CTF Support
  4475 DTrace userland Keyword
  4476 DTrace tests should be better citizens
  4479 pid provider types
  4480 dof emulation is missing checks
  
  illumos/illumos-gate@a386cc11a86ecb60f5a48078d22c1500e2ad003e

Added:
  vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/
  vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/err.invalidpid.d   (contents, props changed)
  vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/err.invalidpid2.d   (contents, props changed)
  vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/err.invalidpid3.d   (contents, props changed)
  vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/err.invalidtype.ksh
  vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/err.invalidtype2.ksh
  vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/err.user64mode.ksh
  vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.aouttype.c   (contents, props changed)
  vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.aouttype.ksh
  vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.chasestrings.c   (contents, props changed)
  vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.chasestrings.ksh
  vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.chasestrings.ksh.out
  vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.libtype.c   (contents, props changed)
  vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.libtype.ksh
  vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.linkmap.ksh
  vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.pidprint.ksh
  vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.pidprinttarg.ksh
  vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.printtype.c   (contents, props changed)
  vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.printtype.ksh
  vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.printtype.ksh.out
  vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.printtypetarg.ksh
  vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.userlandkey.ksh
  vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.userlandkey.ksh.out
  vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.userstrings.ksh
  vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.userstrings.ksh.out
Modified:
  vendor/illumos/dist/cmd/dtrace/dtrace.c
  vendor/illumos/dist/cmd/dtrace/test/tst/common/pid/tst.provregex1.ksh
  vendor/illumos/dist/cmd/dtrace/test/tst/common/pid/tst.provregex2.ksh
  vendor/illumos/dist/cmd/dtrace/test/tst/common/pid/tst.provregex3.ksh
  vendor/illumos/dist/cmd/dtrace/test/tst/common/pid/tst.provregex4.ksh
  vendor/illumos/dist/cmd/dtrace/test/tst/common/printa/tst.largeusersym.ksh
  vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.corruptenv.ksh
  vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.dlclose1.ksh
  vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.dlclose2.ksh
  vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.dlclose3.ksh
  vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.eliminate.ksh
  vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.enabled.ksh
  vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.enabled2.ksh
  vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.entryreturn.ksh
  vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.fork.ksh
  vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.header.ksh
  vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.linkpriv.ksh
  vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.linkunpriv.ksh
  vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.multiple.ksh
  vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.multiprov.ksh
  vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.noprobes.ksh
  vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.noreap.ksh
  vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.noreapring.ksh
  vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.onlyenabled.ksh
  vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.reap.ksh
  vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.reeval.ksh
  vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.static.ksh
  vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.static2.ksh
  vendor/illumos/dist/cmd/dtrace/test/tst/common/usdt/tst.user.ksh
  vendor/illumos/dist/cmd/dtrace/test/tst/sparc/usdt/tst.tailcall.ksh
  vendor/illumos/dist/common/ctf/ctf_open.c
  vendor/illumos/dist/common/ctf/ctf_types.c
  vendor/illumos/dist/lib/libdtrace/common/dt_as.c
  vendor/illumos/dist/lib/libdtrace/common/dt_cc.c
  vendor/illumos/dist/lib/libdtrace/common/dt_decl.c
  vendor/illumos/dist/lib/libdtrace/common/dt_decl.h
  vendor/illumos/dist/lib/libdtrace/common/dt_dis.c
  vendor/illumos/dist/lib/libdtrace/common/dt_error.c
  vendor/illumos/dist/lib/libdtrace/common/dt_grammar.y
  vendor/illumos/dist/lib/libdtrace/common/dt_ident.c
  vendor/illumos/dist/lib/libdtrace/common/dt_impl.h
  vendor/illumos/dist/lib/libdtrace/common/dt_lex.l
  vendor/illumos/dist/lib/libdtrace/common/dt_module.c
  vendor/illumos/dist/lib/libdtrace/common/dt_module.h
  vendor/illumos/dist/lib/libdtrace/common/dt_open.c
  vendor/illumos/dist/lib/libdtrace/common/dt_parser.c
  vendor/illumos/dist/lib/libdtrace/common/dt_parser.h
  vendor/illumos/dist/lib/libdtrace/common/dt_pid.c
  vendor/illumos/dist/lib/libdtrace/common/dt_pid.h
  vendor/illumos/dist/lib/libdtrace/common/dt_print.c
  vendor/illumos/dist/lib/libdtrace/common/dt_printf.c
  vendor/illumos/dist/lib/libdtrace/common/dt_provider.c
  vendor/illumos/dist/lib/libdtrace/common/dt_xlator.c
  vendor/illumos/dist/lib/libdtrace/common/dtrace.h

Changes in other areas also in this revision:
Modified:
  vendor-sys/illumos/dist/uts/common/dtrace/dtrace.c
  vendor-sys/illumos/dist/uts/common/sys/ctf_api.h
  vendor-sys/illumos/dist/uts/common/sys/dtrace.h

Modified: vendor/illumos/dist/cmd/dtrace/dtrace.c
==============================================================================
--- vendor/illumos/dist/cmd/dtrace/dtrace.c	Tue Jun  3 01:16:11 2014	(r266988)
+++ vendor/illumos/dist/cmd/dtrace/dtrace.c	Tue Jun  3 01:24:46 2014	(r266989)
@@ -25,6 +25,7 @@
  */
 /*
  * Copyright (c) 2012 by Delphix. All rights reserved.
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
  */
 
 #include <sys/types.h>
@@ -488,6 +489,7 @@ static void
 print_probe_info(const dtrace_probeinfo_t *p)
 {
 	char buf[BUFSIZ];
+	char *user;
 	int i;
 
 	oprintf("\n\tProbe Description Attributes\n");
@@ -511,10 +513,14 @@ print_probe_info(const dtrace_probeinfo_
 	oprintf("\n\tArgument Types\n");
 
 	for (i = 0; i < p->dtp_argc; i++) {
+		if (p->dtp_argv[i].dtt_flags & DTT_FL_USER)
+			user = "userland ";
+		else
+			user = "";
 		if (ctf_type_name(p->dtp_argv[i].dtt_ctfp,
 		    p->dtp_argv[i].dtt_type, buf, sizeof (buf)) == NULL)
 			(void) strlcpy(buf, "(unknown)", sizeof (buf));
-		oprintf("\t\targs[%d]: %s\n", i, buf);
+		oprintf("\t\targs[%d]: %s%s\n", i, user, buf);
 	}
 
 	if (p->dtp_argc == 0)

Modified: vendor/illumos/dist/cmd/dtrace/test/tst/common/pid/tst.provregex1.ksh
==============================================================================
--- vendor/illumos/dist/cmd/dtrace/test/tst/common/pid/tst.provregex1.ksh	Tue Jun  3 01:16:11 2014	(r266988)
+++ vendor/illumos/dist/cmd/dtrace/test/tst/common/pid/tst.provregex1.ksh	Tue Jun  3 01:24:46 2014	(r266989)
@@ -45,10 +45,10 @@ cat > Makefile <<EOF
 all: main
 
 main: main.o
-	gcc -o main main.o
+	gcc -m32 -o main main.o
 
 main.o: main.c
-	gcc -c main.c
+	gcc -m32 -c main.c
 EOF
 
 cat > main.c <<EOF

Modified: vendor/illumos/dist/cmd/dtrace/test/tst/common/pid/tst.provregex2.ksh
==============================================================================
--- vendor/illumos/dist/cmd/dtrace/test/tst/common/pid/tst.provregex2.ksh	Tue Jun  3 01:16:11 2014	(r266988)
+++ vendor/illumos/dist/cmd/dtrace/test/tst/common/pid/tst.provregex2.ksh	Tue Jun  3 01:24:46 2014	(r266989)
@@ -45,16 +45,16 @@ cat > Makefile <<EOF
 all: main altlib.so
 
 main: main.o
-	gcc -o main main.o
+	gcc -m32 -o main main.o
 
 main.o: main.c
-	gcc -c main.c
+	gcc -m32 -c main.c
 
 altlib.so: altlib.o
-	gcc -shared -o altlib.so altlib.o -lc
+	gcc -m32 -shared -o altlib.so altlib.o -lc
 
 altlib.o: altlib.c
-	gcc -c altlib.c
+	gcc -m32 -fPIC -c altlib.c
 EOF
 
 cat > altlib.c <<EOF

Modified: vendor/illumos/dist/cmd/dtrace/test/tst/common/pid/tst.provregex3.ksh
==============================================================================
--- vendor/illumos/dist/cmd/dtrace/test/tst/common/pid/tst.provregex3.ksh	Tue Jun  3 01:16:11 2014	(r266988)
+++ vendor/illumos/dist/cmd/dtrace/test/tst/common/pid/tst.provregex3.ksh	Tue Jun  3 01:24:46 2014	(r266989)
@@ -46,10 +46,10 @@ cat > Makefile <<EOF
 all: main
 
 main: main.o prov.o
-	gcc -o main main.o prov.o
+	gcc -m32 -o main main.o prov.o
 
 main.o: main.c prov.h
-	gcc -c main.c
+	gcc -m32 -c main.c
 
 prov.h: prov.d
 	$dtrace -h -s prov.d

Modified: vendor/illumos/dist/cmd/dtrace/test/tst/common/pid/tst.provregex4.ksh
==============================================================================
--- vendor/illumos/dist/cmd/dtrace/test/tst/common/pid/tst.provregex4.ksh	Tue Jun  3 01:16:11 2014	(r266988)
+++ vendor/illumos/dist/cmd/dtrace/test/tst/common/pid/tst.provregex4.ksh	Tue Jun  3 01:24:46 2014	(r266989)
@@ -46,10 +46,10 @@ cat > Makefile <<EOF
 all: main altlib.so
 
 main: main.o provmain.o
-	gcc -o main main.o provmain.o
+	gcc -m32 -o main main.o provmain.o
 
 main.o: main.c prov.h
-	gcc -c main.c
+	gcc -m32 -c main.c
 
 prov.h: prov.d
 	$dtrace -h -s prov.d
@@ -58,10 +58,10 @@ provmain.o: prov.d main.o
 	$dtrace -G -32 -o provmain.o -s prov.d main.o
 
 altlib.so: altlib.o provalt.o
-	gcc -shared -o altlib.so altlib.o provalt.o -lc
+	gcc -m32 -shared -o altlib.so altlib.o provalt.o -lc
 
 altlib.o: altlib.c prov.h
-	gcc -c altlib.c
+	gcc -m32 -c altlib.c
 
 provalt.o: prov.d altlib.o
 	$dtrace -G -32 -o provalt.o -s prov.d altlib.o

Modified: vendor/illumos/dist/cmd/dtrace/test/tst/common/printa/tst.largeusersym.ksh
==============================================================================
--- vendor/illumos/dist/cmd/dtrace/test/tst/common/printa/tst.largeusersym.ksh	Tue Jun  3 01:16:11 2014	(r266988)
+++ vendor/illumos/dist/cmd/dtrace/test/tst/common/printa/tst.largeusersym.ksh	Tue Jun  3 01:24:46 2014	(r266989)
@@ -50,7 +50,7 @@ main(int argc, char *argv[])
 }
 EOF
 
-gcc -o test test.c
+gcc -m32 -o test test.c
 if [ $? -ne 0 ]; then
 	print -u2 "failed to compile test.c"
 	exit 1

Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/err.invalidpid.d
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/err.invalidpid.d	Tue Jun  3 01:24:46 2014	(r266989)
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+
+/*
+ * Copyright (c) 2013 Joyent, Inc.  All rights reserved.
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	trace((pidfoo`int)0);
+}

Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/err.invalidpid2.d
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/err.invalidpid2.d	Tue Jun  3 01:24:46 2014	(r266989)
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+
+/*
+ * Copyright (c) 2013 Joyent, Inc.  All rights reserved.
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	trace((pid8foo`int)0);
+}

Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/err.invalidpid3.d
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/err.invalidpid3.d	Tue Jun  3 01:24:46 2014	(r266989)
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+
+/*
+ * Copyright (c) 2013 Joyent, Inc.  All rights reserved.
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+	trace((pid0`int)0);
+}

Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/err.invalidtype.ksh
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/err.invalidtype.ksh	Tue Jun  3 01:24:46 2014	(r266989)
@@ -0,0 +1,34 @@
+#! /usr/bin/ksh
+#
+#
+# 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.
+#
+
+#
+# Copyright (c) 2013 Joyent, Inc. All rights reserved.
+#
+
+#
+# While it's hard to be completely certain that a type of the name we want
+# doesn't exist, we're going to try to pick a name which is rather unique.
+#
+
+if [ $# != 1 ]; then
+        echo expected one argument: '<'dtrace-path'>'
+        exit 2
+fi
+
+dtrace=$1
+t="season_8_mountain_of_madness_t"
+pid=$$
+
+rc=`$dtrace -n "BEGIN{ trace(pid$pid`$t)0); }"`
+
+exit $rc

Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/err.invalidtype2.ksh
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/err.invalidtype2.ksh	Tue Jun  3 01:24:46 2014	(r266989)
@@ -0,0 +1,35 @@
+#! /usr/bin/ksh
+#
+#
+# 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.
+#
+
+#
+# Copyright (c) 2013 Joyent, Inc. All rights reserved.
+#
+
+#
+# While it's hard to be completely certain that a type of the name we want
+# doesn't exist, we're going to try to pick a name which is rather
+# unique. This time we're also going to use the pid$target alias.
+#
+
+if [ $# != 1 ]; then
+        echo expected one argument: '<'dtrace-path'>'
+        exit 2
+fi
+
+dtrace=$1
+t="season_8_mountain_of_madness_t"
+pid=$$
+
+rc=`$dtrace -n "BEGIN{ trace(pid`$t)0); }"` -p $pid
+
+exit $rc

Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/err.user64mode.ksh
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/err.user64mode.ksh	Tue Jun  3 01:24:46 2014	(r266989)
@@ -0,0 +1,90 @@
+#! /usr/bin/ksh
+#
+#
+# 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.
+#
+
+#
+# Copyright (c) 2013 Joyent, Inc. All rights reserved.
+#
+
+#
+# This test is purposefully using a 64-bit DTrace and thus 64-bit types
+# when compared with a 32-bit process. This test uses the userland
+# keyword and so the implicit copyin should access illegal memory and
+# thus exit.
+#
+
+if [ $# != 1 ]; then
+        echo expected one argument: '<'dtrace-path'>'
+        exit 2
+fi
+
+dtrace=$1
+t="zelda_info_t"
+exe="tst.chasestrings.exe"
+
+elfdump "./$exe" | grep -q '.SUNW_ctf' 
+if [[ $? -ne 0 ]]; then
+	echo "CTF does not exist in $exe, that's a bug" >&2
+	exit 1
+fi
+
+./$exe &
+pid=$!
+
+$dtrace -64 -qs /dev/stdin <<EOF
+typedef struct info {
+        char    *zi_gamename;
+        int     zi_ndungeons;
+        char    *zi_villain;
+        int     zi_haszelda;
+} info_t;
+
+pid$pid::has_princess:entry
+/next == 0/
+{
+	this->t = (userland info_t *)arg0;
+	printf("game: %s, dungeon: %d, villain: %s, zelda: %d\n",
+	    stringof(this->t->zi_gamename), this->t->zi_ndungeons,
+	    stringof(this->t->zi_villain), this->t->zi_haszelda);
+	next = 1;
+}
+
+pid$pid::has_dungeons:entry
+/next == 1/
+{
+	this->t = (userland info_t *)arg0;
+	printf("game: %s, dungeon: %d, villain: %s, zelda: %d\n",
+	    stringof(this->t->zi_gamename), this->t->zi_ndungeons,
+	    stringof(this->t->zi_villain), this->t->zi_haszelda);
+	next = 2;
+}
+
+pid$pid::has_villain:entry
+/next == 2/
+{
+	this->t = (userland info_t *)arg0;
+	printf("game: %s, dungeon: %d, villain: %s, zelda: %d\n",
+	    stringof(this->t->zi_gamename), this->t->zi_ndungeons,
+	    stringof(this->t->zi_villain), this->t->zi_haszelda);
+	exit(0);
+}
+
+ERROR
+{
+	exit(1);
+}
+EOF
+rc=$?
+
+kill -9 $pid
+
+exit $rc

Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.aouttype.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.aouttype.c	Tue Jun  3 01:24:46 2014	(r266989)
@@ -0,0 +1,46 @@
+/*
+ * 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.
+ */
+
+/*
+ * Copyright 2013 (c) Joyent, Inc. All rights reserved.
+ */
+
+/*
+ * This test tries to make sure that we have CTF data for a type that only this
+ * binary would reasonably have. In this case, the
+ * season_7_lisa_the_vegetarian_t.
+ */
+#include <unistd.h>
+
+typedef struct season_7_lisa_the_vegetarian {
+	int fr_salad;
+} season_7_lisa_the_vegetarian_t;
+
+int
+sleeper(season_7_lisa_the_vegetarian_t *lp)
+{
+	for (;;) {
+		sleep(lp->fr_salad);
+	}
+	/*NOTREACHED*/
+	return (0);
+}
+
+int
+main(void)
+{
+	season_7_lisa_the_vegetarian_t l;
+	l.fr_salad = 100;
+
+	sleeper(&l);
+
+	return (0);
+}

Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.aouttype.ksh
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.aouttype.ksh	Tue Jun  3 01:24:46 2014	(r266989)
@@ -0,0 +1,44 @@
+#! /usr/bin/ksh
+#
+#
+# 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.
+#
+
+#
+# Copyright (c) 2013 Joyent, Inc. All rights reserved.
+#
+
+#
+# Lookup a type that is inside a.out.
+#
+
+if [ $# != 1 ]; then
+        echo expected one argument: '<'dtrace-path'>'
+        exit 2
+fi
+
+dtrace=$1
+t="season_7_lisa_the_vegetrian_t *"
+exe="tst.aouttype.exe"
+
+elfdump "./$exe" | grep -q '.SUNW_ctf' 
+if [[ $? -ne 0 ]]; then
+	echo "CTF does not exist in $exe, that's a bug" >&2
+	exit 1
+fi
+
+./$exe &
+pid=$!
+
+rc=`$dtrace -n "BEGIN{ trace((pid$pid\`$t)0); exit(0); }"`
+
+kill -9 $pid
+
+exit $rc

Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.chasestrings.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.chasestrings.c	Tue Jun  3 01:24:46 2014	(r266989)
@@ -0,0 +1,79 @@
+/*
+ * 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.
+ */
+
+/*
+ * Copyright 2013 (c) Joyent, Inc. All rights reserved.
+ */
+
+/*
+ * This test takes data from the current binary which is basically running in a
+ * loop between two functions and our goal is to have two unique types that they
+ * contain which we can print.
+ */
+
+#include <unistd.h>
+
+typedef struct zelda_info {
+	char	*zi_gamename;
+	int	zi_ndungeons;
+	char	*zi_villain;
+	int	zi_haszelda;
+} zelda_info_t;
+
+static int
+has_princess(zelda_info_t *z)
+{
+	return (z->zi_haszelda);
+}
+
+static int
+has_dungeons(zelda_info_t *z)
+{
+	return (z->zi_ndungeons != 0);
+}
+
+static const char *
+has_villain(zelda_info_t *z)
+{
+	return (z->zi_villain);
+}
+
+int
+main(void)
+{
+	zelda_info_t oot;
+	zelda_info_t la;
+	zelda_info_t lttp;
+
+	oot.zi_gamename = "Ocarina of Time";
+	oot.zi_ndungeons = 10;
+	oot.zi_villain = "Ganondorf";
+	oot.zi_haszelda = 1;
+
+	la.zi_gamename = "Link's Awakening";
+	la.zi_ndungeons = 9;
+	la.zi_villain = "Nightmare";
+	la.zi_haszelda = 0;
+
+	lttp.zi_gamename = "A Link to the Past";
+	lttp.zi_ndungeons = 12;
+	lttp.zi_villain = "Ganon";
+	lttp.zi_haszelda = 1;
+
+	for (;;) {
+		(void) has_princess(&oot);
+		(void) has_dungeons(&la);
+		(void) has_villain(&lttp);
+		sleep(1);
+	}
+
+	return (0);
+}

Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.chasestrings.ksh
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.chasestrings.ksh	Tue Jun  3 01:24:46 2014	(r266989)
@@ -0,0 +1,76 @@
+#! /usr/bin/ksh
+#
+#
+# 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.
+#
+
+#
+# Copyright (c) 2013 Joyent, Inc. All rights reserved.
+#
+
+#
+# This test is checking that we can read members and that pointers inside
+# members point to valid data that is intelligible, eg. strings.
+#
+
+if [ $# != 1 ]; then
+        echo expected one argument: '<'dtrace-path'>'
+        exit 2
+fi
+
+dtrace=$1
+t="zelda_info_t"
+exe="tst.chasestrings.exe"
+
+elfdump "./$exe" | grep -q '.SUNW_ctf' 
+if [[ $? -ne 0 ]]; then
+	echo "CTF does not exist in $exe, that's a bug" >&2
+	exit 1
+fi
+
+./$exe &
+pid=$!
+
+$dtrace -qs /dev/stdin <<EOF
+pid$pid::has_princess:entry
+/next == 0/
+{
+	this->t = (pid$pid\`$t *)(copyin(arg0, sizeof (pid$pid\`$t)));
+	printf("game: %s, dungeon: %d, villain: %s, zelda: %d\n",
+	    copyinstr((uintptr_t)this->t->zi_gamename), this->t->zi_ndungeons,
+	    copyinstr((uintptr_t)this->t->zi_villain), this->t->zi_haszelda);
+	next = 1;
+}
+
+pid$pid::has_dungeons:entry
+/next == 1/
+{
+	this->t = (pid$pid\`$t *)(copyin(arg0, sizeof (pid$pid\`$t)));
+	printf("game: %s, dungeon: %d, villain: %s, zelda: %d\n",
+	    copyinstr((uintptr_t)this->t->zi_gamename), this->t->zi_ndungeons,
+	    copyinstr((uintptr_t)this->t->zi_villain), this->t->zi_haszelda);
+	next = 2;
+}
+
+pid$pid::has_villain:entry
+/next == 2/
+{
+	this->t = (pid$pid\`$t *)(copyin(arg0, sizeof (pid$pid\`$t)));
+	printf("game: %s, dungeon: %d, villain: %s, zelda: %d\n",
+	    copyinstr((uintptr_t)this->t->zi_gamename), this->t->zi_ndungeons,
+	    copyinstr((uintptr_t)this->t->zi_villain), this->t->zi_haszelda);
+	exit(0);
+}
+EOF
+rc=$?
+
+kill -9 $pid
+
+exit $rc

Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.chasestrings.ksh.out
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.chasestrings.ksh.out	Tue Jun  3 01:24:46 2014	(r266989)
@@ -0,0 +1,4 @@
+game: Ocarina of Time, dungeon: 10, villain: Ganondorf, zelda: 1
+game: Link's Awakening, dungeon: 9, villain: Nightmare, zelda: 0
+game: A Link to the Past, dungeon: 12, villain: Ganon, zelda: 1
+

Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.libtype.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.libtype.c	Tue Jun  3 01:24:46 2014	(r266989)
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+
+/*
+ * Copyright 2013 (c) Joyent, Inc. All rights reserved.
+ */
+
+/*
+ * We're linked against libc which has types, though we do not.
+ */
+#include <unistd.h>
+
+int
+main(void)
+{
+	for (;;) {
+		sleep(1000);
+	}
+	/*NOTREACHED*/
+	return (0);
+}

Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.libtype.ksh
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.libtype.ksh	Tue Jun  3 01:24:46 2014	(r266989)
@@ -0,0 +1,45 @@
+#! /usr/bin/ksh
+#
+#
+# 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.
+#
+
+#
+# Copyright (c) 2013 Joyent, Inc. All rights reserved.
+#
+
+#
+# Here we want to make sure that the program in question does not have ctf data
+# in its a.out; however, we can get types out of a linked libc.
+#
+
+if [ $# != 1 ]; then
+        echo expected one argument: '<'dtrace-path'>'
+        exit 2
+fi
+
+dtrace=$1
+t="int"
+exe="tst.libtype.exe"
+
+elfdump "./$exe" | grep -q '.SUNW_ctf' 
+if [[ $? -eq 0 ]]; then
+	echo "CTF exists in $exe, that's a bug" >&2
+	exit 1
+fi
+
+./$exe &
+pid=$!
+
+rc=`$dtrace -n "BEGIN{ trace((pid$pid\`$t)0); exit(0); }"`
+
+kill -9 $pid
+
+exit $rc

Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.linkmap.ksh
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.linkmap.ksh	Tue Jun  3 01:24:46 2014	(r266989)
@@ -0,0 +1,44 @@
+#! /usr/bin/ksh
+#
+#
+# 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.
+#
+
+#
+# Copyright (c) 2013 Joyent, Inc. All rights reserved.
+#
+
+#
+# We should be able to see both strstr from libc and from ld on an
+# alternate linkmap.
+#
+
+if [ $# != 1 ]; then
+        echo expected one argument: '<'dtrace-path'>'
+        exit 2
+fi
+
+dtrace=$1
+
+$dtrace -q -p $$ -s /dev/stdin  <<EOF
+pid\$target:LM1\`ld.so.1:strstr:entry,
+pid\$target:libc.so.1:strstr:entry
+{
+	exit (0);
+}
+
+BEGIN
+{
+	exit (0);
+}
+EOF
+rc=$?
+
+exit $rc

Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.pidprint.ksh
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.pidprint.ksh	Tue Jun  3 01:24:46 2014	(r266989)
@@ -0,0 +1,69 @@
+#! /usr/bin/ksh
+#
+#
+# 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.
+#
+
+#
+# Copyright (c) 2013 Joyent, Inc. All rights reserved.
+#
+
+#
+# Use print() on userland CTF types and verify we get the data we expect.
+#
+
+if [ $# != 1 ]; then
+        echo expected one argument: '<'dtrace-path'>'
+        exit 2
+fi
+
+dtrace=$1
+t="final_fantasy_info_t"
+exe="tst.printtype.exe"
+
+elfdump "./$exe" | grep -q '.SUNW_ctf' 
+if [[ $? -ne 0 ]]; then
+	echo "CTF does not exist in $exe, that's a bug" >&2
+	exit 1
+fi
+
+./$exe &
+pid=$!
+
+$dtrace -qs /dev/stdin <<EOF
+pid$pid::ff_getgameid:entry
+/next == 0/
+{
+	print(*args[0]);
+	printf("\n");
+	next = 1;
+}
+
+pid$pid::ff_getpartysize:entry
+/next == 1/
+{
+	print(*args[0]);
+	printf("\n");
+	next = 2;
+}
+
+pid$pid::ff_getsummons:entry
+/next == 2/
+{
+	print(*args[0]);
+	printf("\n");
+	exit(0);
+}
+EOF
+rc=$?
+
+kill -9 $pid
+
+exit $rc

Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.pidprinttarg.ksh
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.pidprinttarg.ksh	Tue Jun  3 01:24:46 2014	(r266989)
@@ -0,0 +1,70 @@
+#! /usr/bin/ksh
+#
+#
+# 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.
+#
+
+#
+# Copyright (c) 2013 Joyent, Inc. All rights reserved.
+#
+
+#
+# Use print() on userland CTF types and verify we get the data we
+# expect. This time, use $target to make sure that path works correctly.
+#
+
+if [ $# != 1 ]; then
+        echo expected one argument: '<'dtrace-path'>'
+        exit 2
+fi
+
+dtrace=$1
+t="final_fantasy_info_t"
+exe="tst.printtype.exe"
+
+elfdump "./$exe" | grep -q '.SUNW_ctf' 
+if [[ $? -ne 0 ]]; then
+	echo "CTF does not exist in $exe, that's a bug" >&2
+	exit 1
+fi
+
+./$exe &
+pid=$!
+
+$dtrace -p $pid -qs /dev/stdin <<EOF
+pid\$target::ff_getgameid:entry
+/next == 0/
+{
+	print(*args[0]);
+	printf("\n");
+	next = 1;
+}
+
+pid\$target::ff_getpartysize:entry
+/next == 1/
+{
+	print(*args[0]);
+	printf("\n");
+	next = 2;
+}
+
+pid\$target::ff_getsummons:entry
+/next == 2/
+{
+	print(*args[0]);
+	printf("\n");
+	exit(0);
+}
+EOF
+rc=$?
+
+kill -9 $pid
+
+exit $rc

Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.printtype.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.printtype.c	Tue Jun  3 01:24:46 2014	(r266989)
@@ -0,0 +1,72 @@
+/*
+ * 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.
+ */
+
+/*
+ * Copyright 2013 (c) Joyent, Inc. All rights reserved.
+ */
+
+/*
+ * The point of this is to use print() on various functions to make sure that we
+ * can print basic structures. Note that we purposefully are making sure that
+ * there are no pointers here.
+ */
+#include <unistd.h>
+
+typedef struct final_fantasy_info {
+	int ff_gameid;
+	int ff_partysize;
+	int ff_hassummons;
+} final_fantasy_info_t;
+
+static int
+ff_getgameid(final_fantasy_info_t *f)
+{
+	return (0);
+}
+
+static int
+ff_getpartysize(final_fantasy_info_t *f)
+{
+	return (0);
+}
+
+static int
+ff_getsummons(final_fantasy_info_t *f)
+{
+	return (0);
+}
+
+int
+main(void)
+{
+	final_fantasy_info_t ffiii, ffx, ffi;
+
+	ffi.ff_gameid = 1;
+	ffi.ff_partysize = 4;
+	ffi.ff_hassummons = 0;
+
+	ffiii.ff_gameid = 6;
+	ffiii.ff_partysize = 4;
+	ffiii.ff_hassummons = 1;
+
+	ffx.ff_gameid = 10;
+	ffx.ff_partysize = 3;
+	ffx.ff_hassummons = 1;
+
+	for (;;) {
+		ff_getgameid(&ffi);
+		ff_getpartysize(&ffx);
+		ff_getsummons(&ffiii);
+		sleep(1);
+	}
+	/*NOTREACHED*/
+	return (0);
+}

Added: vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.printtype.ksh
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/illumos/dist/cmd/dtrace/test/tst/common/uctf/tst.printtype.ksh	Tue Jun  3 01:24:46 2014	(r266989)
@@ -0,0 +1,69 @@
+#! /usr/bin/ksh
+#
+#
+# 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.
+#
+
+#
+# Copyright (c) 2013 Joyent, Inc. All rights reserved.
+#
+
+#
+# Use print() on userland CTF types and verify we get the data we expect.
+#

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



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