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: access pointer and global variables


Stone, Joshua I wrote:
David Smith wrote:
But, we've thrown away the type information at that point, so the value in your case is just a long as far as systemtap is concerned. So, to access $prev->pid you are going to have to write some code to access it. See tapset/aux_syscalls.stp for examples of functions that take a pointer value and dereference fields from it.

(Alternatively you could write an entry probe yourself to cache the $prev->pid value if that is all you are interested in.)

Perhaps the SystemTap language is representing $prev as a plain long, but the translator should know better. Whether we cache $prev->pid or we cache $prev and remember how to dereference ->pid, that's just a design decision. But I think it's possible for the translator to still handle this automatically.

Hmm. What you are asking for is this:


probe kernel.function("schedule") {
    printf("pid is %d\n", $prev->pid)
    prev_copy = $prev
    printf("pid is still %d\n", prev_copy->pid)
}

That is going to be tricky to implement.


David "Grumble - dang users never satisfied. Give them parameters in return probes, and they are happy for a moment. Then they want more, always more. I can remember when we only had toggle switches on the front of the vax and were happy to have them..." Smith


--
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]