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

From: Nathan Weston <npweston_at_gmail.com>
Date: Fri, 29 May 2009 09:13:27 +0100

Further discovery - if I manually insert LinkTags into an XML file after a
successful run of the Soot plugin, those changes are reflected in Eclipse. So
there should be no problem with integrating with the Soot plugin, as it appears
to just get its data from the XML files and doesn't keep a handle.

Hope that helps!
Nathan

Nathan Weston wrote:
> Hi Eric,
>
> Getting closer - having run Soot from the Eclipse plugin and choosing a
> similar analysis (Reaching Definitions), it adds the appropriate
> LinkTags to .java files but produces the same error as before with .aj
> files. Perhaps it isn't linking with the AJDT plugin properly?
>
> I'm running abc directly from the command-line; I wondered if that might
> be an issue but I've been able to add ColorTags in the past (this was a
> while ago, using previous versions of both Soot and abc, and Eclipse for
> that matter).
>
> Thanks,
> Nath
>
> Eric Bodden wrote:
>> Hi Nathan.
>>
>> Good to see that we are making process. The exception seems to be
>> caused by the fact that the DOM tree is not present when the Soot
>> Eclipse plugin tries to parse it. I am not sure why this happens. How
>> exactly are you executing abc?
>>
>> Usually, the way the Soot Eclipse plugin works is that the user starts
>> Soot *through the plugin*. Soot then produces the XML files, and -I
>> think- retains a handle to the files. That way when you open a Java or
>> Jimple file, Soot can access the attribute data from the XML files.
>>
>> Now if you run Soot (or abc for that matter) differently, i.e. not
>> through the UI provided by the Soot plugin I suspect that the plugin
>> has problems accessing the file. But that's just a "guesstimation". It
>> would really help to know what exactly you are doing to provoke the
>> exception.
>>
>> Eric
>>
>> P.S. The code for the eclipse plugin is available online in Soot's SVN
>> under soot/eclipse.
>>
>> 2009/5/28 Nathan Weston <npweston_at_gmail.com>:
>>> 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 Fri May 29 2009 - 09:13:33 BST

This archive was generated by hypermail 2.2.0 : Fri May 29 2009 - 14:20:12 BST