[prev in list] [next in list] [prev in thread] [next in thread]
List: soot-list
Subject: [Soot-list] questions about using soot to generate dot documents
From: 张晓箐 <ddhk1991 () gmail ! com>
Date: 2014-10-11 14:52:50
Message-ID: CAM7EtvChMuP+tQiAZYAEXMeK8s2Q_b2kWfZnSm8FE0eQzCpx4Q () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
I have some questions about using soot to generate the dot documents.
I can use the command line to generate the dot documents for each method
of a class, but the graph is BriefUnitGraph not ExceptionalUnitGraph,
for example:
public class Foo {
int bar(int n) {
f();
try {
Socket socket = new Socket("127.0.0.1",10000);
}catch(Exception e) {
e.printStackTrace();
}
return n + 20;
}
void f() {
int x = 10;
boolean b = false;
if(b) {
System.out.println(x);
}
else {
System.out.println("x is not zero");
}
System.out.println("call g()");
}
public static void main(String[] args) {
Foo f = new Foo();
int a = 7;
int b = 14;
}
}
then I use the "java soot.tools.CFGVIewer -f J Foo" command line , it can
genarate the dot documents for each method of the class.
( capture1.JPG in the accessories is using the command line to generate
the dot documents , capture2.JPG is the results of using the command line.)
but the graph is not ExceptionalUnitGraph, then the graph of the bar method
in the Foo class is not correct,there is no edge from try to catch. so
here are my questions:
First , what command line can I use to generate a ExceptionalUnitGraph
type of control flow graph file(dot documents) for each method of the class?
Second , can I use the soot API to generate the dot documents with the
ExceptionalUnitGraph type for each method of the class?If the soot API is
feasible, then could you give me an example?
Thanks very much.
[Attachment #5 (text/html)]
<div dir="ltr"><div style="font-size:14px;color:rgb(0,0,0);font-family:Arial;line-height:15.8666658401489px"> \
I have some questions about using soot to generate the dot documents.</div><div \
style="font-size:14px;color:rgb(0,0,0);font-family:Arial;line-height:15.8666658401489px"> \
I can use the command line to generate the dot documents for each method of a class, \
but the graph is BriefUnitGraph not ExceptionalUnitGraph, for \
example:</div><div style="font-size:14px;color:rgb(0,0,0);font-family:Arial;line-height:15.8666658401489px"> \
</div><div style="font-size:14px;color:rgb(0,0,0);font-family:Arial;line-height:15.8666658401489px"> \
public class Foo {</div><div \
style="font-size:14px;color:rgb(0,0,0);font-family:Arial;line-height:15.8666658401489px"><span \
style="white-space:pre-wrap"> </span></div><div \
style="font-size:14px;color:rgb(0,0,0);font-family:Arial;line-height:15.8666658401489px"><span \
style="white-space:pre-wrap"> </span>int bar(int n) {<span \
style="white-space:pre-wrap"> </span></div><div \
style="font-size:14px;color:rgb(0,0,0);font-family:Arial;line-height:15.8666658401489px"><span \
style="white-space:pre-wrap"> </span> f();<span \
style="white-space:pre-wrap"> </span> </div><div \
style="font-size:14px;color:rgb(0,0,0);font-family:Arial;line-height:15.8666658401489px"><span \
style="white-space:pre-wrap"> </span>try {</div><div \
style="font-size:14px;color:rgb(0,0,0);font-family:Arial;line-height:15.8666658401489px"><span \
style="white-space:pre-wrap"> </span>Socket socket = new \
Socket("127.0.0.1",10000);<span \
style="white-space:pre-wrap"> </span></div><div \
style="font-size:14px;color:rgb(0,0,0);font-family:Arial;line-height:15.8666658401489px"><span \
style="white-space:pre-wrap"> </span>}catch(Exception e) {</div><div \
style="font-size:14px;color:rgb(0,0,0);font-family:Arial;line-height:15.8666658401489px"><span \
style="white-space:pre-wrap"> </span>e.printStackTrace();</div><div \
style="font-size:14px;color:rgb(0,0,0);font-family:Arial;line-height:15.8666658401489px"><span \
style="white-space:pre-wrap"> </span>}</div><div \
style="font-size:14px;color:rgb(0,0,0);font-family:Arial;line-height:15.8666658401489px"><span \
style="white-space:pre-wrap"> </span>return n + 20;</div><div \
style="font-size:14px;color:rgb(0,0,0);font-family:Arial;line-height:15.8666658401489px"><span \
style="white-space:pre-wrap"> </span>}</div><div \
style="font-size:14px;color:rgb(0,0,0);font-family:Arial;line-height:15.8666658401489px"><span \
style="white-space:pre-wrap"> </span></div><div \
style="font-size:14px;color:rgb(0,0,0);font-family:Arial;line-height:15.8666658401489px"><span \
style="white-space:pre-wrap"> </span> void f() {</div><div \
style="font-size:14px;color:rgb(0,0,0);font-family:Arial;line-height:15.8666658401489px"><span \
style="white-space:pre-wrap"> </span> int x = 10;</div><div \
style="font-size:14px;color:rgb(0,0,0);font-family:Arial;line-height:15.8666658401489px"><span \
style="white-space:pre-wrap"> </span> boolean b = false;</div><div \
style="font-size:14px;color:rgb(0,0,0);font-family:Arial;line-height:15.8666658401489px"><span \
style="white-space:pre-wrap"> </span> if(b) {</div><div \
style="font-size:14px;color:rgb(0,0,0);font-family:Arial;line-height:15.8666658401489px"><span \
style="white-space:pre-wrap"> </span> System.out.println(x);</div><div \
style="font-size:14px;color:rgb(0,0,0);font-family:Arial;line-height:15.8666658401489px"><span \
style="white-space:pre-wrap"> </span> }</div><div \
style="font-size:14px;color:rgb(0,0,0);font-family:Arial;line-height:15.8666658401489px"><span \
style="white-space:pre-wrap"> </span> else {</div><div \
style="font-size:14px;color:rgb(0,0,0);font-family:Arial;line-height:15.8666658401489px"><span \
style="white-space:pre-wrap"> </span> System.out.println("x is not \
zero");</div><div \
style="font-size:14px;color:rgb(0,0,0);font-family:Arial;line-height:15.8666658401489px"><span \
style="white-space:pre-wrap"> </span> }</div><div \
style="font-size:14px;color:rgb(0,0,0);font-family:Arial;line-height:15.8666658401489px"><span \
style="white-space:pre-wrap"> </span> System.out.println("call \
g()");<span style="white-space:pre-wrap"> </span> </div><div \
style="font-size:14px;color:rgb(0,0,0);font-family:Arial;line-height:15.8666658401489px"><span \
style="white-space:pre-wrap"> </span> }</div><div \
style="font-size:14px;color:rgb(0,0,0);font-family:Arial;line-height:15.8666658401489px"><span \
style="white-space:pre-wrap"> </span></div><div \
style="font-size:14px;color:rgb(0,0,0);font-family:Arial;line-height:15.8666658401489px"><span \
style="white-space:pre-wrap"> </span>public static void main(String[] args) \
{</div><div style="font-size:14px;color:rgb(0,0,0);font-family:Arial;line-height:15.8666658401489px"><span \
style="white-space:pre-wrap"> </span>Foo f = new Foo();</div><div \
style="font-size:14px;color:rgb(0,0,0);font-family:Arial;line-height:15.8666658401489px"><span \
style="white-space:pre-wrap"> </span>int a = 7;</div><div \
style="font-size:14px;color:rgb(0,0,0);font-family:Arial;line-height:15.8666658401489px"><span \
style="white-space:pre-wrap"> </span>int b = 14;<span \
style="white-space:pre-wrap"> </span></div><div \
style="font-size:14px;color:rgb(0,0,0);font-family:Arial;line-height:15.8666658401489px"><span \
style="white-space:pre-wrap"> </span>}<span \
style="white-space:pre-wrap"> </span></div><div \
style="font-size:14px;color:rgb(0,0,0);font-family:Arial;line-height:15.8666658401489px">}</div><div \
style="font-size:14px;color:rgb(0,0,0);font-family:Arial;line-height:15.8666658401489px"> \
then I use the "java soot.tools.CFGVIewer -f J Foo" command line , it can \
genarate the dot documents for each method of the class. </div><div \
style="font-family:arial,sans-serif;font-size:14px"><font color="#000000" \
face="Arial"><span style="line-height:15.8666658401489px"><br></span></font></div><div \
style="font-family:arial,sans-serif;font-size:14px"><font color="#000000" \
face="Arial"><span style="line-height:15.8666658401489px">( capture1.JPG in the \
accessories is using the command line to generate the dot documents , capture2.JPG \
is the </span></font><span \
style="line-height:15.8666658401489px;color:rgb(0,0,0);font-family:Arial">results of \
using the command line.)</span></div><div \
style="font-family:arial,sans-serif;font-size:14px"><span \
style="line-height:15.8666658401489px;color:rgb(0,0,0);font-family:Arial"><br></span></div><div \
style="font-size:14px;color:rgb(0,0,0);font-family:Arial;line-height:15.8666658401489px"><div \
dir="ltr" style="color:rgb(34,34,34);font-family:arial,sans-serif;line-height:normal"><div \
style="color:rgb(0,0,0);font-family:Arial;line-height:15.8666658401489px"><div \
style="line-height:15.8666658401489px"><div \
style="line-height:15.8666658401489px"><span \
style="line-height:15.8666658401489px">but the graph is not ExceptionalUnitGraph, \
then the graph of the bar method in the Foo class is not correct,there is no edge \
from try to catch. so here are my questions:</span><br></div><div \
style="line-height:15.8666658401489px">First , what command line <span \
style="line-height:15.8666658401489px">can I use </span><span \
style="line-height:1.7"> to generate a ExceptionalUnitGraph type of control flow \
graph file(dot documents) for each method of the class?</span></div><div \
style="line-height:15.8666658401489px"><span style="line-height:1.7">Second , can I \
use the soot API to generate the dot documents with the ExceptionalUnitGraph type \
for each method of the class?If the soot API is feasible, then could you give me an \
example?</span></div><div style="line-height:15.8666658401489px"><span \
style="line-height:1.7"><br></span></div><div \
style="line-height:15.8666658401489px"><span \
style="color:rgb(34,34,34);font-family:arial,sans-serif;line-height:normal">Thanks \
very much.</span></div></div></div></div></div></div>
--90e6ba6134f4d13ecb050526d125--
["capture1.JPG" (image/jpeg)]
["capture2.JPG" (image/jpeg)]
_______________________________________________
Soot-list mailing list
Soot-list@CS.McGill.CA
https://mailman.CS.McGill.CA/mailman/listinfo/soot-list
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic