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


Wenji Huang wrote:
Hi guru,

I just began to know about the project and ran into some problems.

   a. dereference pointer
      probe kernel.function("schedule").return{
         $prev can be accessed, but just treated as long type
         $prev->pid can't be accessed
       }

Here's what is going on here. We really don't have access to parameters in return probes. So, we fake it. When you access a parameter in a return probe, the systemtap translator actually creates an entry probe that cache's the parameter values so you can access them in the return probe.


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.)

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