[DTrace-devel] [PATCH] Fix execution with -Z
eugene.loh at oracle.com
eugene.loh at oracle.com
Thu Jun 17 14:55:27 PDT 2021
From: Eugene Loh <eugene.loh at oracle.com>
This fix addresses the case where a probe definition does not match any
probes. Another challenging problem is where the matching probes do
not exist yet. Ultimately, a solution for that greater problem will
also be needed.
Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
---
libdtrace/dt_program.c | 14 +++++++++++++-
test/unittest/dtrace-util/tst.CoalesceTrace.d | 3 +--
.../unittest/dtrace-util/tst.ZeroFunctionProbes.sh | 3 +--
test/unittest/dtrace-util/tst.ZeroNameProbes.sh | 3 +--
.../unittest/dtrace-util/tst.ZeroProviderProbes.sh | 4 +---
test/unittest/fbtprovider/tst.functionentry.d | 3 +--
.../unittest/fbtprovider/tst.functionreturnvalue.d | 3 +--
test/unittest/fbtprovider/tst.ioctlargs.d | 3 +--
test/unittest/fbtprovider/tst.offset.d | 3 +--
test/unittest/fbtprovider/tst.offsetzero.d | 3 +--
test/unittest/fbtprovider/tst.return.d | 4 ++--
11 files changed, 24 insertions(+), 22 deletions(-)
diff --git a/libdtrace/dt_program.c b/libdtrace/dt_program.c
index 5399ae05..c114fda7 100644
--- a/libdtrace/dt_program.c
+++ b/libdtrace/dt_program.c
@@ -163,10 +163,22 @@ dt_prog_stmt(dtrace_hdl_t *dtp, dtrace_prog_t *pgp, dtrace_stmtdesc_t *sdp,
{
pi_state_t st;
dtrace_probedesc_t *pdp = &sdp->dtsd_ecbdesc->dted_probe;
+ int rc;
st.cnt = cnt;
st.idp = sdp->dtsd_clause;
- return dt_probe_iter(dtp, pdp, (dt_probe_f *)dt_stmt_probe, NULL, &st);
+ rc = dt_probe_iter(dtp, pdp, (dt_probe_f *)dt_stmt_probe, NULL, &st);
+
+ /*
+ * At this point, dtp->dt_cflags has no information about
+ * DTRACE_C_ZDEFS. Do not worry about it. If the probe
+ * definition matches no probes and DTRACE_C_ZDEFS had not
+ * been set, the problem would have been reported earlier,
+ * in dt_setcontext().
+ */
+ if (rc && dtrace_errno(dtp) == EDT_NOPROBE)
+ return 0;
+ return rc;
}
int
diff --git a/test/unittest/dtrace-util/tst.CoalesceTrace.d b/test/unittest/dtrace-util/tst.CoalesceTrace.d
index 4a675be9..800426fe 100644
--- a/test/unittest/dtrace-util/tst.CoalesceTrace.d
+++ b/test/unittest/dtrace-util/tst.CoalesceTrace.d
@@ -1,10 +1,9 @@
/*
* Oracle Linux DTrace.
- * Copyright (c) 2006, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2021, Oracle and/or its affiliates. All rights reserved.
* Licensed under the Universal Permissive License v 1.0 as shown at
* http://oss.oracle.com/licenses/upl.
*/
-/* @@xfail: dtv2 */
/*
*
diff --git a/test/unittest/dtrace-util/tst.ZeroFunctionProbes.sh b/test/unittest/dtrace-util/tst.ZeroFunctionProbes.sh
index 94198bd2..3e2221a0 100755
--- a/test/unittest/dtrace-util/tst.ZeroFunctionProbes.sh
+++ b/test/unittest/dtrace-util/tst.ZeroFunctionProbes.sh
@@ -1,11 +1,10 @@
#!/bin/bash
#
# Oracle Linux DTrace.
-# Copyright (c) 2006, 2020, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 2021, Oracle and/or its affiliates. All rights reserved.
# Licensed under the Universal Permissive License v 1.0 as shown at
# http://oss.oracle.com/licenses/upl.
#
-# @@xfail: dtv2
##
#
diff --git a/test/unittest/dtrace-util/tst.ZeroNameProbes.sh b/test/unittest/dtrace-util/tst.ZeroNameProbes.sh
index 814443de..731b2adf 100755
--- a/test/unittest/dtrace-util/tst.ZeroNameProbes.sh
+++ b/test/unittest/dtrace-util/tst.ZeroNameProbes.sh
@@ -1,11 +1,10 @@
#!/bin/bash
#
# Oracle Linux DTrace.
-# Copyright (c) 2006, 2020, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 2021, Oracle and/or its affiliates. All rights reserved.
# Licensed under the Universal Permissive License v 1.0 as shown at
# http://oss.oracle.com/licenses/upl.
#
-# @@xfail: dtv2
##
#
diff --git a/test/unittest/dtrace-util/tst.ZeroProviderProbes.sh b/test/unittest/dtrace-util/tst.ZeroProviderProbes.sh
index 85dab241..63d1ab8b 100755
--- a/test/unittest/dtrace-util/tst.ZeroProviderProbes.sh
+++ b/test/unittest/dtrace-util/tst.ZeroProviderProbes.sh
@@ -1,11 +1,9 @@
#!/bin/bash
#
# Oracle Linux DTrace.
-# Copyright (c) 2006, 2020, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 2021, Oracle and/or its affiliates. All rights reserved.
# Licensed under the Universal Permissive License v 1.0 as shown at
# http://oss.oracle.com/licenses/upl.
-#
-# @@xfail: dtv2
##
#
diff --git a/test/unittest/fbtprovider/tst.functionentry.d b/test/unittest/fbtprovider/tst.functionentry.d
index 187f22c4..6ba98d54 100644
--- a/test/unittest/fbtprovider/tst.functionentry.d
+++ b/test/unittest/fbtprovider/tst.functionentry.d
@@ -1,6 +1,6 @@
/*
* Oracle Linux DTrace.
- * Copyright (c) 2006, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2021, Oracle and/or its affiliates. All rights reserved.
* Licensed under the Universal Permissive License v 1.0 as shown at
* http://oss.oracle.com/licenses/upl.
*/
@@ -11,7 +11,6 @@
* SECTION: FBT Provider/Probe arguments
*/
-/* @@xfail: dtv2 */
/* @@runtest-opts: -Z */
#pragma D option quiet
diff --git a/test/unittest/fbtprovider/tst.functionreturnvalue.d b/test/unittest/fbtprovider/tst.functionreturnvalue.d
index 7c9e474c..3880316f 100644
--- a/test/unittest/fbtprovider/tst.functionreturnvalue.d
+++ b/test/unittest/fbtprovider/tst.functionreturnvalue.d
@@ -1,6 +1,6 @@
/*
* Oracle Linux DTrace.
- * Copyright (c) 2006, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2021, Oracle and/or its affiliates. All rights reserved.
* Licensed under the Universal Permissive License v 1.0 as shown at
* http://oss.oracle.com/licenses/upl.
*/
@@ -11,7 +11,6 @@
* SECTION: FBT Provider/Probe arguments
*/
-/* @@xfail: dtv2 */
/* @@runtest-opts: -Z */
#pragma D option quiet
diff --git a/test/unittest/fbtprovider/tst.ioctlargs.d b/test/unittest/fbtprovider/tst.ioctlargs.d
index 2fb13860..0e3a577f 100644
--- a/test/unittest/fbtprovider/tst.ioctlargs.d
+++ b/test/unittest/fbtprovider/tst.ioctlargs.d
@@ -1,6 +1,6 @@
/*
* Oracle Linux DTrace.
- * Copyright (c) 2006, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2021, Oracle and/or its affiliates. All rights reserved.
* Licensed under the Universal Permissive License v 1.0 as shown at
* http://oss.oracle.com/licenses/upl.
*/
@@ -11,7 +11,6 @@
* SECTION: FBT Provider/Probe arguments
*/
-/* @@xfail: dtv2 */
/* @@runtest-opts: -Z */
#pragma D option quiet
diff --git a/test/unittest/fbtprovider/tst.offset.d b/test/unittest/fbtprovider/tst.offset.d
index cdd163f2..7950c53d 100644
--- a/test/unittest/fbtprovider/tst.offset.d
+++ b/test/unittest/fbtprovider/tst.offset.d
@@ -1,6 +1,6 @@
/*
* Oracle Linux DTrace.
- * Copyright (c) 2006, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2021, Oracle and/or its affiliates. All rights reserved.
* Licensed under the Universal Permissive License v 1.0 as shown at
* http://oss.oracle.com/licenses/upl.
*/
@@ -11,7 +11,6 @@
* SECTION: FBT Provider/Probe arguments
*/
-/* @@xfail: dtv2 */
/* @@runtest-opts: -Z */
#pragma D option quiet
diff --git a/test/unittest/fbtprovider/tst.offsetzero.d b/test/unittest/fbtprovider/tst.offsetzero.d
index feae2e37..c164b478 100644
--- a/test/unittest/fbtprovider/tst.offsetzero.d
+++ b/test/unittest/fbtprovider/tst.offsetzero.d
@@ -1,6 +1,6 @@
/*
* Oracle Linux DTrace.
- * Copyright (c) 2006, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2021, Oracle and/or its affiliates. All rights reserved.
* Licensed under the Universal Permissive License v 1.0 as shown at
* http://oss.oracle.com/licenses/upl.
*/
@@ -11,7 +11,6 @@
* SECTION: FBT Provider/Probe arguments
*/
-/* @@xfail: dtv2 */
/* @@runtest-opts: -Z */
#pragma D option quiet
diff --git a/test/unittest/fbtprovider/tst.return.d b/test/unittest/fbtprovider/tst.return.d
index e62d67d4..29352a89 100644
--- a/test/unittest/fbtprovider/tst.return.d
+++ b/test/unittest/fbtprovider/tst.return.d
@@ -1,6 +1,6 @@
/*
* Oracle Linux DTrace.
- * Copyright (c) 2006, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2021, Oracle and/or its affiliates. All rights reserved.
* Licensed under the Universal Permissive License v 1.0 as shown at
* http://oss.oracle.com/licenses/upl.
*/
@@ -11,8 +11,8 @@
* SECTION: FBT Provider/Probe arguments
*/
-/* @@xfail: dtv2 */
/* @@runtest-opts: -Z */
+/* @@trigger: pid-tst-args1 */
#pragma D option quiet
#pragma D option statusrate=10ms
--
2.18.4
More information about the DTrace-devel
mailing list