public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* RE: stucture element variable access problem
@ 2006-05-19  3:32 Mao, Bibo
  2006-05-19  4:24 ` Li Guanglei
  0 siblings, 1 reply; 5+ messages in thread
From: Mao, Bibo @ 2006-05-19  3:32 UTC (permalink / raw)
  To: Li Guanglei; +Cc: systemtap

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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: stucture element variable access problem
  2006-05-19  3:32 stucture element variable access problem Mao, Bibo
@ 2006-05-19  4:24 ` Li Guanglei
  0 siblings, 0 replies; 5+ messages in thread
From: Li Guanglei @ 2006-05-19  4:24 UTC (permalink / raw)
  To: Mao, Bibo; +Cc: systemtap

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=GB2312, Size: 955 bytes --]

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: stucture element variable access problem
@ 2006-05-19  4:52 Mao, Bibo
  0 siblings, 0 replies; 5+ messages in thread
From: Mao, Bibo @ 2006-05-19  4:52 UTC (permalink / raw)
  To: Li Guanglei; +Cc: systemtap

Oh, yes it is. That works for me now :)

Thanks
Bibo,mao

>-----Original Message-----
>From: Li Guanglei [mailto:guanglei@cn.ibm.com]
>Sent: 2006年5月19日 12:24
>To: Mao, Bibo
>Cc: systemtap@sources.redhat.com
>Subject: Re: stucture element variable access problem
>
>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)
>}

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: stucture element variable access problem
  2006-05-19  3:02 bibo,mao
@ 2006-05-19  3:21 ` Li Guanglei
  0 siblings, 0 replies; 5+ messages in thread
From: Li Guanglei @ 2006-05-19  3:21 UTC (permalink / raw)
  To: bibo,mao; +Cc: systemtap

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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* stucture element variable access problem
@ 2006-05-19  3:02 bibo,mao
  2006-05-19  3:21 ` Li Guanglei
  0 siblings, 1 reply; 5+ messages in thread
From: bibo,mao @ 2006-05-19  3:02 UTC (permalink / raw)
  To: systemtap

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:

probe __elv_add_request@drivers/block/elevator.c:171 pc=0xc02017e2
pattern 'kernel' matches module 'kernel'
keeping expression operator '=' at 1.stp:3:16 because it writes: elevator_name and/or embedded: 0
semantic error: unresolved target-symbol expression: identifier '$q' at 1.stp:3:18
semantic error: probe_0 with unresolved type for identifier 'elevator_name' at 1.stp:3:2
semantic error: unresolved target-symbol expression: identifier '$q' at 1.stp:3:18
Pass 2: analyzed script: 1 probe(s), 0 function(s), 0 global(s) in 210usr/30sys/224real ms.
Pass 2: analysis failed.  Try again with more '-v' (verbose) options.

thanks
bibo,mao

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-05-19  4:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-19  3:32 stucture element variable access problem Mao, Bibo
2006-05-19  4:24 ` Li Guanglei
  -- strict thread matches above, loose matches on Subject: below --
2006-05-19  4:52 Mao, Bibo
2006-05-19  3:02 bibo,mao
2006-05-19  3:21 ` Li Guanglei

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).