-
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.
cg: allow input to translator to be NULL
Some translators support NULL as input pointer value. The code generator was performing a NULL-check on a the LHS of a PTR or DOT node before considering the possibility that the node is subject to translator handling. The check should happen after translator handling. With this patch, tst.ProcModelTrans.d works but only for the case of NULL input. The test is changed to actually use a real task_struct as input. New test tst.NullInput.d exercises the case this patch fixes. 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
39 additions
and
12 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,31 @@ | ||
/* | ||
* Oracle Linux DTrace. | ||
* Copyright (c) 2023, 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: Translators can receive NULL as input. | ||
* | ||
* SECTION: Translators/Translator Declarations | ||
* SECTION: Translators/Translate Operator | ||
* | ||
*/ | ||
|
||
#pragma D option quiet | ||
|
||
struct task_struct *T; | ||
|
||
BEGIN | ||
{ | ||
T = 0; | ||
mypr_addr = xlate < psinfo_t > (T).pr_addr; | ||
printf("pr_addr: %p", mypr_addr); | ||
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