[Soot-list] Problem with SOOT: no defs for value

Matteo Miraz matteo.miraz at gmail.com
Tue Jun 8 05:58:50 EDT 2010


Hi Eric,

thank for your response.
After some debugging I finally found the error, which was on the order
of the traps. I wrap the code of the method with a try { } catch
(Throwable  exc) {...}, and I added this trap at the beginning of the
trap list. Instead I should add it at the end.

Thank you for helping me in finding this error,
Matteo

On Mon, May 31, 2010 at 12:39 PM, Eric Bodden
<bodden at st.informatik.tu-darmstadt.de> wrote:
> Hi Matteo.
>
> I also cannot find anything wrong with the generated code, but I am
> sure that we are overlooking something. In my experience, Soot is
> always right when it comes to such things. It may help to use a
> debugger to determine what exactly causes Soot to generate this error
> message. The appropriate code should be in soot.Body.validateUses(). I
> recommend just setting a breakpoint there and looking at the context.
>
> Eric
>
> --
> Dr. Eric Bodden
> Software Technology Group, Technische Universität Darmstadt, Germany
> Tel: +49 6151 16-5478    Fax: +49 6151 16-5410
> Mailing Address: S2|02 A209, Hochschulstraße 10, 64289 Darmstadt
>
>
>
> On 31 May 2010 11:14, Matteo Miraz <matteo.miraz at gmail.com> wrote:
>> Dear all,
>>
>> I’m using SOOT to modify some classes and insert some instrumentation
>> (for now, to track the basic block coverage). However, I have an error
>> when I try to instrument the following method:
>>
>> package dummy;
>> public class Instrumenter1 {
>>
>>  public int emptyCatch(Object o) {
>>   try {
>>     return o.hashCode();
>>   } catch (Exception e) {
>>     return -1;
>>   }
>>  }
>>
>> }
>>
>> The jimple of such method is:
>> Method: <dummy.Instrumenter1: emptyCatch(Ljava/lang/Object;)I>
>> --- locals ---
>>  r0 : dummy.Instrumenter1
>>  r1 : java.lang.Object
>>  r2 : java.lang.Exception
>>  $i0 : int
>>  $r3 : java.lang.Exception
>> --- units ---
>>  0 r0 := @this: dummy.Instrumenter1
>>  1 r1 := @parameter0: java.lang.Object
>>  2 $i0 = virtualinvoke r1.hashCode()
>>  3 return $i0
>>  4 $r3 := @caughtexception
>>  5 r2 = $r3
>>  6 return -1
>> --- traps ---
>>  2-3 -> (java.lang.Exception) -> 4
>>
>> The instrumented version becomes:
>> --- locals --- 5-7 -> (java.lang.Throwable) -> 7
>>  r0 : dummy.Instrumenter1
>>  r1 : java.lang.Object
>>  r2 : java.lang.Exception
>>  $i0 : int
>>  $r3 : java.lang.Exception
>>  __throwable_exc__ : java.lang.Throwable
>>  __testful__white_tracker__ : testful.coverage.whiteBox.TrackerWhiteBox
>>  __testful_white_condition_target__ : int
>>  __testful_white_tmp_double_1__ : double
>>  __testful_white_tmp_double_2__ : double
>> --- units ---
>>  0 r0 := @this: dummy.Instrumenter1
>>  1 r1 := @parameter0: java.lang.Object
>>  2 __testful__white_tracker__ = staticinvoke
>> testful.coverage.whiteBox.TrackerWhiteBox.getTracker()
>>  3 __testful_white_condition_target__ = virtualinvoke
>> __testful__white_tracker__.getConditionTargetId()
>>  4 virtualinvoke __testful__white_tracker__.trackBasicBlock(8)
>>  5 $i0 = virtualinvoke r1.hashCode()
>>  6 goto 9
>>  7 __throwable_exc__ := @caughtexception
>>  8 throw __throwable_exc__
>>  9 virtualinvoke __testful__white_tracker__.trackBasicBlock(9)
>>  10 return $i0
>>  11 virtualinvoke __testful__white_tracker__.trackBasicBlock(10)
>>  12 $r3 := @caughtexception
>>  13 r2 = $r3
>>  14 return -1
>>  15 __throwable_exc__ := @caughtexception
>>  16 throw __throwable_exc__
>> --- traps ---
>>  5-7 -> (java.lang.Throwable) -> 7
>>  4-15 -> (java.lang.Throwable) -> 15
>>  4-11 -> (java.lang.Exception) -> 11
>>
>> To track basick blocks, I use an instance of
>> testful.coverage.whiteBox.TrackerWhiteBox, which provides method
>> trackBasicBlock(int) to track them. Unit 2 retrieves an instance of
>> such class, which is stored in the local  __testful__white_tracker__.
>> It is at the beginning of the method, hence it should reach all the
>> subsequent uses.
>> However, SOOT fails to create the bytecode, and it outputs the following error:
>> no defs for value: __testful__white_tracker__! in
>> <dummy.Instrumenter1: int emptyCatch(java.lang.Object)>
>>
>> Can anybody help me?
>> Matteo
>> _______________________________________________
>> Soot-list mailing list
>> Soot-list at sable.mcgill.ca
>> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>>
>



-- 
A clever person solves a problem.
A wise person avoids it.
(Einstein)


More information about the Soot-list mailing list