This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: $return in wildcarded void functions


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)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]