[Soot-list] [Negative Stack height ?]

lpxz lpxz at ust.hk
Tue Sep 15 00:08:41 EDT 2009


Dear Len Bottaci:
     Thank you for your sharing.
     And I find it is because that I did not copy Traps to my new method.
     after I copy those traps into the new method, it can generate the 
class file smoothly.
     I find it a good way to look into the jimple code generated by "-f 
J", it is more human-readable,
and what is more important, it contains the complete information what 
you need to debug.very possibly you would find your issue during looking 
into the jimple code.
     Regards
Peng
     
>
> Message: 1
> Date: Mon, 14 Sep 2009 18:24:24 +0100
> From: "Leonardo Bottaci" <L.Bottaci at hull.ac.uk>
> Subject: Re: [Soot-list] [Negative Stack height ?]
> To: <soot-list at sable.mcgill.ca>
> Message-ID:
> 	<C6B4B8A76D452B4D823A73ABD204CE7AC13445 at EXCL1VS2.adir.hull.ac.uk>
> Content-Type: text/plain; charset="us-ascii"
>
> I'm a newcomer to Soot.  I have had a Negative Stack height error from
> jimple code that have I modified.  My modification was to insert a
> jimple statement (a method call to a method that returns void).  The
> subsequent existing jimple statements, when translated to byte code,
> contained a pop instruction that I did not think was required.  I did
> not investigate the problem in detail but as a work around I changed my
> method to return zero and therefore provide an argument for the pop
> instruction.
>
>  
>
> Len Bottaci
>
>  
>
> -----Original Message-----
> From: soot-list-bounces at sable.mcgill.ca
> [mailto:soot-list-bounces at sable.mcgill.ca] On Behalf Of lpxz
> Sent: 14 September 2009 16:56
> To: soot-list at sable.mcgill.ca
> Subject: [Soot-list] [Negative Stack height ?]
>
>  
>
> Hello:
>
>  
>
> Can you help me with the transforming problems. I want to make a new 
>
> method called getValue_TX(), but as it is a little complex to write, I 
>
> would like to reuse other jimple statement with minor modification, for 
>
> example, I
>
> read every statement of getXXX_TX using  Iterator
> iterator=units.iterator().
>
>  for those identity statment, I provide new version manually.
>
>  for those variables used in getXXX_TX, I set a new Type for that Value.
>
>  for those variables defined, I add them to my new method's local set.
>
>  
>
> If I do this using "-f J", it can pass the jimple validate part, and it 
>
> did not report "local not declared". but if I use "-f c", it would 
>
> report exception like this:
>
>  
>
>  
>
> *Exception in thread "main" java.lang.RuntimeException:* Negative Stack 
>
> height has been attained in :<dstm2.benchmark.aj.INode: int
> getValue_TX()>
>
> StackHeight: -1
>
> At instruction:athrow
>
> Block:
>
> Block 1:
>
> [preds: ] [succs: ]
>
> load.r this;
>
> exitmonitor;
>
> athrow;
>
>  
>
>  
>
> Method: getValue_TX
>
> <dstm2.benchmark.aj.INode: int getValue_TX()>
>
>     at soot.baf.JasminClass.calculateStackHeight(JasminClass.java:1819)
>
>     at soot.baf.JasminClass.emitMethodBody(JasminClass.java:274)
>
>     at soot.AbstractJasminClass.emitMethod(AbstractJasminClass.java:689)
>
>     at soot.AbstractJasminClass.<init>(AbstractJasminClass.java:568)
>
>     at soot.baf.JasminClass.<init>(JasminClass.java:44)
>
>     at soot.PackManager.writeClass(PackManager.java:877)
>
>     at soot.PackManager.writeOutput(PackManager.java:467)
>
>     at soot.PackManager.writeOutput(PackManager.java:394)
>
>     at aBunchOfTestForBodyPhase.ATTAnalysis.main(ATTAnalysis.java:48)
>
>  
>
> *and the corresponding jimple code when I use "-f c" is  there were an 
>
> email in the mailing list asking about "athrow" probelm, and it was said
>
>
> using sun jvm can avoid the problem, but I did not get the problem 
>
> avoided even under sun jvm. and I do not know too much about the 
>
> instructions here, So can anybody shed some light for me please:*
>
>  
>
>   public int getValue_TX()
>
>     {
>
>         word this, j;
>
>  
>
>         this := @this: dstm2.benchmark.aj.INode;
>
>  
>
>      label0:
>
>         push 0;
>
>  
>
>      label1:
>
>         load.r this;
>
>  
>
>      label2:
>
>         dup1.r;
>
>  
>
>      label3:
>
>         store.r this;
>
>  
>
>      label4:
>
>         entermonitor;
>
>  
>
>      label5:
>
>         push 1;
>
>  
>
>      label6:
>
>         add.b;
>
>  
>
>      label7:
>
>         store.i j;
>
>  
>
>      label8:
>
>         load.r this;
>
>  
>
>      label9:
>
>         exitmonitor;
>
>  
>
>      label10:
>
>         goto label14;
>
>  
>
>      label11:
>
>         load.r this;
>
>  
>
>      label12:
>
>         exitmonitor;
>
>  
>
>      label13:
>
>         athrow;
>
>  
>
>      label14:
>
>         load.i j;
>
>  
>
>      label15:
>
>         return.i;
>
>     }
>
>  
>
> *I tried to read the jimple generated using "-f J" myself, and I find I 
>
> did not succeed to capture
>
> "catch java.lang.Throwable from label0 to label1 with label2;
>
>  catch java.lang.Throwable from label3 to label4 with label2;"
>
> Is this the problem ?
>
> and how can I capture those two statements ,as they are not in the 
>
> units.iterate.
>
>  
>
> *
>
>  
>
> public int getXXX_TX()
>
>     {
>
>         aolib.adstm.ExampleITX this, l2, $r0;
>
>         byte j;
>
>         int j#2;
>
>         java.lang.Throwable $r1;
>
>  
>
>         this := @this: aolib.adstm.ExampleITX;
>
>         j = 0;
>
>         $r0 = this;
>
>         l2 = $r0;
>
>         entermonitor $r0;
>
>  
>
>      label0:
>
>         j#2 = j + 1;
>
>         exitmonitor l2;
>
>  
>
>      label1:
>
>         goto label5;
>
>  
>
>      label2:
>
>         $r1 := @caughtexception;
>
>  
>
>      label3:
>
>         exitmonitor l2;
>
>  
>
>      label4:
>
>         throw $r1;
>
>  
>
>      label5:
>
>         return j#2;
>
>  
>
>         catch java.lang.Throwable from label0 to label1 with label2;
>
>         catch java.lang.Throwable from label3 to label4 with label2;
>
>     }
>
>  
>
>  
>
>     public int getValue_TX()
>
>     {
>
>         dstm2.benchmark.aj.INode this, $r0, l2;
>
>         byte j;
>
>         int j#2;
>
>         java.lang.Throwable $r1;
>
>  
>
>         this := @this: dstm2.benchmark.aj.INode;
>
>         j = 0;
>
>         $r0 = this;
>
>         l2 = $r0;
>
>         entermonitor $r0;
>
>         j#2 = j + 1;
>
>         exitmonitor l2;
>
>         goto label0;
>
>  
>
>         $r1 := @caughtexception;
>
>         exitmonitor l2;
>
>         throw $r1;
>
>  
>
>      label0:
>
>         return j#2;
>
>     }
>
>  
>
> Thank you for your help !
>
>  
>
> Regards
>
> Peng
>
> _______________________________________________
>
> Soot-list mailing list
>
> Soot-list at sable.mcgill.ca
>
> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>
>  
>
>   



More information about the Soot-list mailing list