[Soot-list] Subject: [PATCH] added resetSingletons

Phil Pratt-Szeliga pcpratts at syr.edu
Sat Jun 11 13:47:13 EDT 2011


This patch allows a developer to run Soot twice in one Java application.  If there is an existing way to do this, please let me know.  I use it to generate both .shimple and .class (the shimple is always useful for debugging)

-Phil Pratt-Szeliga


diff -r c8d3c1984b91 -r 557b6b1f9f60 src/make_singletons
--- a/src/make_singletons    Sat Jun 11 13:38:08 2011 -0400
+++ b/src/make_singletons    Sat Jun 11 13:42:33 2011 -0400
@@ -44,5 +44,13 @@
     echo
 done

+echo "    public void resetSingletons(){"
+for class in `cat singletons.list`; do
+    undottedClass="`echo $class | tr . _`"
+    instanceName="instance_$undottedClass"
+    echo "        $instanceName = null;";
+done
+echo "    }"
+
 echo }

diff -r c8d3c1984b91 -r 557b6b1f9f60 src/soot/Main.java
--- a/src/soot/Main.java    Sat Jun 11 13:38:08 2011 -0400
+++ b/src/soot/Main.java    Sat Jun 11 13:42:33 2011 -0400
@@ -132,6 +132,10 @@
         }
     }

+    public static void resetSingletons(){
+        G.v().resetSingletons();
+    }
+
     public String[] cmdLineArgs = new String[0];
     /**
      *   Entry point for cmd line invocation of soot.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20110611/41eb88eb/attachment.html 


More information about the Soot-list mailing list