$return in wildcarded void functions
David Smith
dsmith@redhat.com
Wed Mar 7 17:05:00 GMT 2007
Frank Ch. Eigler wrote:
> 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.
Hmm, I'm missing something. Why do we need $?var *and* $!var? It seems
like $?var would suffice.
--
David Smith
dsmith@redhat.com
Red Hat
http://www.redhat.com
256.217.0141 (direct)
256.837.0057 (fax)
More information about the Systemtap
mailing list