This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: [RFC PATCH 1/2] Bug Translator 3016 : Error accessing members of anonymous structs / unions
- From: Masami Hiramatsu <mhiramat at redhat dot com>
- To: Prerna Saxena <prerna at linux dot vnet dot ibm dot com>
- Cc: systemtap at sourceware dot org
- Date: Wed, 03 Sep 2008 11:26:21 -0400
- Subject: Re: [RFC PATCH 1/2] Bug Translator 3016 : Error accessing members of anonymous structs / unions
- References: <48B7BE86.9070905@linux.vnet.ibm.com> <48B8722F.8010203@redhat.com>
Masami Hiramatsu wrote:
> Hi Prerna,
>
> Prerna Saxena wrote:
>> Hi all,
>> This patch modifies tapsets.cxx to enable members of anonymous structs/
>> unions to be recognised by the systemtap translator.
>> Pls let me know your comments..
>
> I'm interested in this feature.
>
> I tested your patches on x86-64 with elfutils-0.137, and I got a SEGV
> when I ran following command:
>
> $ stap -e 'probe module("libsas").function("sas_ex_revalidate_domain")
> {print($port_dev->ex_dev->children)}' -vvvp2
Curiously, on i386, it just shows an error.
$ stap -e 'probe module("libsas").function("sas_ex_revalidate_domain")
{print($port_dev->ex_dev->children)}' -vp2
Pass 1: parsed user script and 45 library script(s) in 300usr/0sys/307real ms.
semantic error: struct/union 'children' is being accessed instead of a member of the struct/union: identifier '$port_dev' at <input>:2:8
Pass 2: analyzed script: 1 probe(s), 0 function(s), 0 embed(s), 0 global(s) in 90usr/310sys/398real ms.
Pass 2: analysis failed. Try again with more '-v' (verbose) options.
Actually, previous example is not correct script. :-(
And following a 'correct' script works on i386/x86-64 with your patch.
$ stap -ve 'probe kernel.function("block_sync_page") {print($page->private)}' -p4
Pass 1: parsed user script and 45 library script(s) in 310usr/0sys/315real ms.
Pass 2: analyzed script: 1 probe(s), 1 function(s), 0 embed(s), 0 global(s) in 300usr/320sys/620real ms.
Pass 3: translated to C into "/tmp/stapEgPsRp/stap_0299bd2b710f6d0969906b7d8f2a6301_734.c" in 180usr/360sys/543real ms.
/home/mhiramat/.systemtap/cache/02/stap_0299bd2b710f6d0969906b7d8f2a6301_734.ko
Pass 4: compiled C into "stap_0299bd2b710f6d0969906b7d8f2a6301_734.ko" in 3080usr/400sys/3526real ms.
So, I think your patch correctly works on i386, but there is
a bug on x86-64.
Thank you,
--
Masami Hiramatsu
Software Engineer
Hitachi Computer Products (America) Inc.
Software Solutions Division
e-mail: mhiramat@redhat.com