variables in scopes
Ulrich Drepper
drepper@redhat.com
Wed Apr 13 18:57:00 GMT 2005
Vara Prasad wrote:
> Let me make sure i understand your proposal.
> Let us say if function z calls function a and then function a calls
> function b like in the following.
> z(i,j)->a(x,y)->b(c,d)
That's not really possible. This would require that we can do all this
work at runtime since there is no guarantee that b is called from a alone.
I'm talking about either inlined functions or code like this:
int foo (int a, int b) {
int c = a;
if (c != 0) {
int a = 42 + b;
bar(&a);
c += a;
}
return c;
}
Here 'a' is shadowed. You can easily construct a similar case with
inlining. And both variables could be parameters, of local variables,
or any combination.
In DWARF the if block is encoded with DW_TAG_lexical_block. This is one
level down from the block of the function. So the variable could
theoretically be accessed for a probe at the call to 'bar' with
@a@
and the parameter with
@a\1@
meaning, one level up.
> Can you give me some example usage for this feature in a systemtap script?
I think you see that the misunderstanding has prevented you from seeing
an application. A probe at the call to 'bar' certainly might want to
look at the parameter 'a'.
--
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 251 bytes
Desc: OpenPGP digital signature
URL: <http://sourceware.org/pipermail/systemtap/attachments/20050413/9c391800/attachment.sig>
More information about the Systemtap
mailing list