[Soot-list] Add Expression works strange.

Elena Sherman elenasherman at boisestate.edu
Thu Feb 5 19:22:10 EST 2015


Roman,

I'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):

Compiled from "Decomp.java"
public class decomp.Decomp {
  public decomp.Decomp();
    Code:
       0: aload_0
       1: invokespecial #1                  // Method
java/lang/Object."<init>":()V
       4: return
       5: iconst_0
       6: istore_0
       7: iinc_w        #0,  1              // #0

  public static void main(java.lang.String[]);
    Code:
       0: return
       1: iconst_0
       2: istore_0
       3: iinc_w        #0,  1              // #0
}

However, when I use Eclipse's bytecode viewer I get the following:

// Compiled from Decomp.java (version 1.2 : 46.0, super bit)
public class decomp.Decomp {
  // Method descriptor #12 ()V
  // Stack: 1, Locals: 1
  public Decomp();
     0  aload_0 [this]
     1  invokespecial java.lang.Object() [1]
     4  return
     5  wide
     6  iinc 0 500 [this]
      Line numbers:
        [pc: 0, line: 0]
        [pc: 1, line: 1]
        [pc: 4, line: 2]
        [pc: 5, line: 3]
      Attribute: LineNumberTable Length: 18
      Attribute: LineNumberTable Length: 18

  // Method descriptor #11 ([Ljava/lang/String;)V
  // Stack: 0, Locals: 1
  public static void main(java.lang.String[] arg0);
    0  return
    1  wide
    2  iinc 0 500 [arg0]
      Line numbers:
        [pc: 0, line: 0]
        [pc: 1, line: 1]
      Attribute: LineNumberTable Length: 10
      Attribute: LineNumberTable Length: 10
}

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'm not a bytecode specialist, so I cannot tell exactly how to interpret
iinc_w's arguments in terms of iinc.

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'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.

Hope it helps.

Elena

On Thu, Feb 5, 2015 at 11:38 AM, Roman Petriev <vvpiroman at gmail.com> wrote:

> Test cases here
> <https://dl.dropboxusercontent.com/u/67534750/TestCases.rar>.
> Is it good? Do you need anything else?
>
> 2015-02-05 12:58 GMT+03:00 Bodden, Eric <eric.bodden at sit.fraunhofer.de>:
>
>> Hi Roman.
>>
>> > I hope that is (exactly) what you want to see.
>>
>> 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.
>>
>> Thanks,
>> Eric
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20150205/eb8bdff8/attachment.html 


More information about the Soot-list mailing list