This is the mail archive of the
systemtap@sources.redhat.com
mailing list for the systemtap project.
Re: variables in scopes
On Thu, 2005-04-14 at 14:05, Frank Ch. Eigler wrote:
> $var - to refer to "var" in probe target scope
> $$var - same, but skip 1 lexical scope
> $var->field - to refer to "var", dereferencing given field
> $var.subfield - analogously for non-pointer
> $var[idx] - to index an array; idx being any systemtap expression
>
> In each case, the overall value of the expression would be cast to a
> systemtap number or string type for storage. In safe mode, they would
> be an unassignable rvalue.
>
> - FChE
So far, so good. But aren't there really three classes of identifiers?
I.e.,
1. SystemTap script variables, either local (undeclared) or global.
Also auxiliary functions. These have names like "var1".
2. Identifiers in the scope of the probed function. These have names
like "$var2" or "$$var2".
3. Identifiers that have been imported from a tapset. These have names
like... what?
Of course, I have a recommendation:
local var1; // as previously discussed
probe var2; // as previously discussed
import var3;
In the last case, some tapset has "exported" var3 as the approved name
for some value provided by the tapset at the indicated probepoint. (We
might have to get sort of Java-ish in the import notation to indicate
which tapset we're importing from.)
Non-expert scripts could use only classes 1 and 3. Expert scripts could
use all three.
Jim