-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for built-in variable args
Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com> Reviewed-by: Eugene Loh <eugene.loh@oracle.com>
- Loading branch information
Showing
10 changed files
with
276 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
85 0 1 0000 ffffffff call dt_get_bvar ! arg0 | ||
85 0 1 0000 ffffffff call dt_get_bvar ! arg1 | ||
85 0 1 0000 ffffffff call dt_get_bvar ! arg2 | ||
85 0 1 0000 ffffffff call dt_get_bvar ! arg3 | ||
85 0 1 0000 ffffffff call dt_get_bvar ! arg4 | ||
85 0 1 0000 ffffffff call dt_get_bvar ! arg5 | ||
85 0 1 0000 ffffffff call dt_get_bvar ! arg6 | ||
85 0 1 0000 ffffffff call dt_get_bvar ! arg7 | ||
85 0 1 0000 ffffffff call dt_get_bvar ! arg8 | ||
85 0 1 0000 ffffffff call dt_get_bvar ! arg9 | ||
85 0 1 0000 ffffffff call dt_get_bvar ! args | ||
85 0 1 0000 ffffffff call dt_get_bvar ! caller | ||
85 0 1 0000 ffffffff call dt_get_bvar ! curcpu | ||
85 0 1 0000 ffffffff call dt_get_bvar ! curthread | ||
85 0 1 0000 ffffffff call dt_get_bvar ! epid | ||
85 0 1 0000 ffffffff call dt_get_bvar ! errno | ||
85 0 1 0000 ffffffff call dt_get_bvar ! execname | ||
85 0 1 0000 ffffffff call dt_get_bvar ! gid | ||
85 0 1 0000 ffffffff call dt_get_bvar ! id | ||
85 0 1 0000 ffffffff call dt_get_bvar ! ipl | ||
85 0 1 0000 ffffffff call dt_get_bvar ! pid | ||
85 0 1 0000 ffffffff call dt_get_bvar ! ppid | ||
85 0 1 0000 ffffffff call dt_get_bvar ! probefunc | ||
85 0 1 0000 ffffffff call dt_get_bvar ! probemod | ||
85 0 1 0000 ffffffff call dt_get_bvar ! probename | ||
85 0 1 0000 ffffffff call dt_get_bvar ! probeprov | ||
85 0 1 0000 ffffffff call dt_get_bvar ! stackdepth | ||
85 0 1 0000 ffffffff call dt_get_bvar ! tid | ||
85 0 1 0000 ffffffff call dt_get_bvar ! timestamp | ||
85 0 1 0000 ffffffff call dt_get_bvar ! ucaller | ||
85 0 1 0000 ffffffff call dt_get_bvar ! uid | ||
85 0 1 0000 ffffffff call dt_get_bvar ! uregs | ||
85 0 1 0000 ffffffff call dt_get_bvar ! ustackdepth | ||
85 0 1 0000 ffffffff call dt_get_bvar ! vtimestamp | ||
85 0 1 0000 ffffffff call dt_get_bvar ! walltimestamp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/bin/bash | ||
# | ||
# Oracle Linux DTrace. | ||
# Copyright (c) 2022, 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. | ||
# | ||
|
||
dtrace=$1 | ||
|
||
$dtrace $dt_flags -Sen ' | ||
sdt:task::task_rename | ||
{ | ||
trace(arg0); | ||
trace(arg1); | ||
trace(arg2); | ||
trace(arg3); | ||
trace(arg4); | ||
trace(arg5); | ||
trace(arg6); | ||
trace(arg7); | ||
trace(arg8); | ||
trace(arg9); | ||
trace(args[0]); | ||
trace(caller); | ||
trace(curcpu); | ||
trace(curthread); | ||
trace(epid); | ||
trace(errno); | ||
trace(execname); | ||
trace(gid); | ||
trace(id); | ||
trace(ipl); | ||
trace(pid); | ||
trace(ppid); | ||
trace(probefunc); | ||
trace(probemod); | ||
trace(probename); | ||
trace(probeprov); | ||
trace(stackdepth); | ||
trace(tid); | ||
trace(timestamp); | ||
trace(ucaller); | ||
trace(uid); | ||
trace(uregs[0]); | ||
trace(ustackdepth); | ||
trace(vtimestamp); | ||
trace(walltimestamp); | ||
exit(0); | ||
} | ||
' 2>&1 | awk '/ call dt_get_bvar/ { sub(/^[^:]+: /, ""); print; }' | ||
|
||
exit $? |
29 changes: 29 additions & 0 deletions
29
test/unittest/variables/bvar/err.D_ARGS_IDX.args-neg-idx.d
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Oracle Linux DTrace. | ||
* Copyright (c) 2022, 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. | ||
*/ | ||
|
||
/* | ||
* ASSERTION: Accessing args[-1] for probes with arguments triggers a fault. | ||
* | ||
* SECTION: Variables/Built-in Variables/args | ||
*/ | ||
|
||
#pragma D option quiet | ||
#pragma D option destructive | ||
|
||
BEGIN | ||
{ | ||
system("echo write something > /dev/null"); | ||
} | ||
|
||
write:entry { | ||
trace(args[-1]); | ||
exit(0); | ||
} | ||
|
||
ERROR { | ||
exit(1); | ||
} |
23 changes: 23 additions & 0 deletions
23
test/unittest/variables/bvar/err.D_ARGS_IDX.args-no-args.d
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Oracle Linux DTrace. | ||
* Copyright (c) 2022, 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. | ||
*/ | ||
|
||
/* | ||
* ASSERTION: Accessing args[0] for probes without arguments triggers a fault. | ||
* | ||
* SECTION: Variables/Built-in Variables/args | ||
*/ | ||
|
||
#pragma D option quiet | ||
|
||
BEGIN { | ||
trace(args[0]); | ||
exit(0); | ||
} | ||
|
||
ERROR { | ||
exit(1); | ||
} |
32 changes: 32 additions & 0 deletions
32
test/unittest/variables/bvar/err.D_ARGS_IDX.args-too-many.d
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Oracle Linux DTrace. | ||
* Copyright (c) 2022, 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. | ||
*/ | ||
|
||
/* | ||
* ASSERTION: Accessing args[i] for probes with n arguments fails when i >= n. | ||
* | ||
* SECTION: Variables/Built-in Variables/args | ||
*/ | ||
|
||
#pragma D option quiet | ||
#pragma D option destructive | ||
|
||
BEGIN | ||
{ | ||
system("echo write something > /dev/null"); | ||
} | ||
|
||
write:entry { | ||
trace(args[0]); | ||
trace(args[1]); | ||
trace(args[2]); | ||
trace(args[3]); | ||
exit(0); | ||
} | ||
|
||
ERROR { | ||
exit(1); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
test/unittest/variables/bvar/err.D_PROTO_ARG.args-non-scalar-idx.d
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Oracle Linux DTrace. | ||
* Copyright (c) 2022, 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. | ||
*/ | ||
|
||
/* | ||
* ASSERTION: The index of args[] must be a scalar. | ||
* | ||
* SECTION: Variables/Built-in Variables/args | ||
*/ | ||
|
||
BEGIN | ||
{ | ||
trace(args["a"]); | ||
exit(0); | ||
} | ||
|
||
ERROR | ||
{ | ||
exit(1); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Oracle Linux DTrace. | ||
* Copyright (c) 2022, 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. | ||
*/ | ||
|
||
/* | ||
* ASSERTION: When no argument mapping is in place, args[N] == argN, modulo | ||
* datatype. | ||
* | ||
* SECTION: Variables/Built-in Variables/args | ||
*/ | ||
|
||
#pragma D option quiet | ||
#pragma D option destructive | ||
|
||
BEGIN | ||
{ | ||
system("echo write something > /dev/null"); | ||
} | ||
|
||
write:entry { | ||
printf("%x vs %x\n", args[0], arg0); | ||
printf("%x vs %x\n", (uint64_t)args[1], arg1); | ||
printf("%x vs %x\n", args[2], arg2); | ||
exit(args[0] == arg0 && (uint64_t)args[1] == arg1 && args[2] == arg2 ? 0 : 1); | ||
} | ||
|
||
ERROR { | ||
exit(1); | ||
} |