This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
RE: stucture element variable access problem
- From: "Mao, Bibo" <bibo dot mao at intel dot com>
- To: "Li Guanglei" <guanglei at cn dot ibm dot com>
- Cc: <systemtap at sources dot redhat dot com>
- Date: Fri, 19 May 2006 11:30:53 +0800
- Subject: RE: stucture element variable access problem
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.
Thanks
Bibo,mao
>-----Original Message-----
>From: Li Guanglei [mailto:guanglei@cn.ibm.com]
>Sent: 2006年5月19日 11:21
>To: Mao, Bibo
>Cc: systemtap@sources.redhat.com
>Subject: Re: stucture element variable access problem
>
>bibo,mao 写道:
>> Hi,
>> I encountered such problem when access structure element variable, if
>> the structure variable is pointer type, its element can be access, but
>> if the variable is structure type, there will be tapset translation
>> error when accessing its element. This is the test case:
>>
>> It will be ok with this test case:
>> probe kernel.function("__elv_add_request")
>> {
>> if ($q->queue_tags){
>> tag_map = $q->queue_tags->tag_map
>> printf(" %d \n", tag_map);
>> }
>> }
>> But this test case will fail:
>> probe kernel.function("__elv_add_request")
>> {
>> elevator_name = $q->elevator.elevator_name
>> }
>> And there will be such error information:
>>
>I checked into SystemTap CVS the tapsets used by LKET. Now you can use:
>probe ioscheduler.elv_add_request
>{
> printf("elv_name: %s\n", elevator_name)
>}
>
>I can't duplicate your errors on my box since my box used kernel 2.6.16.
>For kernel >= 2.6.10, you should use:
>$q->elevator->elevator_type->elevator_name to get the name.
>
>another comments is that you should use kernel_string to get the name.