-
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.
Correct storage size assignment for variables
The implementation of global and local variables using BPF maps added calls to dt_ident_set_storage() to set the offset and size of the data storage for each variable. It was setting the storage requirement for any automatically declared variable to 8 bytes regardless of its type. Since the datatype of such a variable is determined dynamically based on its use, the storage assignment must be done once the datatype is known. But by then, some code was already generated based on the wrong size. Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com> Reviewed-by: Eugene Loh <eugene.loh@oracle.com>
- Loading branch information
Showing
3 changed files
with
61 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
NAME OFFSET KND SCP FLAG TYPE | ||
a 0 scl glb r/w string (unknown) by ref (size 256) | ||
b 100 scl glb w string (unknown) by ref (size 256) |
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,51 @@ | ||
#!/bin/bash | ||
# | ||
# Oracle Linux DTrace. | ||
# Copyright (c) 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. | ||
# | ||
|
||
## | ||
# | ||
# ASSERTION: Storage size of undeclared variables is based on their discovered | ||
# datatype | ||
# | ||
# SECTION: Variables/Scalar Variables | ||
# | ||
## | ||
|
||
dtrace=$1 | ||
|
||
$dtrace $dt_flags -Sen ' | ||
BEGIN | ||
{ | ||
a = ""; | ||
b = a; | ||
exit(0); | ||
} | ||
' 2>&1 | awk ' | ||
BEGIN { | ||
rc = 1; | ||
} | ||
/^NAME/ && /KND SCP/ { | ||
printf "%-16s %-6s %-3s %-3s %-4s %s\n", | ||
"NAME", "OFFSET", "KND", "SCP","FLAG", "TYPE"; | ||
while (getline == 1 && NF > 0) { | ||
$2 = $6 = ""; | ||
gsub(/ +/, " "); | ||
printf "%-16s %-6s %-3s %-3s %-4s", $1, $2, $3, $4, $5; | ||
$1 = $2 = $3 = $4 = $5 = ""; | ||
gsub(/ +/, " "); | ||
print $0; | ||
rc = 0; | ||
} | ||
} | ||
END { | ||
exit(rc); | ||
} | ||
' | ||
|
||
exit $? |