<HTML><HEAD>
<META content="text/html; charset=windows-1252" http-equiv=Content-Type></HEAD>
<BODY dir=ltr bgColor=#ffffff text=#000000>
<DIV dir=ltr>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: 'Calibri'; COLOR: #000000">
<DIV>Hi Johannes,</DIV>
<DIV> </DIV>
<DIV>I am currently working on a Java to C code translator and I would like to
try the process on the Java library, this would be a great way of testing my
translator. I tried this simple program:</DIV>
<DIV> </DIV>
<DIV>public class Test </DIV>
<DIV>{</DIV>
<DIV> public static void main(String[] args)</DIV>
<DIV> {</DIV>
<DIV> String newargs[] = {</DIV>
<DIV> "-whole-program",</DIV>
<DIV> "-include-all",</DIV>
<DIV>
"-p","cg","all-reachable:true",</DIV>
<DIV> "-cp","C:\\Program Files
(x86)\\Java\\jre1.8.0_31",</DIV>
<DIV> "-d", "c:\\Temp",</DIV>
<DIV> "-process-dir","C:\\Program
Files (x86)\\Java\\jre1.8.0_31\\lib\\jce.jar",</DIV>
<DIV> "-process-dir","C:\\Program
Files (x86)\\Java\\jre1.8.0_31\\lib\\jsse.jar",</DIV>
<DIV> "-process-dir","C:\\Program
Files (x86)\\Java\\jre1.8.0_31\\lib\\rt.jar"};</DIV>
<DIV> </DIV>
<DIV>
soot.Main.main(newargs); </DIV>
<DIV> }</DIV>
<DIV>}</DIV>
<DIV> </DIV>
<DIV>But I got this error:</DIV>
<DIV> </DIV>
<DIV>Transforming java.awt.SplashScreen$1... </DIV>
<DIV>Transforming java.awt.SystemColor... </DIV>
<DIV>soot.SootMethodRefImpl$ClassResolutionFailedException: Class
soot.dummy.InvokeDynamic doesn't have method updateSystemColors([]) :
sun.awt.AWTAccessor$SystemColorAccessor; failed to resolve in superclasses and
interfacesLooking in soot.dummy.InvokeDynamic which has methods []</DIV>
<DIV> </DIV>
<DIV> at
soot.SootMethodRefImpl.resolve(SootMethodRefImpl.java:164)</DIV>
<DIV> at
soot.SootMethodRefImpl.resolve(SootMethodRefImpl.java:109)</DIV>
<DIV> at
soot.jimple.internal.AbstractInvokeExpr.getMethod(AbstractInvokeExpr.java:67)</DIV>
<DIV> at
soot.jimple.validation.InvokeArgumentValidator.validate(InvokeArgumentValidator.java:34)</DIV>
<DIV> at
soot.jimple.JimpleBody.validate(JimpleBody.java:117)</DIV>
<DIV> at
soot.jimple.JimpleBody.validate(JimpleBody.java:102)</DIV>
<DIV> at soot.baf.BafBody.<init>(BafBody.java:63)</DIV>
<DIV> at soot.baf.Baf.newBody(Baf.java:560)</DIV>
<DIV> at
soot.PackManager.convertJimpleBodyToBaf(PackManager.java:976)</DIV>
<DIV> at
soot.PackManager.runBodyPacks(PackManager.java:932)</DIV>
<DIV> at
soot.PackManager.runBodyPacks(PackManager.java:608)</DIV>
<DIV> at
soot.PackManager.runBodyPacks(PackManager.java:507)</DIV>
<DIV> at
soot.PackManager.runPacksNormally(PackManager.java:484)</DIV>
<DIV> at soot.PackManager.runPacks(PackManager.java:391)</DIV>
<DIV> at soot.Main.run(Main.java:244)</DIV>
<DIV> at soot.Main.main(Main.java:152)</DIV>
<DIV> at Test.main(Test.java:27)</DIV>
<DIV
style='FONT-SIZE: small; TEXT-DECORATION: none; FONT-FAMILY: "Calibri"; FONT-WEIGHT: normal; COLOR: #000000; FONT-STYLE: normal; DISPLAY: inline'>
<DIV style="FONT: 10pt tahoma">
<DIV><FONT size=3 face=Calibri></FONT> </DIV>
<DIV><FONT size=3 face=Calibri>I looked into the rt.jar and the
sun.awt.AWTAccessor$SystemColorAccessor class file is present in the jar file,
so I am not sure what I did wrong. Do you have any ideas?</FONT></DIV>
<DIV><FONT size=3 face=Calibri></FONT> </DIV>
<DIV><FONT size=3 face=Calibri>Best regards,</FONT></DIV>
<DIV><FONT size=3 face=Calibri>Christian G</FONT></DIV>
<DIV><FONT size=3 face=Calibri></FONT> </DIV>
<DIV><FONT size=3 face=Calibri></FONT> </DIV>
<DIV><FONT size=3 face=Calibri></FONT> </DIV>
<DIV style="BACKGROUND: #f5f5f5">
<DIV style="font-color: black"><B>From:</B> <A
title=lerch@st.informatik.tu-darmstadt.de
href="mailto:lerch@st.informatik.tu-darmstadt.de">Johannes Lerch</A> </DIV>
<DIV><B>Sent:</B> Friday, April 10, 2015 10:17 AM</DIV>
<DIV><B>To:</B> <A title=eric.bodden@sit.fraunhofer.de
href="mailto:eric.bodden@sit.fraunhofer.de">Bodden, Eric</A> ; <A
title=christian.grosse@comhem.se
href="mailto:christian.grosse@comhem.se">christian.grosse@comhem.se</A> </DIV>
<DIV><B>Cc:</B> <A title=soot-list@CS.McGill.CA
href="mailto:soot-list@CS.McGill.CA">SOOT mailing list</A> </DIV>
<DIV><B>Subject:</B> Re: [Soot-list] Use SOOT to analyse Java
library.</DIV></DIV></DIV>
<DIV> </DIV></DIV>
<DIV
style='FONT-SIZE: small; TEXT-DECORATION: none; FONT-FAMILY: "Calibri"; FONT-WEIGHT: normal; COLOR: #000000; FONT-STYLE: normal; DISPLAY: inline'>Hi
Christian,<BR><BR>the options that will be of interest for you are the
following:<BR><BR>-cp and -process-dir to provide paths to the jar files of the
jre. You probably want to include all jars inside JAVA_HOME/lib/, but at the
very least the rt.jar file.<BR><BR>-include-all to remove the default filter for
java packages.<BR><BR>-whole-program to set it to a whole program analysis,
i.e., there is no main method.<BR><BR>-allow-phantom-refs is required if you
will not include all jars and even if, there might be some platform specific
classes missing.<BR><BR>-p cg all-reachable:true as Eric already
explained.<BR><BR>-p jb use-original-names:true to use the original local
variable names (if information is provided: analyze a jdk instead of a jre to
have debug information!)<BR><BR>More information about each option can be found
here: <A class=moz-txt-link-freetext
href="https://ssebuild.cased.de/nightly/soot/doc/soot_options.htm">https://ssebuild.cased.de/nightly/soot/doc/soot_options.htm</A><BR><BR>Regards,<BR>Johannes<BR><BR><BR>
<DIV class=moz-cite-prefix>Am 10.04.2015 um 07:44 schrieb Bodden,
Eric:<BR></DIV>
<BLOCKQUOTE cite=mid:90905F15-95CC-4139-9F45-777F40A284B1@sit.fraunhofer.de
type="cite"><PRE wrap="">Hi Christian.
</PRE>
<BLOCKQUOTE type="cite"><PRE wrap="">How do I get SOOT to load & parse (so I can get Jimple bodies) for say the entire java 1.x library.
Do I have to supply SOOT with the classes (or source code) as arguments in the call to Main.main(args) (see code below)?
Do I have to create a main class to get it to work? Or can SOOT analyze all classes I provide as arguments to Main.main(args) call without a main class & method?
</PRE></BLOCKQUOTE><PRE wrap="">This really depends on what you want to do. If you want to do intra-procedural analysis then it should be “just” a matter of giving Soot the right command line to parse all the classes faithfully. I have a PhD student who is currently analyzing the JDK for vulnerabilities and I have asked him to provide more info on which command line he uses.
If you want to do inter-procedural analysis then it’s more tricky. The problem is that you need a call graph and this, in turn, requires some entry points. You can use "-p cg all-reachable:true” to instruct Soot to consider _all_ methods as entry points during call-graph construction. If you combine this with using CHA then this should typically give you a call graph that is sound but may be very imprecise. We are currently working towards more precise analyses of libraries but it’s a hard problem to solve.
Best wishes,
Eric
</PRE><BR>
<FIELDSET class=mimeAttachmentHeader></FIELDSET> <BR><PRE wrap="">_______________________________________________
Soot-list mailing list
<A class=moz-txt-link-abbreviated href="mailto:Soot-list@CS.McGill.CA">Soot-list@CS.McGill.CA</A>
<A class=moz-txt-link-freetext href="https://mailman.CS.McGill.CA/mailman/listinfo/soot-list">https://mailman.CS.McGill.CA/mailman/listinfo/soot-list</A>
</PRE></BLOCKQUOTE><BR></DIV></DIV></DIV></BODY></HTML>