[Soot-list] Dava fails to decompile

Eric Bodden eric.bodden at mail.mcgill.ca
Tue Feb 27 16:01:59 EST 2007


Hi, David.

Yes, as Michael already said, decompiling synchronized blocks is very
nontrivial, in particular if strange bytecode patterns are involved.
Having said that, Diana here is currently working on exactly this
issue as a course project. So things might improve soon. Thanks for
the code example. I think it will be a good test case. What compiler
did you compile the class with?

Eric

On 2/27/07, David A Weiser <DWEISER at uwyo.edu> wrote:
>
> I'm getting this error message: Exception in thread "main" java.lang.RuntimeException: Could not verify approximated Synchronized body
>         at soot.dava.toolkits.base.finders.SynchronizedBlockFinder.find(SynchronizedBlockFinder.java:163)
>         at soot.dava.DavaBody.<init>(DavaBody.java:307)
>         at soot.dava.Dava.newBody(Dava.java:84)
>         at soot.PackManager.runBodyPacks(PackManager.java:718)
>         at soot.PackManager.runBodyPacks(PackManager.java:396)
>         at soot.PackManager.runBodyPacks(PackManager.java:340)
>         at soot.PackManager.runPacks(PackManager.java:335)
>         at soot.Main.run(Main.java:203)
>         at soot.Main.main(Main.java:146)
>
> when I try to run this code:
>
> /*
>  * Copyright (C) 2000 by ETHZ/INF/CS
>  * All rights reserved
>  *
>  * @version $Id$
>  * @author Roger Karrer
>  */
>
> import java.lang.*;
> import java.util.*;
> import java.io.*;
>
> // class of the shared control object
> class Controls {
>     private Floor[] floors;
>
>     public Controls(int numFloors) {
>         floors = new Floor[numFloors+1];
>         for(int i = 0; i <= numFloors; i++) floors[i] = new Floor();
>     }
>
>     // this is called to inform the control object of a down call on floor
>     // onFloor
>     public void pushDown(int onFloor, int toFloor) {
>         synchronized(floors[onFloor]) {
>             System.out.println("*** Someone on floor " + onFloor +
>                                " wants to go to " + toFloor);
>             floors[onFloor].downPeople.addElement(new Integer(toFloor));
>             if(floors[onFloor].downPeople.size() == 1)
>                floors[onFloor].downFlag = false;
>         }
>     }
>
>     // this is called to inform the control object of an up call on floor
>     // onFloor
>     public void pushUp(int onFloor, int toFloor) {
>         synchronized(floors[onFloor]) {
>             System.out.println("*** Someone on floor " + onFloor +
>                                " wants to go to " + toFloor);
>             floors[onFloor].upPeople.addElement(new Integer(toFloor));
>             if(floors[onFloor].upPeople.size() == 1)
>                floors[onFloor].upFlag = false;
>         }
>     }
>
>     // An elevator calls this if it wants to claim an up call
>     // Sets the floor's upFlag to true if he has not already been set to true
>     // Returns true if the elevator has successfully claimed the call, and
>     // False if the call was already claimed (upFlag was already true)
>     public boolean claimUp(String lift, int floor) {
>         if(checkUp(floor)) {
>             synchronized(floors[floor]) {
>                 if(!floors[floor].upFlag) {
>                    floors[floor].upFlag = true;
>                    return true;
>                 }
>             }
>         }
>         return false;
>     }
>
>     // An elevator calls this if it wants to claim an down call
>     // Sets the floor's downFlag to true if he has not already been set to true
>     // Returns true if the elevator has successfully claimed the call, and
>     // False if the call was already claimed (downFlag was already true)
>     public boolean claimDown(String lift, int floor) {
>         if(checkDown(floor)) {
>             synchronized(floors[floor]) {
>                 if(!floors[floor].downFlag) {
>                     floors[floor].downFlag = true;
>                     return true;
>                 }
>             }
>         }
>         return false;
>     }
>
>     // An elevator calls this to see if an up call has occured on the given
>     // floor.  If another elevator has already claimed the up call on the
>     // floor, checkUp() will return false.  This prevents an elevator from
>     // wasting its time trying to claim a call that has already been claimed
>     public boolean checkUp(int floor) {
>         synchronized(floors[floor]) {
>             boolean ret = floors[floor].upPeople.size() != 0;
>             ret = ret && !floors[floor].upFlag;
>             return ret;
>         }
>     }
>
>     // An elevator calls this to see if a down call has occured on the given
>     // floor.  If another elevator has already claimed the down call on the
>     // floor, checkUp() will return false.  This prevents an elevator from
>     // wasting its time trying to claim a call that has already been claimed
>     public boolean checkDown(int floor) {
>         synchronized(floors[floor]) {
>             boolean ret = floors[floor].downPeople.size() != 0;
>             ret = ret && !floors[floor].downFlag;
>             return ret;
>         }
>     }
>
>     // An elevator calls this to get the people waiting to go up.  The
>     // returned Vector contains Integer objects that represent the floors
>     // to which the people wish to travel.  The floors vector and upFlag
>     // are reset.
>     public Vector getUpPeople(int floor) {
>         synchronized(floors[floor]) {
>             Vector temp = floors[floor].upPeople;
>             floors[floor].upPeople = new Vector();
>             floors[floor].upFlag = false;
>             return temp;
>         }
>     }
>
>     // An elevator calls this to get the people waiting to go down.  The
>     // returned Vector contains Integer objects that represent the floors
>     // to which the people wish to travel.  The floors vector and downFlag
>     // are reset.
>     public Vector getDownPeople(int floor) {
>         synchronized(floors[floor]) {
>             Vector temp = floors[floor].downPeople;
>             floors[floor].downPeople = new Vector();
>             floors[floor].downFlag = false;
>             return temp;
>         }
>     }
> }
>
> __________________________
>
> I'm running SOOT 2.2.3. I can decompile other code like:
> public void put(int value, int t, boolean s,boolean j) {
>                 int i;
>                 i = 0;
>
>                 while (!available) {
>                         try {
>                                 wait();
>                         } catch (InterruptedException e) {
>                                 notify();
>                         }
>                 }
>                 while ((available|s)&(s&j)) {
>                         contents++;
>                         try {
>                                 notify();
>                         } catch (InterruptedException e) {
>                                 notify();
>                         }
>                 }
>                 synchronized (this) {
>                         contents = value;
>                         value = t+3;
>                         t=3;
>                         available = true;
>                         notify();
>                 }
>         }
>
> With no problems.
>
> Am I missing a setting?
>
> Thanks,
> Dave
>
>
> -----Original Message-----
> From: soot-list-request at sable.mcgill.ca [mailto:soot-list-request at sable.mcgill.ca]
> Sent: Thursday, February 22, 2007 10:00 AM
> To: soot-list at sable.mcgill.ca
> Subject: Soot-list Digest, Vol 22, Issue 21
>
> Send Soot-list mailing list submissions to
>         soot-list at sable.mcgill.ca
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
> or, via email, send a message with subject or body 'help' to
>         soot-list-request at sable.mcgill.ca
>
> You can reach the person managing the list at
>         soot-list-owner at sable.mcgill.ca
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Soot-list digest..."
>
>
> Today's Topics:
>
>    1. LAST CALL - Soot goes Java 5 (Eric Bodden)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Thu, 22 Feb 2007 10:18:25 -0500
> From: "Eric Bodden" <eric.bodden at mail.mcgill.ca>
> Subject: [Soot-list] LAST CALL - Soot goes Java 5
> To: "Soot list" <soot-list at sable.mcgill.ca>
> Message-ID:
>         <804e3c660702220718l330c30acqe68545f26af0de92 at mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> Hi all.
>
> This is a last call to our users to raise any doubts about Soot moving
> to a Java 5 code base. If I don't hear any "no go" from anybody by end
> of next week, we will switch our build scripts to a source (and hence
> also target) level of 1.5.
>
> We *do* however intend to at least branch off a 1.4-based version for
> maintenance purposes and probably we are even going to do another
> release before the conversion.
>
> Cheers,
> Eric
>
> --
> Eric Bodden
> Sable Research Group
> McGill University, Montréal, Canada
>
>
> ------------------------------
>
> _______________________________________________
> Soot-list mailing list
> Soot-list at sable.mcgill.ca
> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>
>
> End of Soot-list Digest, Vol 22, Issue 21
> *****************************************
> _______________________________________________
> Soot-list mailing list
> Soot-list at sable.mcgill.ca
> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>


-- 
Eric Bodden
Sable Research Group
McGill University, Montréal, Canada


More information about the Soot-list mailing list