[Soot-list] Exception handler question in Soot

Steven Arzt Steven.Arzt at cased.de
Thu Dec 10 04:46:52 EST 2015


Hi Feng,

 

In Soot, exception handlers are modeled using traps. Every trap object stores the start unit (the first trapped unit, i.e., the first unit inside the “try” block) and the end unit (the first unit that is no longer trapped, i.e., the first unit after the “try” block ends). With these two elements, the units inside the “try” block can be identified. The handler is a bit trickier. The trap stores the first unit in the handler. That’s all we know. In Java bytecode, an exception jumps to a specific statement. Once the control flow has arrived there, it can do whatever it wants. In bytecode, you don’t even need those nice “catch” blocks that you know from Java source code. You can, for instance, just jump back into the middle of your code. That’s why there cannot be a “catch end” unit in general.

 

Having said that, most bytecode generated from source by some Java compiler will have a structure you can exploit. You can try to come up with heuristics to exploit that structure.

 

Best regards,

  Steven 

 

Von: soot-list-bounces at CS.McGill.CA [mailto:soot-list-bounces at CS.McGill.CA] Im Auftrag von feng shen
Gesendet: Dienstag, 1. Dezember 2015 07:57
An: soot-list at CS.McGill.CA
Betreff: [Soot-list] Exception handler question in Soot

 

Hi, 

 

I want to know if there is any way to get the try-catch block body in Soot?

 

I can see that Soot provides the support to get the first handler unit. But it does not provide how you can determine where the exception handler ends.

 

Is there a way to get the whole exception handler body?

 

Similar problem with the "Try" clause. How can I determine where the "Try" clause starts and ends? By that, i mean the whole "Try" block instead of only the unit that throws exceptions.

 

 

thanks in advance.

 

-Feng

-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20151210/22bff50a/attachment.html 


More information about the Soot-list mailing list