[prev in list] [next in list] [prev in thread] [next in thread] 

List:       soot-list
Subject:    [Soot-list] Android application call graph
From:       Xueliang Li <xueliang () ruc ! dk>
Date:       2014-10-29 10:12:07
Message-ID: D075CE1F.57F9%xueliang () ruc ! dk
[Download RAW message or body]

Hi all,

I am now constructing the cll graph of an Android app, a game app. The main code in \
as below:


public static void main(String[] args) {

// TODO Auto-generated method stub

SetupApplication app = new \
SetupApplication("/Users/xueliang/Documents/tools/sootpackages/android-4.0.3_r1.jar","/Users/xueliang/Documents/tools/AndroidInstrument/cocos2d_android.apk");
 try {

app.calculateSourcesSinksEntrypoints("/Users/xueliang/Documents/workspace/soot-infoflow-android/SourcesAndSinks.txt");


} catch (IOException e) {

// TODO Auto-generated catch block

e.printStackTrace();

} catch (XmlPullParserException e) {

// TODO Auto-generated catch block

e.printStackTrace();

       }

        soot.G.reset();

Options.v().set_src_prec(Options.src_prec_apk);

Options.v().set_process_dir(Collections.singletonList("/Users/xueliang/Documents/tools/AndroidInstrument/cocos2d_android.apk"));


Options.v().set_android_jars("/Users/xueliang/Documents/tools/sootpackages");

Options.v().set_whole_program(true);

Options.v().set_allow_phantom_refs(true);

Options.v().set_output_format(Options.output_format_none);

Options.v().setPhaseOption("cg.spark", "on");

        Scene.v().loadNecessaryClasses();

        SootMethod entryPoint = app.getEntryPointCreator().createDummyMain();

        Options.v().set_main_class(entryPoint.getSignature());

         Scene.v().setEntryPoints(Collections.singletonList(entryPoint));

 System.out.println(entryPoint.getActiveBody());

         PackManager.v().runPacks();

System.out.println(Scene.v().getCallGraph().size());

        }

However,  I still cannot get the expected result, a call graph.  The information \
shown in console is a large amount, I summarise it as the steps below:

1. The message is

  “[Call Graph] For information on where the call graph may be incomplete, use the \
verbose option to the cg phase.  [Spark] Pointer Assignment Graph in 0.4 seconds.
   [Spark] Type masks in 0.1 seconds.
   [Spark] Pointer Graph simplified in 0.0 seconds.
   [Spark] Propagation in 5.1 seconds.
   [Spark] Solution found in 5.1 seconds.
   Callback analysis done.
   Found 0 layout controls
   Using '/Users/xueliang/Documents/tools/sootpackages/android-4.0.3_r1.jar' as \
android.jar"

2. A large list of warnings displays all the phantom classes, like

    Warning: java.lang.NoClassDefFoundError is a phantom class!
    Warning: java.lang.StringBuffer is a phantom class!
    Warning: java.lang.Boolean is a phantom class!
    Warning: java.lang.Long is a phantom class!
    Warning: java.lang.Integer is a phantom class!
    Warning: java.lang.Short is a phantom class!
    …………………………….

