soot-oss / soot

Soot - A Java optimization framework
GNU Lesser General Public License v2.1
2.85k stars 705 forks source link

using soot in java #1253

Open Shabnam-t opened 4 years ago

Shabnam-t commented 4 years ago

hello I am new in soot and I have a little background in java. now I want using soot for analyzing java code I do not how can use it in java code?hoe use it in main class?

ftc commented 4 years ago

I would highly recommend reading "A Survivor's Guide to Java Program Analysis with Soot" which can be found at the following link:

https://www.brics.dk/SootGuide/

For a quick example, you can skip to section 4.3 " Extending Soot’s Main class". The class MyAnalysisTagger is a subclass of BodyTransfomer that you implement.

Shabnam-t commented 4 years ago

Tank you so much.but for fed java to soot which instructions are necessary?

On Fri, Dec 20, 2019 at 5:21 PM Shawn Meier notifications@github.com wrote:

I would highly recommend reading "A Survivor's Guide to Java Program Analysis with Soot" which can be found at the following link:

https://www.brics.dk/SootGuide/

For a quick example, you can skip to section 4.3 " Extending Soot’s Main class". The class MyAnalysisTagger is a subclass of BodyTransfomer https://github.com/Sable/soot/blob/4a04145d1a4d2713ef2733e33abd5ba77b2fd848/src/main/java/soot/BodyTransformer.java that you implement.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Sable/soot/issues/1253?email_source=notifications&email_token=ANYOE3UGCKVECOCZJYT72R3QZVANZA5CNFSM4J3OWM5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHOKQOA#issuecomment-568109112, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANYOE3R66U6KN4NNPLLMZA3QZVANZANCNFSM4J3OWM5A .

ftc commented 4 years ago

Typically I compile the java code to .class files or a .jar and run Soot on that. It is possible to run soot directly on the .java files but there are disadvantages to that. This page in the wiki has more details:

https://github.com/Sable/soot/wiki/Running-Soot

The example from section 4.3 passes command-line options that it receives directly to Soot via the args variable.

Shabnam-t commented 4 years ago

I want compiling in eclipse.

On Fri, Dec 20, 2019 at 5:48 PM Shawn Meier notifications@github.com wrote:

Typically I compile the java code to .class files or a .jar and run Soot on that. It is possible to run soot directly on the .java files but there are disadvantages to that. This page in the wiki has more details:

https://github.com/Sable/soot/wiki/Running-Soot

The example from section 4.3 passes command-line options that it receives directly to Soot via the args variable.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Sable/soot/issues/1253?email_source=notifications&email_token=ANYOE3VXINCA2XAQICYPFH3QZVDTZA5CNFSM4J3OWM5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHOMGVY#issuecomment-568116055, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANYOE3VZ6FUBDFDFGMYIDCDQZVDTZANCNFSM4J3OWM5A .

ftc commented 4 years ago

Unfortunately, I don't use Eclipse so I can't help much there. You may want to look through the wiki, there are a few articles involving the Eclipse ide.

Shabnam-t commented 4 years ago

Thank you but i can not find it

On Fri, Dec 20, 2019 at 7:26 PM Shawn Meier notifications@github.com wrote:

Unfortunately, I don't use Eclipse so I can't help much there. You may want to look through the wiki, there are a few articles involving the Eclipse ide.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Sable/soot/issues/1253?email_source=notifications&email_token=ANYOE3USOF4P2KSVQFBYGWDQZVPE5A5CNFSM4J3OWM5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHOQN4Q#issuecomment-568133362, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANYOE3V7L6WYK255G7AXFVDQZVPE5ANCNFSM4J3OWM5A .

anddann commented 4 years ago

I totally agree, we should provide an example folder that shows how soot can be used and configured from Java code directly. Do you mind sharing your code as a PR?

Shabnam-t commented 4 years ago

Yes exactly

On Fri, Jan 24, 2020 at 12:18 PM Andreas Dann notifications@github.com wrote:

I totally agree, we should provide an example folder that shows how soot can be used and configured from Java code directly. Do you mind sharing your code as a PR?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Sable/soot/issues/1253?email_source=notifications&email_token=ANYOE3RCMOEM4IX7D5EE7OTQ7MPFXA5CNFSM4J3OWM5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJ3PH3Y#issuecomment-578221039, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANYOE3VSJINRZB7OHSJQJLDQ7MPFXANCNFSM4J3OWM5A .

anddann commented 4 years ago

super, can you reference this issue in your PR