This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: stucture element variable access problem
- From: Li Guanglei <guanglei at cn dot ibm dot com>
- To: "Mao, Bibo" <bibo dot mao at intel dot com>
- Cc: systemtap at sources dot redhat dot com
- Date: Fri, 19 May 2006 12:24:15 +0800
- Subject: Re: stucture element variable access problem
- Organization: IBM CSTL
- References: <9FBCE015AF479F46B3B410499F3AE05BEDA9CD@pdsmsx405>
Mao, Bibo 写道:
> My kernel version is 2.6.9-36.ELia32, and it will use $q->elevator.elevator_name get its name, for kernel >2.6.10 $q->elevator->elevator_type->elevator_name will be used to get the name.
> My original meaning is that if variable is structure pointer type, it will be ok to access its element like "elevator_type->elevator_name". But if the variable is structure type but not pointer type, there will be error to access its element like "elevator.elevator_name".
> In my IA32 and IA64 box, there will be the same error on 2.6.9-36.EL version. I do not know whether there is one method to access structure type variable's element.
>
You should use:
$q->elevator->elevator_name
instead of:
$q->elevator.elevator_name
The following script works well for me on 2.6.9-34.19.EL/ppc64
probe kernel.function("__elv_add_request")
{
elevator_name = kernel_string($q->elevator->elevator_name)
printf("%s\n", elevator_name)
}