This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: $return in wildcarded void functions
Mike Mason <mmlnx@us.ibm.com> writes:
> I'd prefer something like the current preprocessing conditionals
> [...] I assume it isn't a simple matter of extending the
> preprocessing code since preprocessing is done before accessing the
> dwarf info.
Indeed. Plus preprocessor conditionals don't nest within the other
nonterminals - they just enclose arbitrary token lists.
I've thought about it a while, and it seems easiest as well as fairly
general to support markup of the $variable use itself. Since more
elaborate script code may want to substitute a missing $value, and
also know that such a substitution has been done, we'd probably need
two variables:
# probe module("uhci_hcd").function("*").return
# {
# if ($?return)
# printf ("%s <- %s: %s\n", thread_indent(-2), probefunc(), errno_str($!return))
# else
# printf ("%s <- %s: void\n", thread_indent(-2), probefunc())
# }
So $?var would return true or false if the given expression was
defined. And $!var would return the value, if defined, or else fall
back to 0. (This could also cover a fault being encountered while
$!var->field->array[99] pointer chains were gbeing followed.)
So:
$?var==0 implies $!var==0
$?var==0 implies $var would have caused compile-time error
$?var==1 implies $!var equals what $var would have
While $?var would be a compile-time constant, by also providing the
"faultless" $!var variant, there is no need to be clever within the
translator.
- FChE