Re: [abc-users] Re: XML attributes in a reweaving analysis

From: Nathan Weston <npweston_at_gmail.com>
Date: Thu, 28 May 2009 16:15:07 +0100

Hi Eric,

Rather stupidly I'd instantiated a new Weaver rather than getting the
appropriate instantiation from the AbcExtension. D'oh! That works now - the
XML attributes are being written correctly. Sadly the color and link tags don't
appear to be showing up in Eclipse (either in Jimple or in the original source
files), and I get an error when I hover over the statements which have the tags:

java.lang.NullPointerException
at
ca.mcgill.sable.soot.attributes.AttributeDomProcessor.processNode(AttributeDomProcessor.java:55)
at
ca.mcgill.sable.soot.attributes.AttributeDomProcessor.processAttributesDom(AttributeDomProcessor.java:48)
at
ca.mcgill.sable.soot.attributes.SootAttributeFilesReader.readFile(SootAttributeFilesReader.java:48)
at
ca.mcgill.sable.soot.attributes.AbstractAttributesComputer.computeAttributes(AbstractAttributesComputer.java:80)
at
ca.mcgill.sable.soot.attributes.AbstractAttributesComputer.getHandler(AbstractAttributesComputer.java:133)
at
ca.mcgill.sable.soot.attributes.AbstractAttributesComputer.getAttributesHandler(AbstractAttributesComputer.java:101)
at
ca.mcgill.sable.soot.attributes.SootAttributesJimpleHover.getAttributes(SootAttributesJimpleHover.java:58)
at
ca.mcgill.sable.soot.attributes.AbstractSootAttributesHover.getHoverInfo(AbstractSootAttributesHover.java:78)
at
org.eclipse.jface.text.TextViewerHoverManager$4.run(TextViewerHoverManager.java:168)

If you have any suggestions I'd be glad to hear them, but you've been
tremendously helpful already, thanks :)

Nathan

Eric Bodden wrote:
> Hi Nathan.
>
> I just had a look at the Weaver class. The class initializes the
> mapping in the method storeBindings, which is called *before* any
> ReweavingAnalysis is executed. Therefore, when you call this method
> from within a ReweavingAnalysis then this should actually work. Maybe
> you are calling reverseRebind at the wrong point in time? I am using
> reverseRebind in line 77 of the class
> abc.eaj.weaving.weaver.maybeshared.TLOAnalysisManager if you want to
> see an example.
>
> Hope that helps.
>
> Eric
>
> 2009/5/28 Nathan Weston <npweston_at_gmail.com>:
>> Hi Eric,
>>
>> Thanks for your reply - I'd been using
>> abc.weaving.weaver.Weaver.rebind(Object), so thanks for putting me
>> right! However, now I've changed it to reverseRebind, I'm getting a
>> NullPointerException at line 120 in the Weaver class:
>>
>> Object result= reverseUnitBindings.get(unitTrapOrLocal);
>>
>> unitTrapOrLocal is certainly not null, so I can only assume it's the
>> reverseUnitBindings map which isn't being initialised. Is there
>> another method I have to call on the weaver to get this to work?
>>
>> Many thanks for your help,
>> Nathan
>>
>> 2009/5/21 Eric Bodden <eric.bodden_at_mail.mcgill.ca>:
>>> Hi Nathan.
>>>
>>> Interesting question. Would be nice to see this working... I am not
>>> quite sure about the exception that you are seeing but I think I have
>>> an explanation for why your tags get lost on the way. The problem is
>>> that after you added the tags in your reweaving analysis, abc will (1)
>>> replace all method bodies with the bodies that existed before weaving
>>> and then (2) do the weaving over again. As you can imagine, (1) also
>>> removes your tags.
>>>
>>> There is however a way to work around this. The method
>>> abc.weaving.weaver.Weaver.reverseRebind(Object) gives you for every
>>> unit, trap or local that you "see" in the reweaving analysis the
>>> corresponding unit, trap or local that you had before weaving (except
>>> for those units, traps or local that were introduced through the
>>> weaving process, of course). When you attach your tags to those units
>>> instead then I believe that abc should preserve them.
>>>
>>> Hope that helps,
>>> Eric
>>>
>>> 2009/5/21 Nathan Weston <npweston_at_gmail.com>:
>>>> Apologies, I should have said I'm using Eclipse 3.4.2, Soot Plugin 2.3.0 and
>>>> abc 1.3.0.
>>>>
>>>> Thanks,
>>>> Nathan
>>>>
>>>> Nathan Weston wrote:
>>>>> Hello all,
>>>>>
>>>>> I've implemented a new reweaving analysis which I've hooked in to abc as a
>>>>> new reweaving pass. All seems to work well except that I'd like it to
>>>>> integrate with the Soot Eclipse plugin by providing visualisations in terms
>>>>> of Color and Link Tags. In my reweaving pass I add these tags to Units in
>>>>> the method bodies, and I've added the Soot arguments "-xml-attributes" and
>>>>> "-f J".
>>>>>
>>>>> The XML files get generated and placed in an attributes folder under
>>>>> sootOutput in the appropriate project folder. However, these XML files do
>>>>> not contain the Link and Color tags I've added, though they do contain
>>>>> InPreinitializationTags. As well as this, trying to load the Jimple in
>>>>> Eclipse throws the following exception:
>>>>>
>>>>> java.lang.NullPointerException
>>>>> at
>>>>> ca.mcgill.sable.soot.attributes.AttributeDomProcessor.processNode(AttributeDomProcessor.java:55)
>>>>> at
>>>>> ca.mcgill.sable.soot.attributes.AttributeDomProcessor.processAttributesDom(AttributeDomProcessor.java:48)
>>>>> at
>>>>> ca.mcgill.sable.soot.attributes.SootAttributeFilesReader.readFile(SootAttributeFilesReader.java:48)
>>>>> at
>>>>> ca.mcgill.sable.soot.attributes.AbstractAttributesComputer.computeAttributes(AbstractAttributesComputer.java:80)
>>>>> at
>>>>> ca.mcgill.sable.soot.attributes.AbstractAttributesComputer.getHandler(AbstractAttributesComputer.java:129)
>>>>> at
>>>>> ca.mcgill.sable.soot.attributes.AbstractAttributesComputer.getAttributesHandler(AbstractAttributesComputer.java:101)
>>>>> at
>>>>> ca.mcgill.sable.soot.resources.SootPartManager.updatePart(SootPartManager.java:51)
>>>>> at
>>>>> ca.mcgill.sable.soot.resources.EditorActivationListener.partActivated(EditorActivationListener.java:45)
>>>>> at
>>>>> org.eclipse.ui.internal.PartListenerList$1.run(PartListenerList.java:72)
>>>>> at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
>>>>> at org.eclipse.core.runtime.Platform.run(Platform.java:880)
>>>>> ... lots more
>>>>>
>>>>> Any help as to where I'm going wrong would be greatly appreciated!
>>>>> nathan
>>>>
>>>
>>>
>>> --
>>> Eric Bodden
>>> Sable Research Group, McGill University
>>> Montréal, Québec, Canada
>>>
>>>
>>
>
>
>
Received on Thu May 28 2009 - 16:15:11 BST

This archive was generated by hypermail 2.2.0 : Fri May 29 2009 - 01:50:13 BST