[Soot-list] Using Soot to Instrument a class file

Chixiang Zhou alexanderchouus at hotmail.com
Fri Jun 19 15:59:15 EDT 2009


Dear all,

 

I'm Chixiang Zhou, a Ph.D. student in computer science, NYU. 

I'm learning Soot these days and trying to instrument a class file. I found a tutorial called Using Soot to Instrument a class file is quite related to my goal.

However, I encountered a problem when I wrote a similar instrumenter in Java.

The example mentioned in the tutorial is to insert a function call void increase(int) before some statement. In fact, my goal is the same, only differing in the function call.
The function (e.g. add(java.lang.String, int, java.sql.Connection)) I want to insert has 3 parameters. I looked up the Soot API documentation, which gives an API called newStaticInvokeExpr(SootMethodRef method, List args). Therefore, I wrapped the 3 parameters into a List, and passed the List to API newStaticInvokeExpr(

SootMethodRef method, List args). The insturmenter successfully inserted the function call add() in the application's bytecode ( I checked the Jimple code). 

The problem occurs when I run the instrumented application's bytecode. An error shows up: Exception in thread "main" java.lang.IncompatibleClassChangeError

I checked the Jimple code again and found something weird. The following is the Jimple code fragment:
r70 = <java.util.List>r0;
staticinvoke <testing.Sum: void add(java.util.List)>(r70);

r0 is the java.sql.Connection, which is the third parameter. It seems that r70 only has the third parameter java.sql.Connection r0 while ignoring the first two parameters.


Could anyone tell me what might be the cause of that error if I want to use a List paramter?
 
BTW, attached is the tutorial. 


Sincerely yours, 
Chixiang Zhou (Alexander)




_________________________________________________________________
Microsoft brings you a new way to search the web.  Try  Bing™ now
http://www.bing.com?form=MFEHPG&publ=WLHMTAG&crea=TEXT_MFEHPG_Core_tagline_try bing_1x1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20090619/37b65afe/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: profiler2.pdf
Type: application/pdf
Size: 55205 bytes
Desc: not available
Url : http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20090619/37b65afe/attachment-0001.pdf 


More information about the Soot-list mailing list