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

Matteo Miraz matteo.miraz at gmail.com
Mon May 31 05:14:27 EDT 2010


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 ---
 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


More information about the Soot-list mailing list