|
From: Stephen F. <sj...@us...> - 2008-10-27 19:49:02
|
I think the issue here is that the interprocedural CFG is not
context-sensitive, so you are finding a path which is infeasible according
to matched call-return pairs. Specifically, you are finding a path in the
IPCFG as follows:
1) sayHello calls say1
2) say1 calls println
3) println returns to the the 'else' branch of sayHello
4) sayHello calls say2
which is a path in the IPCFG, but infeasible since the call 2) is
unmatched with the return 3).
SJF
------------------------------------------------------------------------
Stephen Fink
IBM T.J. Watson Research Center
sj...@us...
(914)784-7776
dongyu sun <sun...@ya...>
10/27/2008 02:06 PM
Please respond to
WALA discussion and Q&A <wal...@li...>
To
wal...@li...
cc
Subject
[Wala-wala] The use of DFSPathFinder on InterprocedureCFG
Hi,
I am testing the DFSPathFinder on a InterprocedureCFG. I have a
simple test program like following
public class HelloWorld {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
HelloWorld h=new HelloWorld();
int i[]=new int[0];
int i2=i.length;
int i3=i2;
int i4=i3;
i=null;
h.sayHello("hi ");
}
public void sayHello(String greeting)
{
TestClass testClas=new TestClass();
String test="test";
if(greeting =="")
{
System.out.println(greeting);
// testClas.method1_1(greeting);
say1();
}
else
{
System.out.println(test);
// testClas.method2(test);
say2();
}
}
void say1()
{
System.out.println("say1()");
}
void say2()
{
System.out.println("say2()");
}
}
I first constructed the InterprocedureCFG from the CallGraph, then I use
the DSFPathFinder on this InterprocedureCFG to try to find any path
between the call to say1() to the call to say2().
In above helloWorld class, as this two function call are on the two
branches of the if statement, I didn't expect any path to exist between
them, but suprisingly I got one path like following when run the
DSFPathFinder.
the line with issBlk===>.. is produced by printing the toString() output
of each of the
BasicBlockInContext<ISSABasicBlock>
the line witn ins (...) is the toString() output of each instruction in
each of the
BasicBlockInContext<ISSABasicBlock>. the number in the bracket is the line
number in the source code.
---------------------------------------------------------------------
issBlk===>BB[SSA:12..13]5 -
simple.HelloWorld.sayHello(Ljava/lang/String;)V
ins ( 29 ): invokevirtual < Application, Lsimple/HelloWorld, say1()V > 1
@25 exception:13
def Value String : v13
use Value String : v1
loca name ( this )
issBlk===>BB[SSA:-1..-2]0 - simple.HelloWorld.say1()V
issBlk===>BB[SSA:0..2]1 - simple.HelloWorld.say1()V
ins ( 43 ): 3 = getstatic < Application, Ljava/lang/System, out,
<Application,Ljava/io/PrintStream> >
def Value String : v3
ins ( 43 ): invokevirtual < Application, Ljava/io/PrintStream,
println(Ljava/lang/String;)V > 3,4 @5 exception:5
def Value String : v5
use Value String : v3
use Value String : v4:#say1()
issBlk===>BB[SSA:-1..-2]0 -
java.io.PrintStream.println(Ljava/lang/String;)V
issBlk===>BB[SSA:0..3]1 - java.io.PrintStream.println(Ljava/lang/String;)V
issBlk===>BB[SSA:4..6]2 - java.io.PrintStream.println(Ljava/lang/String;)V
issBlk===>BB[SSA:7..8]3 - java.io.PrintStream.println(Ljava/lang/String;)V
issBlk===>BB[SSA:9..10]4 -
java.io.PrintStream.println(Ljava/lang/String;)V
issBlk===>BB[SSA:11..11]5 -
java.io.PrintStream.println(Ljava/lang/String;)V
issBlk===>BB[SSA:17..17]8 -
java.io.PrintStream.println(Ljava/lang/String;)V
issBlk===>BB[SSA:-1..-2]9 -
java.io.PrintStream.println(Ljava/lang/String;)V
issBlk===>BB[SSA:18..19]8 -
simple.HelloWorld.sayHello(Ljava/lang/String;)V
ins ( 35 ): invokevirtual < Application, Lsimple/HelloWorld, say2()V > 1
@39 exception:10
def Value String : v10
use Value String : v1
loca name ( this )
It seems that the path is from the call to say1() go into the function
definition of say(), then come out and jump on to the call to say2().. Is
this path right in a CFG?
thanks
dongyu
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's
challenge
Build the coolest Linux based applications with Moblin SDK & win great
prizes
Grand prize is a trip for two to an Open Source event anywhere in the
world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Wala-wala mailing list
Wal...@li...
https://lists.sourceforge.net/lists/listinfo/wala-wala
|