Skip to content

Commit

Permalink
Fix execution with -Z
Browse files Browse the repository at this point in the history
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.

With such -Z support, a number of XFAIL tests now can pass.  A few,
however, were relying on architecture-specific probes (e.g., for x64)
and/or certain background activity.  For test completion, add
triggering activities explicitly and, on ARM64, appropriate
architecture-specific probes.

Signed-off-by: Eugene Loh <eugene.loh@oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>
  • Loading branch information
euloh authored and kvanhees committed Jun 18, 2021
1 parent dfae1d2 commit d1d1fc4
Show file tree
Hide file tree
Showing 13 changed files with 53 additions and 24 deletions.
14 changes: 13 additions & 1 deletion libdtrace/dt_program.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions test/unittest/dtrace-util/tst.CoalesceTrace.d
Original file line number Diff line number Diff line change
@@ -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 */

/*
*
Expand All @@ -22,6 +21,7 @@

/* @@runtest-opts: -FZ */
/* @@timeout: 70 */
/* @@trigger: readwholedir */

BEGIN
{
Expand All @@ -36,6 +36,7 @@ syscall::read:
}

fbt:vmlinux:SyS_read:,
fbt:vmlinux:__arm64_sys_read:,
fbt:vmlinux:__x64_sys_read:
{
printf("fbt: %d\n", j++);
Expand Down
3 changes: 1 addition & 2 deletions test/unittest/dtrace-util/tst.ZeroFunctionProbes.sh
Original file line number Diff line number Diff line change
@@ -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

##
#
Expand Down
3 changes: 1 addition & 2 deletions test/unittest/dtrace-util/tst.ZeroNameProbes.sh
Original file line number Diff line number Diff line change
@@ -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

##
#
Expand Down
4 changes: 1 addition & 3 deletions test/unittest/dtrace-util/tst.ZeroProviderProbes.sh
Original file line number Diff line number Diff line change
@@ -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

##
#
Expand Down
6 changes: 4 additions & 2 deletions test/unittest/fbtprovider/tst.functionentry.d
Original file line number Diff line number Diff line change
@@ -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.
*/
Expand All @@ -11,19 +11,21 @@
* SECTION: FBT Provider/Probe arguments
*/

/* @@xfail: dtv2 */
/* @@runtest-opts: -Z */
/* @@trigger: pid-tst-args1 */

#pragma D option quiet
#pragma D option statusrate=10ms

fbt::SyS_ioctl:entry,
fbt::__arm64_sys_ioctl:entry,
fbt::__x64_sys_ioctl:entry
{
printf("Entering the ioctl function\n");
}

fbt::SyS_ioctl:return,
fbt::__arm64_sys_ioctl:return,
fbt::__x64_sys_ioctl:return
{
printf("Returning from ioctl function\n");
Expand Down
5 changes: 3 additions & 2 deletions test/unittest/fbtprovider/tst.functionreturnvalue.d
Original file line number Diff line number Diff line change
@@ -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.
*/
Expand All @@ -11,13 +11,14 @@
* SECTION: FBT Provider/Probe arguments
*/

/* @@xfail: dtv2 */
/* @@runtest-opts: -Z */
/* @@trigger: pid-tst-args1 */

#pragma D option quiet
#pragma D option statusrate=10ms

fbt::SyS_ioctl:return,
fbt::__arm64_sys_ioctl:return,
fbt::__x64_sys_ioctl:return
{
printf("The function return value is stored in %u\n", arg1);
Expand Down
6 changes: 4 additions & 2 deletions test/unittest/fbtprovider/tst.ioctlargs.d
Original file line number Diff line number Diff line change
@@ -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.
*/
Expand All @@ -11,20 +11,22 @@
* SECTION: FBT Provider/Probe arguments
*/

/* @@xfail: dtv2 */
/* @@runtest-opts: -Z */
/* @@trigger: pid-tst-args1 */

#pragma D option quiet
#pragma D option statusrate=10ms

fbt::SyS_ioctl:entry,
fbt::__arm64_sys_ioctl:entry,
fbt::__x64_sys_ioctl:entry
{
printf("Entering the ioctl function\n");
printf("The few arguments are %u %u %u %u\n", arg0, arg1, arg2, arg3);
}

fbt::SyS_ioctl:return,
fbt::__arm64_sys_ioctl:return,
fbt::__x64_sys_ioctl:return
{
printf("Returning from ioctl function\n");
Expand Down
6 changes: 4 additions & 2 deletions test/unittest/fbtprovider/tst.offset.d
Original file line number Diff line number Diff line change
@@ -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.
*/
Expand All @@ -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
Expand All @@ -23,12 +23,14 @@ BEGIN
}

fbt::SyS_ioctl:entry,
fbt::__arm64_sys_ioctl:entry,
fbt::__x64_sys_ioctl:entry
{
printf("Entering the function\n");
}

fbt::SyS_ioctl:return,
fbt::__arm64_sys_ioctl:return,
fbt::__x64_sys_ioctl:return
{
printf("The offset = %u\n", arg0);
Expand Down
6 changes: 4 additions & 2 deletions test/unittest/fbtprovider/tst.offsetzero.d
Original file line number Diff line number Diff line change
@@ -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.
*/
Expand All @@ -11,13 +11,14 @@
* SECTION: FBT Provider/Probe arguments
*/

/* @@xfail: dtv2 */
/* @@runtest-opts: -Z */
/* @@trigger: pid-tst-args1 */

#pragma D option quiet
#pragma D option statusrate=10ms

fbt::SyS_ioctl:entry,
fbt::__arm64_sys_ioctl:entry,
fbt::__x64_sys_ioctl:entry
{
printf("Entering the ioctl function\n");
Expand All @@ -26,6 +27,7 @@ fbt::__x64_sys_ioctl:entry
}

fbt::SyS_ioctl:return,
fbt::__arm64_sys_ioctl:return,
fbt::__x64_sys_ioctl:return
{
printf("Returning from ioctl function\n");
Expand Down
5 changes: 3 additions & 2 deletions test/unittest/fbtprovider/tst.return.d
Original file line number Diff line number Diff line change
@@ -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.
*/
Expand All @@ -11,13 +11,14 @@
* SECTION: FBT Provider/Probe arguments
*/

/* @@xfail: dtv2 */
/* @@runtest-opts: -Z */
/* @@trigger: pid-tst-args1 */

#pragma D option quiet
#pragma D option statusrate=10ms

fbt::SyS_ioctl:return,
fbt::__arm64_sys_ioctl:return,
fbt::__x64_sys_ioctl:return
{
exit(0);
Expand Down
8 changes: 7 additions & 1 deletion test/unittest/fbtprovider/tst.tls.d
Original file line number Diff line number Diff line change
@@ -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.
*/
Expand All @@ -13,6 +13,7 @@

/* @@xfail: dtv2 */
/* @@runtest-opts: -Z */
/* @@trigger: pid-tst-args1 */

#pragma D option quiet
#pragma D option statusrate=10ms
Expand All @@ -26,6 +27,7 @@ BEGIN
}

fbt::SyS_ioctl:entry,
fbt::__arm64_sys_ioctl:entry,
fbt::__x64_sys_ioctl:entry
/me == pid/
{
Expand All @@ -34,13 +36,15 @@ fbt::__x64_sys_ioctl:entry
}

fbt::SyS_ioctl:return,
fbt::__arm64_sys_ioctl:return,
fbt::__x64_sys_ioctl:return
/me == pid && num_entry > 0/
{
num_return++;
}

fbt::SyS_ioctl:return,
fbt::__arm64_sys_ioctl:return,
fbt::__x64_sys_ioctl:return
/me == pid && num_entry > 0 && self->token != pid/
{
Expand All @@ -49,6 +53,8 @@ fbt::__x64_sys_ioctl:return

fbt::SyS_ioctl:entry,
fbt::SyS_ioctl:return,
fbt::__arm64_sys_ioctl:entry,
fbt::__arm64_sys_ioctl:return,
fbt::__x64_sys_ioctl:entry,
fbt::__x64_sys_ioctl:return
/num_entry >= 10 && num_return >= 10/
Expand Down
6 changes: 5 additions & 1 deletion test/unittest/fbtprovider/tst.tls2.d
Original file line number Diff line number Diff line change
@@ -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.
*/
Expand All @@ -13,6 +13,7 @@

/* @@xfail: dtv2 */
/* @@runtest-opts: -Z */
/* @@trigger: pid-tst-args1 */

#pragma D option quiet
#pragma D option statusrate=10ms
Expand All @@ -33,18 +34,21 @@ syscall::ioctl:entry
}

fbt::SyS_ioctl:entry,
fbt::__arm64_sys_ioctl:entry,
fbt::__x64_sys_ioctl:entry
/me == pid && num_entry > 0/
{
}

fbt::SyS_ioctl:return,
fbt::__arm64_sys_ioctl:return,
fbt::__x64_sys_ioctl:return
/me == pid && num_entry > 0/
{
}

fbt::SyS_ioctl:return,
fbt::__arm64_sys_ioctl:return,
fbt::__x64_sys_ioctl:return
/me == pid && num_entry > 0 && self->token != pid/
{
Expand Down

0 comments on commit d1d1fc4

Please sign in to comment.