[Soot-list] How can I get the body of if statement from jimple format code

Quentin Sabah quentin.sabah at inria.fr
Mon May 21 10:27:13 EDT 2012


(I forgot to respond to the Soot-list previously)

----- yangpeng3314 <yangpeng3314 at 163.com> a écrit :
> Hi Quentin Sabah,
> 
> Thanks for your reply. I found a way to get this information, but I am not sure if this way is correct.
> 
> First, construct a  BriefBlockGraph  object using the body of a SootMethod object. Then, we can get the body of the if statement from the divided blocks. 

This may be correct for very simple pieces of Java code.

Now if you look at the next exemple:

 if(e0) { 
   e1; 
   if(e2) { 
     e3; 
   } else { 
     e4; 
   } 
 }
 e5

You will probably obtain a CFG like this:

 B0:[e0, goto B4]
 B1:[e1, e2, goto B3]
 B2:[e3,goto B4]
 B3:[e4]
 B4:[e5] 

If you are tracking the body of the first 'if' statement, you want your result to be {B1,B2,B3}. Given the CFG only, it seems very hard or impossible to work-out this result (on what grounds would the analysis exclude B4 but keep B3 ?). 

-- 
Quentin Sabah, co-funded Ph.D. student
Grenoble University
INRIA-SARDES                   | STMicroelectronics/AST
Montbonnot, France             | Grenoble, France
mailto:quentin.sabah at inria.fr  | mailto:quentin.sabah at st.com
phone: +33 476 61 52 42        | phone: +33 476 58 44 14


More information about the Soot-list mailing list