3. The generated main method, like

     public static void dummyMainMethod()
    {
        int $i0;
        org.cocos2d.tests.SoundEngineTest $r0;
        ……………………………………

4. Repeat steps 1 to 3 for three times, exactly the same message.

5. Transform all the classes in the app, like

   Transforming org.cocos2d.tests.ActionsTest$ActionProperty...
   Transforming com.badlogic.gdx.physics.box2d.joints.MouseJointDef...
   Transforming org.cocos2d.nodes.CCLabel...
   Transforming org.cocos2d.utils.collections.ConcNodeCachingLinkedQueue...
   Transforming org.cocos2d.transitions.CCRadialCCWTransition…
   ………………………..
6. End with a number “30606” in the last line.

Could anyone tell me what happened? And how to fix it to get the desired call graph? \
Thank you!!

Best wishes
Xueliang


[Attachment #3 (text/html)]

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: \
after-white-space; color: rgb(0, 0, 0); font-size: 14px; font-family: Calibri, \
sans-serif;"> <div>Hi all,</div>
<div><br>
</div>
<div>I am now constructing the cll graph of an Android app, a game app. The main code \
in as below:</div> <div><br>
</div>
<div><br>
</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>public static void \
main(String[] args) {</div> <div><br>
</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>// TODO \
Auto-generated method stub</div> <div><br>
</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>SetupApplication app \
= new SetupApplication(&quot;/Users/xueliang/Documents/tools/sootpackages/android-4.0. \
3_r1.jar&quot;,&quot;/Users/xueliang/Documents/tools/AndroidInstrument/cocos2d_android.apk&quot;);</div>
 <div><span class="Apple-tab-span" style="white-space:pre"></span>try {</div>
<div><br>
</div>
<div><span class="Apple-tab-span" \
style="white-space:pre"></span>app.calculateSourcesSinksEntrypoints(&quot;/Users/xueliang/Documents/workspace/soot-infoflow-android/SourcesAndSinks.txt&quot;);</div>
 <div><br>
</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>} catch (IOException \
e) {</div> <div><br>
</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>// TODO \
Auto-generated catch block</div> <div><br>
</div>
<div><span class="Apple-tab-span" \
style="white-space:pre"></span>e.printStackTrace();</div> <div><br>
</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>} catch \
(XmlPullParserException e) {</div> <div><br>
</div>
<div><span class="Apple-tab-span" style="white-space:pre"></span>// TODO \
Auto-generated catch block</div> <div><br>
</div>
<div><span class="Apple-tab-span" \
style="white-space:pre"></span>e.printStackTrace();</div> <div><br>
</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp;}</div>
<div><br>
</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; soot.G.reset();</div>
<div><br>
</div>
<div><span class="Apple-tab-span" \
style="white-space:pre"></span>Options.v().set_src_prec(Options.src_prec_apk);</div> \
<div><br> </div>
<div><span class="Apple-tab-span" \
style="white-space:pre"></span>Options.v().set_process_dir(Collections.singletonList(& \
quot;/Users/xueliang/Documents/tools/AndroidInstrument/cocos2d_android.apk&quot;));</div>
 <div><br>
</div>
<div><span class="Apple-tab-span" \
style="white-space:pre"></span>Options.v().set_android_jars(&quot;/Users/xueliang/Documents/tools/sootpackages&quot;);</div>
 <div><br>
</div>
<div><span class="Apple-tab-span" \
style="white-space:pre"></span>Options.v().set_whole_program(true);</div> <div><br>
</div>
<div><span class="Apple-tab-span" \
style="white-space:pre"></span>Options.v().set_allow_phantom_refs(true);</div> \
<div><br> </div>
<div><span class="Apple-tab-span" \
style="white-space:pre"></span>Options.v().set_output_format(Options.output_format_none);</div>
 <div><br>
</div>
<div><span class="Apple-tab-span" \
style="white-space:pre"></span>Options.v().setPhaseOption(&quot;cg.spark&quot;, \
&quot;on&quot;);</div> <div><br>
</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; Scene.v().loadNecessaryClasses();&nbsp;</div>
<div><br>
</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; SootMethod entryPoint = \
app.getEntryPointCreator().createDummyMain();</div> <div><br>
</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; \
Options.v().set_main_class(entryPoint.getSignature());</div> <div><br>
</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp;Scene.v().setEntryPoints(Collections.singletonList(entryPoint));</div> \
<div><br> </div>
<div><span class="Apple-tab-span" \
style="white-space:pre"></span>&nbsp;System.out.println(entryPoint.getActiveBody());</div>
 <div><br>
</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;PackManager.v().runPacks();</div>
<div><br>
</div>
<div><span class="Apple-tab-span" \
style="white-space:pre"></span>System.out.println(Scene.v().getCallGraph().size());</div>
 <div><br>
</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; }</div>
<div><br>
</div>
<div>However, &nbsp;I still cannot get the expected result, a call graph. &nbsp;The \
information shown in console is a large amount, I summarise it as the steps \
below:</div> <div><br>
</div>
<div>1. The message is&nbsp;</div>
<div><br>
</div>
<div>&nbsp; “[Call Graph] For information on where the call graph may be incomplete, \
use the verbose option to the cg phase.</div> <div>&nbsp; &nbsp;[Spark] Pointer \
Assignment Graph in 0.4 seconds.</div> <div>&nbsp; &nbsp;[Spark] Type masks in 0.1 \
seconds.</div> <div>&nbsp; &nbsp;[Spark] Pointer Graph simplified in 0.0 \
seconds.</div> <div>&nbsp; &nbsp;[Spark] Propagation in 5.1 seconds.</div>
<div>&nbsp; &nbsp;[Spark] Solution found in 5.1 seconds.</div>
<div>&nbsp; &nbsp;Callback analysis done.</div>
<div>&nbsp; &nbsp;Found 0 layout controls</div>
<div>&nbsp; &nbsp;Using \
'/Users/xueliang/Documents/tools/sootpackages/android-4.0.3_r1.jar' as \
android.jar&quot;</div> <div><br>
</div>
<div>2. A large list of warnings displays all the phantom classes, like</div>
<div><br>
</div>
<div>&nbsp; &nbsp; Warning: java.lang.NoClassDefFoundError is a phantom class!</div>
<div>&nbsp; &nbsp; Warning: java.lang.StringBuffer is a phantom class!</div>
<div>&nbsp; &nbsp; Warning: java.lang.Boolean is a phantom class!</div>
<div>&nbsp; &nbsp; Warning: java.lang.Long is a phantom class!</div>
<div>&nbsp; &nbsp; Warning: java.lang.Integer is a phantom class!</div>
<div>&nbsp; &nbsp; Warning: java.lang.Short is a phantom class!</div>
<div>&nbsp; &nbsp; …………………………….</div>
<div>&nbsp; &nbsp;&nbsp;</div>
<div>3. The generated main method, like</div>
<div><br>
</div>
<div>&nbsp; &nbsp; &nbsp;public static void dummyMainMethod()</div>
<div>&nbsp; &nbsp; {</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; int $i0;</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; org.cocos2d.tests.SoundEngineTest $r0;</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; ……………………………………</div>
<div><br>
</div>
<div>4. Repeat steps 1 to 3 for three times, exactly the same message.</div>
<div><br>
</div>
<div>5. Transform all the classes in the app, like</div>
<div><br>
</div>
<div>
<div>&nbsp; &nbsp;Transforming \
org.cocos2d.tests.ActionsTest$ActionProperty...&nbsp;</div> <div>&nbsp; \
&nbsp;Transforming com.badlogic.gdx.physics.box2d.joints.MouseJointDef...&nbsp;</div> \
<div>&nbsp; &nbsp;Transforming org.cocos2d.nodes.CCLabel...&nbsp;</div> <div>&nbsp; \
&nbsp;Transforming org.cocos2d.utils.collections.ConcNodeCachingLinkedQueue...&nbsp;</div>
 <div>&nbsp; &nbsp;Transforming \
org.cocos2d.transitions.CCRadialCCWTransition…&nbsp;</div> </div>
<div>&nbsp; &nbsp;………………………..</div>
<div>6. End with a number “30606” in the last line.</div>
<div><br>
</div>
<div>Could anyone tell me what happened? And how to fix it to get the desired call \
graph? Thank you!!</div> <div><br>
</div>
<div>Best wishes</div>
<div>Xueliang</div>
<div><br>
</div>
<div><br>
</div>
<div>&nbsp;&nbsp;</div>
<style><!--
/* Font Definitions */
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
	{font-family:Tahoma;
	panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
	{font-family:Monaco;
	panose-1:0 0 0 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0cm;
	margin-bottom:.0001pt;
	font-size:12.0pt;
	font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:purple;
	text-decoration:underline;}
p
	{mso-style-priority:99;
	mso-margin-top-alt:auto;
	margin-right:0cm;
	mso-margin-bottom-alt:auto;
	margin-left:0cm;
	font-size:12.0pt;
	font-family:"Times New Roman","serif";}
span.apple-tab-span
	{mso-style-name:apple-tab-span;}
span.E-MailFormatvorlage19
	{mso-style-type:personal-reply;
	font-family:"Calibri","sans-serif";
	color:#1F497D;}
.MsoChpDefault
	{mso-style-type:export-only;
	font-size:10.0pt;}
@page WordSection1
	{size:612.0pt 792.0pt;
	margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
	{page:WordSection1;}
--></style>
</body>
</html>



_______________________________________________
Soot-list mailing list
Soot-list@CS.McGill.CA
https://mailman.CS.McGill.CA/mailman/listinfo/soot-list

--===============0043831909095455148==--

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic