[Soot-list] can't find method when I use sootclass.getmethod
Jin Li
lijin1988 at gmail.com
Mon Jun 2 06:19:04 EDT 2014
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/b13b2142/attachment.html
More information about the Soot-list
mailing list