Re: [abc-users] Determine a basic block

From: Thomas Pawlitzki <>
Date: Mon, 21 Apr 2008 10:49:46 +0200

Hello Eric,

2008/4/16, Eric Bodden <>:
> Yes that could work but that would certainly be overkill. try/catch is
> modeled via traps in Jimple which is also cumbersome. Adding tags as I
> proposed earlier would be a lot easier. You can add tags to any
> soot.Unit just by calling unit.addTag(...).

This i have done. Here is the snipped from my jrag-File:

        public void ExhibitBlock.jimplify2(Body b) {
                soot.jimple.Stmt startBlock = newLabel();
                for(int i = 0; i < getNumStmt(); i++) getStmt(i).jimplify2(b);
                soot.jimple.Stmt stopBlock = newLabel();

Now I am able to identify block starts and ends in my
BlockShadowMatch. I create a new BlockShadowMatch everytime a block
end is found. The shadow match contains the begin and the end

But now i have difficulties in proceeding.
I defined a new PointcutExpr BlockPointcutExpr (extending PointcutExpr)
and craeted a weaving.aspectinfo.BlockPointcut.

When i declare a block-pointcut for an advice i can compile the source
without errors.
But only before-advices act as desiered.

Here are some snippets from my test-code:

from my test class:
        public static void main(String[] args) {

                System.out.println("before the block");
                exhibit new Testing() {
                        int times = 3;
                        for(int i = 0; i < times; i++)
                                System.out.println("Hello World! "+i);
                System.out.println("after the block");
                Test t = new Test();

The exhibit new Testing is the block i want to be matched.

And here are my test-advices:
        before() : block (aspectjtest.Testing) {
                System.out.println("\tbefore - TESTING - "+thisJoinPoint);
        after() : block (aspectjtest.Testing) {
                System.out.println("\tafter - TESTING - "+thisJoinPoint);

And here is the output i get when i run the code:

before the block

        before - TESTING - block(ClassNotFoundException aspectjtest.Test.(Test))
        after - TESTING - block(ClassNotFoundException aspectjtest.Test.(Test))
Hello World! 0
Hello World! 1
Hello World! 2

after the block

As you can see the after did not match AFTER the block.

Perhaps you can give me a hint how to fix this.


Received on Mon Apr 21 2008 - 09:49:49 BST

This archive was generated by hypermail 2.2.0 : Mon Apr 21 2008 - 14:20:11 BST