[Soot-list] try-catch-finally duplicate problem

Steven Arzt Steven.Arzt at cased.de
Tue Sep 2 15:45:18 EDT 2014


Hi all,

 

We know the problem with the line numbers in the current development version of Soot. There is a bug tracker entry for it and we will sort that out before we release Soot 2.6.0.

 

Best regards,

  Steven

 

Von: Martin Schäf [mailto:martinschaef at gmail.com] 
Gesendet: Dienstag, 2. September 2014 20:31
An: Danijel Mlinarić
Cc: Steven Arzt; soot-list at cs.mcgill.ca
Betreff: Re: [Soot-list] try-catch-finally duplicate problem

 

Two quick remarks that came up while working on a different problem:

- in soot-trunk.jar, you won't have line number tags if you analyze bytecode (but works for source code) ... you can use soot-2.5.0.jar as a workaround.

- from what I can see, you can identify the catch blocks in the actual bytecode (running javap -v on the class file) because they show up as traps with exception type "any" instead of "throwable". However, Soot translates both into "throwable" so you lose this information ... this might be an elegant way to find finally blocks.

Cheers,

M

 

 

On Tue, Sep 2, 2014 at 11:22 AM, Danijel Mlinarić <Danijel.Mlinaric at fer.hr> wrote:

Steven, Martin thank you very much for your info.

 

After searching for solution I was thinking that maybe I missed some feature in soot.

I built method graph based on jimple statements, and I used subgraphs to determine and replace duplicated finally blocks. 

That solution probably doesn't cover all cases since variables are not exact duplicates as Martin stated.

However I managed to eliminate goto statements and use some heuristics to handle variable problem, also as building traps hierarchy for nested cases.

 

Didn't know that duplicated statements contain same line number in tags, this is very helpful to improve current solution.

Thanks a lot.

 

Regards,

Daniel

  _____  

From: Martin Schäf [martinschaef at gmail.com]
Sent: Monday, September 01, 2014 17:28
To: Steven Arzt
Cc: Danijel Mlinarić; soot-list at cs.mcgill.ca
Subject: Re: [Soot-list] try-catch-finally duplicate problem

Hi Daniel, 

not sure if it helps, but I hacked my way around this by just looking for subprograms that have the same type of statements and same line numbers but are not directly connected. Its not bullet proof but works for most cases.

Its a bit tricky because the finally blocks are not exact duplicates. Variable names are different and sometimes a return turn into a goto.

My code is here: https://github.com/martinschaef/jar2bpl/blob/master/jar2bpl/src/org/joogie/soot/SootBodyTransformer.java

and the procedure you need is "detectDuplicatedFinallyBlocksAndCheckForSynchronizedStuff"

Hope that helps,

M

 

On Sun, Aug 31, 2014 at 11:27 PM, Steven Arzt <Steven.Arzt at cased.de> wrote:

Hi Daniel,

This happens because we get "duplicate" code from the various front-ends (ASM, Dexlib). In more detail, the following is generated:

* Run the code inside the try
* If an exception is caught inside the try, run the exception handler and then the finally stuff
* If an exception is caught inside the exception handler, run the finally code nevertheless
* If everything went alright, run the finally code

Instead of producing copies of the finally code, we could also try to identify such cases and always jump to the same label for the finally code. This would then be a new features inside Soot.

Best regards,
Steven

Danijel Mlinarić <Danijel.Mlinaric at fer.hr> wrote:

Hello,

 

I'm trying to analyze try-catch-finally blocks using jimple and graphs, problem is duplicated finally code after try and catch block. 

Is there any way to get one finally block per try-catch-finally or soot support some methods to determine equal duplicated blocks in jimple?

 

Any help is appreciated a lot.

 

Regards,

Daniel


_______________________________________________
Soot-list mailing list
Soot-list at CS.McGill.CA
https://mailman.CS.McGill.CA/mailman/listinfo/soot-list

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20140902/176f0955/attachment-0001.html 


More information about the Soot-list mailing list