soot icon indicating copy to clipboard operation
soot copied to clipboard

How to do backward slicing with Soot?

Open smith-co opened this issue 3 years ago • 4 comments

Thanks for this great library.

I am thinking to use Soot for backward slicing.

  • Is there any example to do this?
  • Can I run it from a IntelliJ or Eclipse plugin?
  • Does it support latest JDK version such as java 16?
  • Can I map back the three address code to the actual code?

For my case, what I need is to select the code based on a given statement:

For example, given the following code, and slice point:

x = 1;
y = 2;
z = y-2;
r = x;
z = x+y; /* the slice point is the end of the program */.

I need to get the backward sliced code:

x = 1;
y = 2;
z = x+y;

I think this should have an example of its own as there have been many requests in the soot mailing list regarding this.

I know this is an extremely powerful library.

But it seems to be very convoluted and I am struggling to understand it. Is it actually possible to use it for my use case (backward slicing) without spending months with the tool?

smith-co avatar Nov 22 '22 23:11 smith-co

Hi,you can take a look at the contents of my repo. I tried to use soot and Amandroid to achieve the same goal as you said respectively. I don’t know if it can help you.

Firework471 avatar Aug 18 '23 05:08 Firework471

@Firework471 which repo are you referring to?

code2graph avatar Aug 18 '23 05:08 code2graph

@code2graph

  1. https://github.com/Firework471/ClickScanner
  2. https://github.com/Firework471/Argus-SAF-playground/blob/master/src/main/scala/org/argus/play/random/FileResolver.scala And I suggest you use the first one which is based on soot. I'm sorry it is only a .jar file because I'm still working on it. I hope it could help you.

Firework471 avatar Aug 18 '23 05:08 Firework471

thanks @Firework471!

Would be great to get access to the source code for the ClickScanner, thanks again for your help.

code2graph avatar Aug 18 '23 05:08 code2graph