<div dir="ltr"><div><div><div><div>Reading patched classes behavior is very hard, and I guess tedious and error-prone to write as well. Is it possible to:<br><br></div>- Instruct Soot not to load a particular class?<br></div>- Write a class in Jimple format and load it?<br><br></div>thanks,<br></div>Denis<br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On 29 March 2016 at 01:27, Steven Arzt <span dir="ltr">&lt;<a href="mailto:Steven.Arzt@cased.de" target="_blank">Steven.Arzt@cased.de</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div link="blue" vlink="purple" lang="DE"><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d" lang="EN-US">Hi Denis,<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d" lang="EN-US"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d" lang="EN-US">This code is implemented in a very defensive way. We might already have a class java.lang.Thread in our Soot scene. In that case, we only want to extend that class to provide the minimum functionality we need. Since we cannot make any assumptions on how a private field is named in the various implementations of the JDK (Oracle, OpenJDK, Android, etc.), we just take a name that’s still free and use that to implement the behavior we want.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d" lang="EN-US"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d" lang="EN-US">Best regards,<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d" lang="EN-US">  Steven <u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d" lang="EN-US"><u></u> <u></u></span></p><p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">Von:</span></b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;"> <a href="mailto:soot-list-bounces@CS.McGill.CA" target="_blank">soot-list-bounces@CS.McGill.CA</a> [mailto:<a href="mailto:soot-list-bounces@CS.McGill.CA" target="_blank">soot-list-bounces@CS.McGill.CA</a>] <b>Im Auftrag von </b>Denis Bogdanas<br><b>Gesendet:</b> Sonntag, 27. März 2016 23:58<br><b>An:</b> <a href="mailto:soot-list@cs.mcgill.ca" target="_blank">soot-list@cs.mcgill.ca</a>; Steven Arzt<br><b>Betreff:</b> [Soot-list] FlowDroid: patching of class Thread<u></u><u></u></span></p><div><div class="h5"><p class="MsoNormal"><u></u> <u></u></p><div><div><p class="MsoNormal" style="margin-bottom:12.0pt">Hi Steven,<u></u><u></u></p></div><p class="MsoNormal" style="margin-bottom:12.0pt">In LibraryCalssPatcher.patchThreadImplementation() you have the following code:<u></u><u></u></p><pre style="background:white"><span style="font-size:9.5pt;color:black">SootClass sc = Scene.<i>v</i>().getSootClassUnsafe(</span><b><span style="font-size:9.5pt;color:green">&quot;java.lang.Thread&quot;</span></b><span style="font-size:9.5pt;color:black">);<u></u><u></u></span></pre><p class="MsoNormal">...<u></u><u></u></p><pre style="background:white"><b><span style="font-size:9.5pt;color:navy">while </span></b><span style="font-size:9.5pt;color:black">((fldTarget = sc.getFieldByNameUnsafe(</span><b><span style="font-size:9.5pt;color:green">&quot;target&quot; </span></b><span style="font-size:9.5pt;color:black">+ fieldIdx)) != </span><b><span style="font-size:9.5pt;color:navy">null</span></b><span style="font-size:9.5pt;color:black">)<br>   fieldIdx++;<br>fldTarget = </span><b><span style="font-size:9.5pt;color:navy">new </span></b><span style="font-size:9.5pt;color:black">SootField(</span><b><span style="font-size:9.5pt;color:green">&quot;target&quot; </span></b><span style="font-size:9.5pt;color:black">+ fieldIdx, runnable.getType());<u></u><u></u></span></pre><div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal" style="margin-bottom:12.0pt">Here you create a field with name &quot;thread+&lt;some number&gt;&quot; inside Thread. Why don&#39;t you name it simply &quot;thread&quot;, as it is in JDK?<u></u><u></u></p></div><div><p class="MsoNormal">thanks,<u></u><u></u></p></div><div><p class="MsoNormal">-- <u></u><u></u></p><div><div><p class="MsoNormal" style="margin-bottom:12.0pt">Denis<u></u><u></u></p></div></div></div></div></div></div></div></div></div></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature"><div dir="ltr">Denis<br></div></div>
</div>