[Soot-list] can't find method when I use sootclass.getmethod
Steven Arzt
Steven.Arzt at cased.de
Mon Jun 2 06:24:48 EDT 2014
Hi Jin,
Please first check whether your class object getIdsClass is phantom (field isPhantom). If so, Soot was unable to find it on its classpath and has replaced it by a so-called phantom which is essentially an empty mockup. If this is the case, you need to check your Soot classpath. Otherwise, check the method list contained in the class object in the debugger to see whether your methods are there or not.
Best regards,
Steven
Von: soot-list-bounces at CS.McGill.CA [mailto:soot-list-bounces at CS.McGill.CA] Im Auftrag von Jin Li
Gesendet: Montag, 2. Juni 2014 12:19
An: soot-list at CS.McGill.CA
Betreff: [Soot-list] can't find method when I use sootclass.getmethod
Hi All,
I am a beginner of soot. I want to instrument the android apk. I read about the blog "http://www.bodden.de/2013/01/08/soot-android-instrumentation/ " . I want to print uid,pid,tid if the target of invocation is onDraw().
I wote a helper class:
import android.os.Process;
public class ThreadHelper {
private static int uid,pid,tid;
public static void getIDs(){
uid = Process.myUid();
pid = Process.myPid();
tid = Process.myTid();
}
public static int getUid(){
return uid;
}
public static int getPid(){
return pid;
}
public static int getTid(){
return tid;
}
public static void reportIds(){
System.out.println("uid is " + uid + "pid is " + pid + "tid is " + tid);
}
}
In the AndroidIntrument.java, I added some lines before iterate the patchchain.
" final SootClass getIdsClass;
final SootMethod getIds,getUid,getPid,getTid,reportIds;
getIdsClass = Scene.v().loadClassAndSupport("ThreadHelper");
getIds = getIdsClass.getMethod("void getIDs()");
getUid = getIdsClass.getMethod("int getUid()");
getPid = getIdsClass.getMethod("int getPid()");
getTid = getIdsClass.getMethod("int getTid()");
reportIds = getIdsClass.getMethod("void reportIds()");"
And then, when the target of the invocation is onDraw(), I insert some invocations.
InvokeExpr getExpr = Jimple.v().newStaticInvokeExpr(getIds.makeRef());
Stmt getStmt = (Stmt) Jimple.v().newInvokeStmt(getExpr);
units.insertBefore((Unit)getStmt, u);
However, When I run java -cp .;soot.jar AndroidInstrument -force-android-jar android.jar -process-dir my.apk
cast java.lang.RumtimeException: no method void getIDs() in class ThreadHelper.
I don't know the reason. I need your help!
thanks a lot!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20140602/51d000ef/attachment.html
More information about the Soot-list
mailing list