Re: [abc-users] polyglot compiler exception while using abc to instrument aspect code

From: Eric Bodden <eric.bodden_at_mail.mcgill.ca>
Date: Wed, 15 Oct 2008 13:02:21 -0400

Hi Luca.

At a first glance I cannot see anything wrong with your code. Are you
sure that the un-modified abc does not also fail on the same input
program? What is you input program anyway? What aspects do you have
and what are you weaving them into?

Eric

2008/10/15 Luca Cavallaro <cavallaro_at_elet.polimi.it>:
> Dear all,
> I found out the following problem using abc:
> I am trying to instrument the compiled code in order to deduce basic blocks
> coverage. To do this I read the soot tutorial to instrument class files and
> I produced the following code:
> I modified abc.main.AbcExtension adding to the method addJimplePacks()these
> four code lines:
>
> //added by me
> Scene.v().addBasicClass("abc.aspectj.instrumentation.BlockTagger",SootClass.SIGNATURES);
> //added by me
> Scene.v().addBasicClass("java.io.PrintStream",SootClass.SIGNATURES);
> //added by me
> Scene.v().addBasicClass("java.lang.System",SootClass.SIGNATURES);
> PackManager.v().getPack("jtp").add(new Transform("jtp.uce",
> UnreachableCodeEliminator.v()));
> //added by me
> PackManager.v().getPack("jtp").add(new Transform("jtp.blockInstrumentation",
> new BlockInstrumenter()));
>
> I built a BlockInstrumenter class which extends BodyTransformer and I
> redefined internaltransform method:
>
> protected void internalTransform(Body b, String arg1, Map arg2) {
> SootClass sc =
> Scene.v().getSootClass("abc.aspectj.instrumentation.BlockTagger");
> SootMethod instrumenter = sc.getMethodByName("tagFirstUnitInBlock");
> BlockGraph bg = new CompleteBlockGraph(b);
> List<Block> blocksInGraph = bg.getBlocks();
> Chain units = b.getUnits();
> for(Block bl: blocksInGraph){
> Unit head = bl.getHead();
> InvokeExpr incExpr=
> Jimple.v().newStaticInvokeExpr(instrumenter.makeRef());
> Stmt incStmt = Jimple.v().newInvokeStmt(incExpr);
> units.insertAfter(incStmt,head);
> }
>
> Here is the code of the class I am trying to use for instrumentation. This
> class has a static method that I would like to add a call to when a basic
> block is entered.
>
> public class BlockTagger {
> public static void tagFirstUnitInBlock(Unit u){
> ExecutedBlockTag t = new ExecutedBlockTag();
> ExecutedBlockTagAggregator ta = new ExecutedBlockTagAggregator();
> ta.considerTag(t, u);
> }
>
> }
>
> ExecutedBlockTag() implements Tag and contains a boolean field.
> ExecutedBlockTagAggregator() has an overridden method:
> public void considerTag(Tag t, Unit u) {
> units.add(u);
> tags.add(t);
> }
>
> When I run abc on my target program the compilation fails reporting the
> following exception:
>
> polyglot.util.InternalCompilerError: BoundPoint.aj:29,1-32:2: Error during
> matching
> at
> abc.weaving.matching.AdviceApplication.doShadows(AdviceApplication.java:208)
> at abc.main.AbcExtension.findMethodShadows(AbcExtension.java:508)
> at
> abc.weaving.matching.AdviceApplication.doMethod(AdviceApplication.java:275)
> at
> abc.weaving.matching.AdviceApplication.computeAdviceLists(AdviceApplication.java:312)
> at
> abc.weaving.aspectinfo.GlobalAspectInfo.computeAdviceLists(GlobalAspectInfo.java:463)
> at analysis.aspectj.Main.preprocess(Main.java:381)
> at analysis.aspectj.Main.main(Main.java:91)
> Caused by: java.lang.NullPointerException
> at abc.weaving.residues.CheckType.construct(CheckType.java:62)
> at abc.weaving.residues.Bind.construct(Bind.java:89)
> at abc.weaving.aspectinfo.ArgVar.matchesAt(ArgVar.java:53)
> at abc.weaving.aspectinfo.Args.matchesAt(Args.java:134)
> at abc.weaving.aspectinfo.AndPointcut.matchesAt(AndPointcut.java:68)
> at
> abc.weaving.matching.AdviceApplication$2.run(AdviceApplication.java:114)
> at
> abc.weaving.matching.AdviceApplication.doShadows(AdviceApplication.java:191)
> ... 6 more
> polyglot.util.InternalCompilerError: BoundPoint.aj:29,1-32:2: Error during
> matching
> at
> abc.weaving.matching.AdviceApplication.doShadows(AdviceApplication.java:208)
> at abc.main.AbcExtension.findMethodShadows(AbcExtension.java:508)
> at
> abc.weaving.matching.AdviceApplication.doMethod(AdviceApplication.java:275)
> at
> abc.weaving.matching.AdviceApplication.computeAdviceLists(AdviceApplication.java:312)
> at
> abc.weaving.aspectinfo.GlobalAspectInfo.computeAdviceLists(GlobalAspectInfo.java:463)
> at analysis.aspectj.Main.preprocess(Main.java:381)
> at analysis.aspectj.Main.main(Main.java:91)
> Caused by: java.lang.NullPointerException
> at abc.weaving.residues.CheckType.construct(CheckType.java:62)
> at abc.weaving.residues.Bind.construct(Bind.java:89)
> at abc.weaving.aspectinfo.ArgVar.matchesAt(ArgVar.java:53)
> at abc.weaving.aspectinfo.Args.matchesAt(Args.java:134)
> at abc.weaving.aspectinfo.AndPointcut.matchesAt(AndPointcut.java:68)
> at
> abc.weaving.matching.AdviceApplication$2.run(AdviceApplication.java:114)
> at
> abc.weaving.matching.AdviceApplication.doShadows(AdviceApplication.java:191)
> ... 6 more
>
> does anyone have any suggestion that can help me?
> thanks in advance
> Luca
>
> --
> Luca Cavallaro
> Ph.D. student
> DEI, Politecnico di Milano,
> Via Golgi 40
> 200133 Milan,
> Italy
> /------------------------------------------------------------/
> Aphasia is the loss of speech in computer scientists when asked:
> "But of what use is your research?"
>
>
>
>

-- 
Eric Bodden
Sable Research Group
McGill University, Montréal, Canada
Received on Wed Oct 15 2008 - 18:02:28 BST

This archive was generated by hypermail 2.2.0 : Wed Oct 15 2008 - 18:30:11 BST