[RFC updated PATCHES] Bug Translator 3016 : Error accessing members of anonymous structs / unions
Masami Hiramatsu
mhiramat@redhat.com
Wed Sep 17 14:45:00 GMT 2008
Hi Prerana,
Thank you for fixing!
I checked this patch worked well.
$ 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 370usr/30sys/401real ms.
semantic error: struct/union 'children' is being accessed instead of a member of the struct/union: identifier
'$port_dev' at <input>:1:67
Pass 2: analyzed script: 2 probe(s), 0 function(s), 0 embed(s), 0 global(s) in 160usr/1930sys/2092real ms.
Pass 2: analysis failed. Try again with more '-v' (verbose) options.
Ack!
Prerna Saxena wrote:
> Hi Masami,
> Thanks for letting me know..
> It pointed me to an incorrect pointer reference that I had
> overlooked...Its funny why this was never uncovered in all test-runs I
> had on x86 & x86_64 :-)
> Here's the updated patch...with this, your test script correctly throws
> a semantic error instead of causing SEGV.
>
> Masami Hiramatsu wrote:
>> Hi Prerna,
>>
>> Prerna Saxena wrote:
>>> Agree, but making "die_mem" as the 6th arg will disturb the call flow.
>>> This is because in each recursive call, the 6th arg is overwritten by
>>> a die which is pointed to by DW_AT_type attribute of the original
>>> attr_mem. If die_mem is re-used as 6th arg instead of a new variable,
>>> the old contents of die (in the parent recursive call) will also be
>>> lost as both die & die_mem point to the same location, (whose
>>> contents would be overwritten). This is not a problem if search in a
>>> branch has succeeded-- but in case a search path fails and a new
>>> branch needs to be tried, this will deem it impossible.
>>>
>>> I agree with your concern about "temp_die_2" being local memory on
>>> the stack which may be reused, so I've fixed it by copying the
>>> contents of "temp_die_2" to "die_mem" in case of a successful match.
>>> This should take care of memory errors.
>>
>> Hmm, you seems right, but the below command still cause SEGV.
>>
>> $ 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
>> 370usr/30sys/404real ms.
>> Segmentation fault
>>
>> Would you run above command for testing & debugging?
>>
>> Thank you,
>>
> Thanks & regards,
>
--
Masami Hiramatsu
Software Engineer
Hitachi Computer Products (America) Inc.
Software Solutions Division
e-mail: mhiramat@redhat.com
More information about the Systemtap
mailing list