-
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.
test: Add test to check ALLOCA flag propagation
Signed-off-by: Eugene Loh <eugene.loh@oracle.com> Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>
- Loading branch information
Showing
3 changed files
with
81 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
/* | ||
* Check the ALLOCA annotations in the parse tree. | ||
*/ | ||
|
||
/* @@runtest-opts: -xtree=4 -e */ | ||
/* @@nosort */ | ||
|
||
syscall::write:entry | ||
{ | ||
myvar_int = 4; | ||
myvar_string = "abcde"; | ||
myvar_alloca = alloca(4); | ||
myvar_basename = basename("/foo/bar"); | ||
myvar_copyin = copyin(arg1, 4); | ||
myvar_copyinstr = copyinstr(arg1); | ||
myvar_dirname = dirname("/foo/bar"); | ||
} |
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,26 @@ | ||
OP2 = | ||
VARIABLE myvar_int | ||
INT {ptr} | ||
OP2 = | ||
VARIABLE myvar_string | ||
STRING "abcde" | ||
OP2 = ALLOCA | ||
VARIABLE myvar_alloca ALLOCA | ||
FUNC alloca ALLOCA | ||
INT {ptr} | ||
OP2 = | ||
VARIABLE myvar_basename | ||
FUNC basename | ||
STRING "/foo/bar" | ||
OP2 = ALLOCA | ||
VARIABLE myvar_copyin ALLOCA | ||
FUNC copyin ALLOCA | ||
INT {ptr} | ||
OP2 = | ||
VARIABLE myvar_copyinstr | ||
FUNC copyinstr | ||
INT {ptr} | ||
OP2 = | ||
VARIABLE myvar_dirname | ||
FUNC dirname | ||
STRING "/foo/bar" |
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,31 @@ | ||
#!/usr/bin/awk -f | ||
|
||
# set flag to look for the clause | ||
BEGIN { read_clause = 0 } | ||
|
||
# we found the beginning of the clause | ||
/^ *PDESC syscall::write:entry/ { | ||
read_clause = 1; | ||
getline; | ||
getline; | ||
next; | ||
} | ||
|
||
# if not in the clause, keep looking | ||
read_clause == 0 { next } | ||
|
||
# if we were reading the clause but get to "Parse tree", we are done | ||
/^Parse tree \(Pass 3\):$/ { exit(0); } | ||
|
||
# dump interesting stuff from the clause | ||
/^ *OP2 / && /ALLOCA/ { print $1, $2, "ALLOCA"; next } | ||
/^ *OP2 / { print $1, $2 ; next } | ||
/^ *VARIABLE / && / myvar_/ && | ||
/ALLOCA/ { print $1, $3, "ALLOCA"; next } | ||
/^ *VARIABLE / && / myvar_/ { print $1, $3 ; next } | ||
/^ *FUNC / && /ALLOCA/ { print $1, $2, "ALLOCA"; next } | ||
/^ *FUNC / { print $1, $2 ; next } | ||
/^ *INT / && /ALLOCA/ { print $1, $2, "ALLOCA"; next } | ||
/^ *INT / { print $1, $2 ; next } | ||
/^ *STRING / && /ALLOCA/ { print $1, $2, "ALLOCA"; next } | ||
/^ *STRING / { print $1, $2 ; next } |