<div dir="ltr">Thanks you, Elena. I think, that I can use different disassemblers for checking, e.g. Eclipse Bytecode Viewer. <div>I make obfuscations, <span style="color:rgb(0,0,0);font-size:13px;white-space:nowrap">therefore </span>I can add instructions after return sometimes.<br><div><br><div class="gmail_extra"><br><div class="gmail_quote">2015-02-06 21:51 GMT+03:00 Elena Sherman <span dir="ltr">&lt;<a href="mailto:elenasherman@boisestate.edu" target="_blank">elenasherman@boisestate.edu</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Eric, yes, it works correctly. I&#39;ve added the print statement in Roman&#39;s code and it does prints out 500. So, I don&#39;t know if it should be reported or not. <div>When I was looking for the format of iinc_w I found the following</div><div>iinc_w index byte1 byte2</div><div>where the value to be incremented is calculated as byte1 &lt;&lt; 8 | byte2</div><div>When I&#39;ve changed the value to increment from 500 to  512 and  javap changed the bytecode from &quot;<span style="color:rgb(80,0,80);font-size:12.8000001907349px">iinc_w        #0,  1&quot; </span>to &quot;<font color="#500050"><span style="font-size:12.8000001907349px">iinc_w        #0,  2&quot;, so apparently javap shows only byte1 part since 1&lt;&lt;8 = 256 and 2&lt;&lt;8 is 512 but fails to show byte 2, which should be 244 for 500 and 0 for 512.</span></font></div><div><div><br><div>Roman, when you instrument the code make sure to add your instrumentation before return statement, for example by using units.insertBefore(....) or units.insertAfter(...) methods.</div></div><div><br></div></div></div><div class=""><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Feb 6, 2015 at 5:37 AM, Eric Bodden <span dir="ltr">&lt;<a href="mailto:eric.bodden@sit.fraunhofer.de" target="_blank">eric.bodden@sit.fraunhofer.de</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span>Thanks a lot for the input Elena!<br>
<br>
</span>Wow, that&#39;s odd! I have never seen javap give such apparently false/misleading information. Is this something we should report to Oracle?<br>
<span><br>
Anyway, I would assume that the bytecode is actually correct?<br>
<br>
Cheers,<br>
Eric<br>
<br>
<br>
</span><div><div>&gt; On 06.02.2015, at 01:22, Elena Sherman &lt;<a href="mailto:elenasherman@boisestate.edu" target="_blank">elenasherman@boisestate.edu</a>&gt; wrote:<br>
&gt;<br>
&gt; Roman,<br>
&gt;<br>
&gt; I&#39;ve run your code with the initialization of the local variable part added to it. It looks like that depending on the bytecode viewer I get different bytecode. When I use javap -c Decomp.class I get the following (what you get):<br>
&gt;<br>
&gt; Compiled from &quot;Decomp.java&quot;<br>
&gt; public class decomp.Decomp {<br>
&gt;   public decomp.Decomp();<br>
&gt;     Code:<br>
&gt;        0: aload_0<br>
&gt;        1: invokespecial #1                  // Method java/lang/Object.&quot;&lt;init&gt;&quot;:()V<br>
&gt;        4: return<br>
&gt;        5: iconst_0<br>
&gt;        6: istore_0<br>
&gt;        7: iinc_w        #0,  1              // #0<br>
&gt;<br>
&gt;   public static void main(java.lang.String[]);<br>
&gt;     Code:<br>
&gt;        0: return<br>
&gt;        1: iconst_0<br>
&gt;        2: istore_0<br>
&gt;        3: iinc_w        #0,  1              // #0<br>
&gt; }<br>
&gt;<br>
&gt; However, when I use Eclipse&#39;s bytecode viewer I get the following:<br>
&gt;<br>
&gt; // Compiled from Decomp.java (version 1.2 : 46.0, super bit)<br>
&gt; public class decomp.Decomp {<br>
&gt;   // Method descriptor #12 ()V<br>
&gt;   // Stack: 1, Locals: 1<br>
&gt;   public Decomp();<br>
&gt;      0  aload_0 [this]<br>
&gt;      1  invokespecial java.lang.Object() [1]<br>
&gt;      4  return<br>
&gt;      5  wide<br>
&gt;      6  iinc 0 500 [this]<br>
&gt;       Line numbers:<br>
&gt;         [pc: 0, line: 0]<br>
&gt;         [pc: 1, line: 1]<br>
&gt;         [pc: 4, line: 2]<br>
&gt;         [pc: 5, line: 3]<br>
&gt;       Attribute: LineNumberTable Length: 18<br>
&gt;       Attribute: LineNumberTable Length: 18<br>
&gt;<br>
&gt;   // Method descriptor #11 ([Ljava/lang/String;)V<br>
&gt;   // Stack: 0, Locals: 1<br>
&gt;   public static void main(java.lang.String[] arg0);<br>
&gt;     0  return<br>
&gt;     1  wide<br>
&gt;     2  iinc 0 500 [arg0]<br>
&gt;       Line numbers:<br>
&gt;         [pc: 0, line: 0]<br>
&gt;         [pc: 1, line: 1]<br>
&gt;       Attribute: LineNumberTable Length: 10<br>
&gt;       Attribute: LineNumberTable Length: 10<br>
&gt; }<br>
&gt;<br>
&gt; Which is correct. So, apparently the wide incremental instruction, i.e., iinc_w should be interpreted a bit different than its regular version iinc. I&#39;m not a bytecode specialist, so I cannot tell exactly how to interpret iinc_w&#39;s arguments in terms of iinc.<br>
&gt;<br>
&gt; In general bytecode can be quite confusing, so in order to check whether your instrumentation works as expected try to print something out like the value of the local variable you&#39;re trying to increment. Thus when you execute the instrumented code you will know for sure if this is what you want or not, or there are any errors in the instrumentation.<br>
&gt;<br>
&gt; Hope it helps.<br>
&gt;<br>
&gt; Elena<br>
&gt;<br>
&gt; On Thu, Feb 5, 2015 at 11:38 AM, Roman Petriev &lt;<a href="mailto:vvpiroman@gmail.com" target="_blank">vvpiroman@gmail.com</a>&gt; wrote:<br>
&gt; Test cases here.<br>
&gt; Is it good? Do you need anything else?<br>
&gt;<br>
&gt; 2015-02-05 12:58 GMT+03:00 Bodden, Eric &lt;<a href="mailto:eric.bodden@sit.fraunhofer.de" target="_blank">eric.bodden@sit.fraunhofer.de</a>&gt;:<br>
&gt; Hi Roman.<br>
&gt;<br>
&gt; &gt; I hope that is (exactly) what you want to see.<br>
&gt;<br>
&gt; Ideal would be a minimal but runnable example, including your driver class for Soot and the command-line options you are using. We should be able to reproduce this with as little effort as possible.<br>
&gt;<br>
&gt; Thanks,<br>
&gt; Eric<br>
&gt;<br>
&gt;<br>
<br>
</div></div><div><div>--<br>
Prof. Eric Bodden, Ph.D., <a href="http://sse.ec-spride.de/" target="_blank">http://sse.ec-spride.de/</a> <a href="http://bodden.de/" target="_blank">http://bodden.de/</a><br>
Head of Secure Software Engineering at Fraunhofer SIT, TU Darmstadt and EC SPRIDE<br>
Tel: <a href="tel:%2B49%206151%2016-75422" value="+4961511675422" target="_blank">+49 6151 16-75422</a>    Fax: <a href="tel:%2B49%206151%20869-127" value="+496151869127" target="_blank">+49 6151 869-127</a><br>
Room B5.11, Fraunhofer SIT, Rheinstraße 75, 64295 Darmstadt<br>
<br>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div></div></div></div>