[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Soot API: VerifyError when using Chain.insertBefore() methods



Hello Feng,

Your alternative method of constructing the method parameter list
 has fixed the problem I was having.

 Thanks a lot. I really appreciate your help with this.

Nathan 

On Mon, 10 Sep 2001 17:07:16 -0400 (EDT) Feng QIAN
<fqian@sable.mcgill.ca> writes:
> 
> Hi, I was confused by the code constructing params. Are you 
> modifying the
> method signature or just printing out the parameters?
> 
> If you only need to print out method parameters, you can use
> JimpleBody.getParameterLocal(int i) to get the corresponding Local 
> object
> instead of creating a new local in your code.
> 
>    for (int j=0; j<xParameterNames; j++) {
> 	params.add(activeBody.getParameterLocal(j));
>    }
> 
> > > How do you construct the params list?
> >
> >
> >                     // creating local vars array
> >                     Local [] argv = new 
> Local[xParameterNames.length];
> 
>   WHERE DID YOU GET xParameterNames?
> 
> >
> >                     int j = 0;
> >                     // iterate through each method parameter
> >                     for (;j < xParameterNames.length; j++) {
> >                         Type sootType = 
> getSootType(xParameterTypes[j]);
> >
> >                         // Declare new local that will reference a 
> method
> > param
> >                         argv[j] = 
> Jimple.v().newLocal(xParameterNames[j],
> > sootType);
> >
> >                          // Add it to locals list
> >                          locals.add(argv[j]);
> >                         // Make the new local reference a method 
> param
> >                         Unit currentUnit =
> > Jimple.v().newIdentityStmt(argv[j], 
> Jimple.v().newParameterRef(sootType,
> > j));
> >
> >                        // Insert param reference into chain
> >                        units.insertAfter(currentUnit, 
> prevUnits[j]);
> >
> >                         // Update reference array
> >                         prevUnits[j+1] = currentUnit;
> >
> >                         // Add to param to list
> >                         params.add((Value)argv[j]);
> >                     }
> >
> 
>   Can be done by :
>     for (int j=0; j<xParameterNames.length; j++) {
>       params.add(activeBody.getParameterLocal(j));
>     }
> 
> 
> 
> 

________________________________________________________________
GET INTERNET ACCESS FROM JUNO!
Juno offers FREE or PREMIUM Internet access for less!
Join Juno today!  For your FREE software, visit:
http://dl.www.juno.com/get/tagj.