Re: [abc-users] Adding tags in a ReweavingAnalysis

From: Eric Bodden <>
Date: Wed May 09 2007 - 14:18:37 BST

Hi, Nathan.

Yes, there is a way to do this. First of all, we only reset method
bodies (and their statements/locals/traps) when doing reweaving. In
particular, the SootMethods themselves should remain the same
throughout the entire time, so if you tag those, tags should remain.

For statements however, you need to use the following API. "Weaver"
has a method getUnitBindings() which gives you a mapping from the
*original* statement before weaving to the *current* copy of this
statement. What you want is the inverse mapping. So you should
retrieve this Map, using
abc.main.Main.v().getAbcExtension().getWeaver().getUnitBindings() and
then inverse that map. Then for each "current statement" you want to
tag, you retrieve the original one via that map and tag that statement

(We should maybe add a helper method similar to Weaver.rebind(Unit),
which does the opposite kind of rebinding in the next abc version...)


On 09/05/07, Nathan Weston <> wrote:
> Hello!
> I'm currently working on an extension to ABC which performs an
> analysis of potential interactions between aspects. As it makes sense
> to analyse these interactions post-weave-time, I've included the
> analysis as a Reweaving Pass and it seems to work quite well in that
> context.
> One of the things I would like to do is be able to output Jimple files
> which are tagged with the interactions my analysis has found, such
> that they can be seen by the developer. Thus in my analyze() method I
> have this sort of thing:
> Stmt s = ...;
> s.addTag(new StringTag("Link: " + link + " at " + defname));
> s.addTag(new ColorTag(ColorTag.RED, "IA"));
> return true; // thus ensuring reweaving happens
> However, when I run the analysis with the Soot options "-f jimple" and
> "-print-tags", these tags are seemingly not preserved past the
> ReweavingAnalysis stage. I suspect this has something to do with the
> analysis not being a BodyTransformer which is added to a
> transformation pack, but I was wondering if anyone knew of a way of
> adding tags to Stmts within a ReweavingAnalysis that could be
> preserved and output along with the Jimple?
> Thank you for any help!
> Nathan Weston
> Lancaster University

Eric Bodden
Sable Research Group
McGill University, Montréal, Canada
Received on Wed May 09 14:18:41 2007

This archive was generated by hypermail 2.1.8 : Wed May 09 2007 - 14:30:09 BST