[Soot-list] ThrowableSet.catchableAs()

irem irem at nada.kth.se
Tue Mar 18 08:08:11 EDT 2008


Hello everyone,

Some of you may remember the discussion about trying to get a list of
exceptions that can be thrown by a node in the control flow graph. 
John had given me detailed help on this:

http://www.sable.mcgill.ca/pipermail/soot-list/2007-November/001435.html

My current problem is a continuation on this track. I am trying to
create a control flow graph using the one created by soot. In my
formatting, I am interested to see if a certain node may throw an
exception of a certain kind. (For these nodes I create exceptional
successors which are labeled with the exception name. These successor
nodes do not exist in the soot control flow graph.) 

I have chosen an arbitrary set of exception types which I 
consider "relevant" to my analysis. I have created the RefType for each
of these exceptions:

impExceptions.add(RefType.v("java.lang.ClassNotFoundException"));
impExceptions.add(RefType.v("java.lang.ArithmeticException"));
impExceptions.add(RefType.v("java.lang.NullPointerException"));
impExceptions.add(RefType.v("java.lang.ClassCircularityError"));
impExceptions.add(RefType.v("java.lang.ClassFormatError"));
impExceptions.add(RefType.v("java.lang.UnsupportedClassVersionError"));
impExceptions.add(RefType.v("java.lang.ExceptionInInitializerError"));
impExceptions.add(RefType.v("java.lang.IncompatibleClassChangeError"));
impExceptions.add(RefType.v("java.lang.AbstractMethodError"));
impExceptions.add(RefType.v("java.lang.IllegalAccessError"));
impExceptions.add(RefType.v("java.lang.InstantiationError"));
impExceptions.add(RefType.v("java.lang.NoSuchFieldError"));
impExceptions.add(RefType.v("java.lang.NoSuchMethodError"));
impExceptions.add(RefType.v("java.lang.NoClassDefFoundError"));
impExceptions.add(RefType.v("java.lang.UnsatisfiedLinkError"));
impExceptions.add(RefType.v("java.lang.VerifyError"));


Currently, I get objects of type ThrowableSet for the exceptions thrown
by a node. What I want to do is to check which of the exceptions that I
consider relevant are in a particular ThrowableSet and for such each
exception create a successor node to the node that throws the exception.
For instance if the ThrowableSet is +(Throwable), then I am to get 16 
new nodes. 

Now coming to my problem. I make calls to catchableAs to accomplish what
I described above.  Let exc_set be the ThrowableSet of a control flow
graph node and impExc be the RefType object of one of the exceptions
above, I make the call as follows:
	exc_set.catchableAs(impExc)  


I get the following error for exc_set= +java.lang.ThreadDeath
+java.lang.OutOfMemoryError+java.lang.StackOverflowError
+java.lang.IllegalMonitorStateException+java.lang.UnknownError
+java.lang.InternalError

and impExc= java.lang.UnsupportedClassVersionError
 
  
Exception in thread "main" java.lang.RuntimeException: This operation
requires resolving level HIERARCHY but
java.lang.UnsupportedClassVersionError is at resolving level DANGLING
	at soot.SootClass.checkLevel(SootClass.java:121)
	at soot.FastHierarchy.canStoreClass(FastHierarchy.java:269)
	at soot.FastHierarchy.canStoreType(FastHierarchy.java:204)
	at
soot.toolkits.exceptions.ThrowableSet.catchableAs(ThrowableSet.java:904)
----------------

Does anyone know what I am doing wrong?

Thanks,

irem



More information about the Soot-list mailing list