[Soot-list] What is the difference between getMethod() and getMethodRef()?

Phil Pratt-Szeliga pcpratts at trifort.org
Fri Jan 25 17:14:37 EST 2013


Hi Marc-Andre,

getMethod loads more dependencies. If your classloading isn't perfect,
eventually something will try to load a SootClass that isn't found in
the Scene. When that happens the Scene makes an empty SootClass and
returns it. Then later you have code that tries to reference a field
from that empty class and something like this happens.

getMethodRef doesn't load as much and I think it is meant for working
with things when classes aren't completely loaded. You can still have
access to the name, types and string based signature.

I have a new class loader in a private github repo where I can get
around a lot of these issues. It only loads types that are depth first
search reachable from entry points and then backwards reachable from
entry points. Right now it is working with 39/41 rootbeer high level
test cases passing. The RootbeerClassLoader bases things on strings
more and then has classes that can manipulate method and field
signatures.

Sincerely,
Phil Pratt-Szeliga
Syracuse University
http://trifort.org/

On Fri, Jan 25, 2013 at 5:03 PM, Marc-Andre Laverdiere-Papineau
<marc-andre.laverdiere-papineau at polymtl.ca> wrote:
> Hello,
>
> I have been plagued with weird exceptions like this:
>
> Exception in thread "main"
> soot.SootMethodRefImpl$ClassResolutionFailedException: Class
> javax.servlet.ServletContext doesn't have method getContextPath([]) :
> java.lang.String; failed to resolve in superclasses and
> interfacesLooking in javax.servlet.ServletContext which has methods
> [<javax.servlet.ServletContext: javax.servlet.ServletContext
> getContext(java.lang.String)>, <javax.servlet.ServletContext: int
> ...<javax.servlet.ServletContext: javax.servlet.Servlet
> getServlet(java.lang.String)>, <javax.servlet.ServletContext:
> java.util.Enumeration getServlets()>, <javax.servlet.ServletContext:
> java.util.Enumeration getServletNames()>,
> ...
> <javax.servlet.ServletContext: void
> log(java.lang.String,java.lang.Throwable)>,
> <javax.servlet.ServletContext: java.lang.String
> getRealPath(java.lang.String)>, <javax.servlet.ServletContext:
> java.lang.String getServerInfo()>, <javax.servlet.ServletContext:
> ...<java.lang.Object: void wait()>, <java.lang.Object: void finalize()>,
> <java.lang.Object: void <clinit>()>]
>
>         at soot.SootMethodRefImpl.resolve(SootMethodRefImpl.java:179)
>         at soot.SootMethodRefImpl.resolve(SootMethodRefImpl.java:105)
>         at
> soot.jimple.internal.AbstractInvokeExpr.getMethod(AbstractInvokeExpr.java:54)
>         at ...
>
> It happens if I have something like this:
> ((DefinitionStmt)u).getInvokeExpr().getMethod()...
>
> However, changing it to getMethodRef() won't break - why??? (Sidenote: I
> am running without exclusions)
>
> Regards,
>
> --
> Marc-André Laverdière-Papineau
> Doctorant - PhD Candidate
> _______________________________________________
> 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