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]

enhancement: accessing exported non-scalar vars from user probe script


Suppose I am writing a probe alias for a kernel function with the following signiture:

asmlinkage long sys_connect(int fd, struct sockaddr __user *uservaddr, int addrlen)

I expect that a user may want to access the args of a system call invocation so I export
them:
_________________________________________
probe kernel.syscall.connect =
kernel.function("sys_connect") {
fd = $fd
uservaddr = $uservaddr
addrlen = $addrlen
}
probe kernel.syscall.connect {
log(string(uservaddr->sa_family))
}
_________________________________________
Produces this error:


parse error: expected ',' or ')'
       saw: operator '->' at nscalar_access.stp:6:22
parse error: expected statement
       saw: nscalar_access.stp EOF

The following script, however, works fine.
_________________________________________
probe kernel.function("sys_connect") {
       log(string($uservaddr->sa_family))
}
_________________________________________

What is the difference here? I think that if there is support for accessing structs
directly from probe scripts, than they should also be able to be exported as
non-scalars from tapsets.


Of course the other solution is to export the necessary scalar values of complex
datatypes individually:


probe my_alias.my_probe =
   kernel.function("my_system_call")
   {
      exported1 = $complex_data_struct->string1
      exported2 = $complex_data_struct->string2
      exported3 = $complex_data_struct->string3
   }

but I am unsure if this is necessary. What is the correct approach?

--
Kevin Stafford
DES 2 | MS 2M3
Beaverton - OR
Linux Technology Center
IBM Systems & Technology
Phone: 1-503-578-3039
Email: kevinrs@us.ibm.com




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