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

Kevin Stafford kevinrs@us.ibm.com
Tue Sep 13 21:37:00 GMT 2005


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





More information about the Systemtap mailing list