summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan Cantrill <bryan@joyent.com>2013-04-15 05:48:25 +0000
committerBryan Cantrill <bryan@joyent.com>2013-04-15 05:48:25 +0000
commit44ac4e4af990271145543aaa44f59e0d910f52c3 (patch)
tree988a52aa09b008258e1e1528a14a7e8a9f8b75f4
parente0c12bce3343ccf3df12bc18a16d28410c9c13bf (diff)
downloadillumos-joyent-44ac4e4af990271145543aaa44f59e0d910f52c3.tar.gz
OS-2122 Only probes from the first DTrace object file will be included
-rw-r--r--usr/src/cmd/dtrace/test/tst/common/usdt/tst.multiprov.ksh106
-rw-r--r--usr/src/cmd/dtrace/test/tst/common/usdt/tst.multiprov.ksh.out3
-rw-r--r--usr/src/pkg/manifests/system-dtrace-tests.mf2
-rw-r--r--usr/src/uts/common/dtrace/dtrace.c6
4 files changed, 114 insertions, 3 deletions
diff --git a/usr/src/cmd/dtrace/test/tst/common/usdt/tst.multiprov.ksh b/usr/src/cmd/dtrace/test/tst/common/usdt/tst.multiprov.ksh
new file mode 100644
index 0000000000..7def9ed2ab
--- /dev/null
+++ b/usr/src/cmd/dtrace/test/tst/common/usdt/tst.multiprov.ksh
@@ -0,0 +1,106 @@
+#
+# 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 (c) 2013, Joyent, Inc. All rights reserved.
+#
+
+if [ $# != 1 ]; then
+ echo expected one argument: '<'dtrace-path'>'
+ exit 2
+fi
+
+dtrace=$1
+DIR=/var/tmp/dtest.$$
+
+mkdir $DIR
+cd $DIR
+
+echo '#pragma D option quiet' > test.d
+echo '#pragma D option aggsortkey' >> test.d
+
+cat > test.c <<EOF
+#include <unistd.h>
+
+void
+main()
+{
+EOF
+
+objs=
+
+for oogle in doogle bagnoogle; do
+ cat > $oogle.c <<EOF
+#include <sys/sdt.h>
+
+void
+$oogle()
+{
+ DTRACE_PROBE($oogle, knows);
+}
+EOF
+
+ cat > $oogle.d <<EOF
+provider $oogle {
+ probe knows();
+};
+EOF
+
+ cc -c $oogle.c
+
+ if [ $? -ne 0 ]; then
+ print -u2 "failed to compile $oogle.c"
+ exit 1
+ fi
+
+ $dtrace -G -32 -s $oogle.d $oogle.o -o $oogle.d.o
+
+ if [ $? -ne 0 ]; then
+ print -u2 "failed to process $oogle.d"
+ exit 1
+ fi
+
+ objs="$objs $oogle.o $oogle.d.o"
+ echo $oogle'();' >> test.c
+ echo $oogle'$target:::{@[probefunc] = count()}' >> test.d
+done
+
+echo "}" >> test.c
+
+echo 'END{printa("%-10s %@d\\n", @)}' >> test.d
+
+cc -o test test.c $objs
+
+if [ $? -ne 0 ]; then
+ print -u2 "failed to compile test.c"
+ exit 1
+fi
+
+$dtrace -s ./test.d -Zc ./test
+
+if [ $? -ne 0 ]; then
+ print -u2 "failed to execute test"
+ exit 1
+fi
+
+cd /
+/usr/bin/rm -rf $DIR
+exit 0
diff --git a/usr/src/cmd/dtrace/test/tst/common/usdt/tst.multiprov.ksh.out b/usr/src/cmd/dtrace/test/tst/common/usdt/tst.multiprov.ksh.out
new file mode 100644
index 0000000000..966b6f6735
--- /dev/null
+++ b/usr/src/cmd/dtrace/test/tst/common/usdt/tst.multiprov.ksh.out
@@ -0,0 +1,3 @@
+bagnoogle 1
+doogle 1
+
diff --git a/usr/src/pkg/manifests/system-dtrace-tests.mf b/usr/src/pkg/manifests/system-dtrace-tests.mf
index d1e0317ee6..e686d5d1f8 100644
--- a/usr/src/pkg/manifests/system-dtrace-tests.mf
+++ b/usr/src/pkg/manifests/system-dtrace-tests.mf
@@ -2009,6 +2009,8 @@ file path=opt/SUNWdtrt/tst/common/usdt/tst.linkpriv.ksh mode=0444
file path=opt/SUNWdtrt/tst/common/usdt/tst.linkunpriv.ksh mode=0444
file path=opt/SUNWdtrt/tst/common/usdt/tst.multiple.ksh mode=0444
file path=opt/SUNWdtrt/tst/common/usdt/tst.multiple.ksh.out mode=0444
+file path=opt/SUNWdtrt/tst/common/usdt/tst.multiprov.ksh mode=0444
+file path=opt/SUNWdtrt/tst/common/usdt/tst.multiprov.ksh.out mode=0444
file path=opt/SUNWdtrt/tst/common/usdt/tst.nodtrace.ksh mode=0444
file path=opt/SUNWdtrt/tst/common/usdt/tst.noreap.ksh mode=0444
file path=opt/SUNWdtrt/tst/common/usdt/tst.noreapring.ksh mode=0444
diff --git a/usr/src/uts/common/dtrace/dtrace.c b/usr/src/uts/common/dtrace/dtrace.c
index 6f6c64e86b..67b658c907 100644
--- a/usr/src/uts/common/dtrace/dtrace.c
+++ b/usr/src/uts/common/dtrace/dtrace.c
@@ -21,7 +21,7 @@
/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
* Copyright (c) 2012 by Delphix. All rights reserved.
*/
@@ -14738,8 +14738,8 @@ dtrace_helper_provider_add(dof_helper_t *dofhp, int gen)
* Check to make sure this isn't a duplicate.
*/
for (i = 0; i < help->dthps_nprovs; i++) {
- if (dofhp->dofhp_addr ==
- help->dthps_provs[i]->dthp_prov.dofhp_addr)
+ if (dofhp->dofhp_dof ==
+ help->dthps_provs[i]->dthp_prov.dofhp_dof)
return (EALREADY);
}