<div dir="ltr"><div><div><div><div><div>Hi,<br><br></div>I want to analyze a program which does not have <i>single</i> entry point (i.e. it is a library). The code base, instead, does have a set of test cases.<br><br></div>I built a program using ASM to construct a "mock" main function from those test cases. My program produced statements like the following:<br><br>org.apache.commons.math4.exception.NumberIsTooSmallExceptionTest obj0 = null;<br>obj0.testAccessors();<br><br></div>I thought that as long as the type of obj0 is known, Soot won't have any problem for doing CHA (and doing the rest of whole-program analyses). Unfortunately, I noticed that Soot does some unwanted optimization! I found the following in the .jimple file produced by Soot for my mock main (all other calls to client code were removed!):<br><br>r8 = new java.lang.NullPointerException;<br>specialinvoke r8.<java.lang.NullPointerException: void <init>(java.lang.String)>("This statement would have triggered an Exception: virtualinvoke obj0.<org.apache.commons.math4.exception.NumberIsTooSmallExceptionTest: void testAccessors()>()");<br>throw r8;<br><br></div>It is very intelligent that Soot can detect that, but (for now) I don't want such transformations!<br><br></div><div>I would appreciate if you answer the my questions:<br><br>1. Is that possible to instruct Soot to analyze the library based on the 
test cases? I mean without the need for any mock main method to be 
constructed?<br></div><div><br>2. Does anyone know how can I avoid this unwanted transformation? Who does that transformation Java compiler or Soot?<br><br><br></div><div>Thank you so much<br></div></div>