Re: [abc-users] Determine a basic block

From: Amjad Nusayr <anusayr_at_cs.nmsu.edu>
Date: Wed, 16 Apr 2008 08:15:48 -0600

Hi Thomas
In my work I wanted to know the first and last stmt in a basic block, I
did this by creating a new ExceptionalBlockGraph, and a new Position
class called BlockMethodPosition, this way I could get more info about
the basic blocks in the original java source code.

Please note that the first and last stmts are going to be jimple stmts
not java stmts. Also a first and last stmts of a block are sometimes the
same; for example

for (i=1;i<=4;i++)
{
            i=i+2;
}

here i<=4 is the first and last stmt of the block.
Bruno's work in loopsAJ was very helpful

http://intranet.cs.man.ac.uk/cnc/projects/loopsaj.php

and

http://abc.comlab.ox.ac.uk/archives/users/2005-Mar/0004.html

feel free to ask any other questions.

Regards
Amjad

Thomas Pawlitzki wrote:
> Hello Amjad,
>
> I am planning to do something similar. A block which can be matched by
> a pointcut expression but can also expose arguments into the advice.
>
> I imagine something like:
>
> public void foo() {
> ...
> block(a, "hallo", b) {
> // Block statments
> }
> ...
> }
>
>
> Because I only worked with the frontend's of abc I have some
> difficulties to start with the block-pointcut. Perhaps you can
> describe your proceeding to give me some help
>
> Thank you in advance.
>
> Greetings,
> Thomas
>
>
>
> 2008/4/10, Amjad Nusayr <anusayr_at_cs.nmsu.edu>:
>
>> Hi
>> I have created an extension that allows basic blocks to be shadowed, the
>> extension works fine, as Eric said, I created a BlockShadowMatch to do the
>> work. but it seems that I cant get any reflective information working. I
>> have created - in my runtime source - a basic block factory class. and in my
>> BlockShadowMatch.makeSJPInfo, I refer to my BlockSignatureImpl.
>>
>> When I try to access information of the new block joinpoint using
>> thisJoinPoint, abc weaves without any problems, but when I try to run my
>> program, I get the following error.
>>
>> --------------------------------
>> Exception in thread "main" java.lang.VerifyError: (class: Hello, method:
>> <init>
>> signature: ()V) Expecting to find unitialized object on stack
>> ------------------------------------
>>
>> Does anyone know what Im doing wrong?? the new joinpoint works fine
>> elsewise!!
>>
>> Regards
>> Amjad
>>
>>
>>
>>
>> Eric Bodden wrote:
>>
>>
>>> Hi.
>>>
>>> Right now, abc supports has two types for ShadowMatch: StmtShadowMatch
>>> and BodyShadowMatch. You probably want to extend this to also provide
>>> a BlockShadowMatch. Also, you have to create a new subclass of
>>> ShadowType, e.g. BlockShadowType, and register it in:
>>> AbcExtension.listShadowTypes().
>>>
>>> Basic blocks are easy to figure out from Jimple: Just create a new
>>> soot.toolkits.graph.BlockGraph.
>>>
>>> Eric
>>>
>>> On 05/03/2008, Amjad Nusayr <anusayr_at_cs.nmsu.edu> wrote:
>>>
>>>
>>>
>>>> Hi
>>>> Im trying to write an extension where I want to shadow a basic block of
>>>> code, jimple does not have any direct way of doing this, does any body
>>>> have any idea how to achieve this?
>>>>
>>>>
>>>>
>>>> Amjad Nusayr
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>
>>
Received on Wed Apr 16 2008 - 15:15:57 BST

This archive was generated by hypermail 2.2.0 : Wed Apr 16 2008 - 19:30:11 BST